Paste #28721: Untitled Paste

Date: 2016/01/19 00:54:04 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#######################
# File for NPC Grocer #
#######################

####################################
# Assignment script for NPC Grocer #
####################################
NPC_Grocer:
  type: assignment
  actions:
    on assignment:
    - ^run Assign_Triggers npc:<npc>
    - ^run Esteem_NPC_Responses npc:<npc>
    - ^run Assign_Walk_Flags npc:<npc> def:3|10
    - ^run Walk npc:<npc>
  interact scripts:
  - NPC_Grocer_Interact

##################################
# Interact script for NPC Grocer #
##################################
NPC_Grocer_Interact:
  type: interact
  steps:
      1:
            click trigger:
                script:
                - inject NPC_Grocer_Greeting_Event
                - open inventory d:in@NPC_Grocer_Inventory
            chat trigger:
                1:
                      trigger: /Failure/
                      script:
                      - inject NPC_Grocer_Rude_Event
                2:
                      trigger: /Failure in life/
                      script:
                      - inject NPC_Grocer_Rude_Event
                3:
                      trigger: /Hi/
                      script:
                      - inject NPC_Grocer_Greeting_Event
                4:
                      trigger: /Hello/
                      script:
                      - inject NPC_Grocer_Greeting_Event
                5:
                      trigger: /Hullo/
                      script:
                      - inject NPC_Grocer_Greeting_Event
                6:
                      trigger: /Sup/?
                      script:
                      - inject NPC_Grocer_Greeting_Event
                7:
                      trigger: /What's up/?
                      script:
                      - inject NPC_Grocer_Greeting_Event
                8:
                      trigger: /Yo/!
                      script:
                      - inject NPC_Grocer_Greeting_Event
                9:
                      trigger: /Greeting/s!
                      script:
                      - inject NPC_Grocer_Greeting_Event
                10:
                       trigger: /Who are you/?
                       script:
                       - inject NPC_Grocer_Who_Event
                11:
                       trigger: What's your /job/?
                       script:
                       - inject NPC_Grocer_Who_Event
                12:
                       trigger: What do you /work/ as?
                       script:
                       - inject NPC_Grocer_Who_Event
                13:
                       trigger: /What do you/?
                       script:
                       - inject NPC_Grocer_Who_Event
                14:
                       trigger: /How are you/ doing?
                       script:
                       - inject NPC_Grocer_How_Event
                15:
                       trigger: /How have you been/?
                       script:
                       - inject NPC_Grocer_How_Event
                16:
                       trigger: /How has it been/?
                       script:
                       - inject NPC_Grocer_How_Event
                17:
                       trigger: /How's life/?
                       script:
                       - inject NPC_Grocer_How_Event
                18:
                       trigger: /How has life been/?
                       script:
                       - inject NPC_Grocer_How_Event
                19:
                       trigger: /How is life/?
                       script:
                       - inject NPC_Grocer_How_Event
                20:
                       trigger: /credits/?
                       script:
                       - narrate format:Talk_Format "Credits: PlanetMinecraft user: LukyLucas http://www.planetminecraft.com/skin/arryn-mansions-cook/"
########################
# NPC Grocer inventory #
########################
NPC_Grocer_Inventory:
  type: inventory
  inventory: CHEST
  title: <&2>Grocer's market specials<&r>
  size: 27
  slots:
    - "[i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air]"
    - "[i@air] [i@air] [i@air] [i@air] [i@Item_Display_Cake] [i@air] [i@air] [i@air] [i@air]"
    - "[i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air] [i@air]"

################################
# NPC_Grocer_Inventory_Handler #
################################
NPC_Grocer_Inventory_Handler:
  type: world
  events:
    on player clicks in NPC_Grocer_Inventory:
    - determine cancelled
    on player drags in NPC_Grocer_Inventory:
    - determine cancelled
    on player clicks Item_Display_Cake in NPC_Grocer_Inventory:
    - define price <proc[Item_Determine_Price].context[<server.flag[basePeaceOfferingPrice]>|<player.flag[esteem]>]>
    - define item i@Item_Peace_Offering
    - inject NPC_Grocer_Inventory_Handler_Helper

##################################################
# Helper script for NPC_Grocer_Inventory_Handler #
##################################################
NPC_Grocer_Inventory_Handler_Helper:
  type: task
  definitions: price|item
  script:
  - if <proc[Item_Determine_Player_Money].context[<def[price]>|<player.money>]> {
    - if <player.inventory.can_fit[<def[item]>]> {
      - take money quantity:<def[price]>
      - give <def[item]> quantity:1
      - inject NPC_Grocer_Purchase_Event
      }
      else {
      - narrate format:Talk_Format "Hey greedy! Your inventory is full!"
      }
    }
    else {
    - narrate format:Talk_Format "Hey! You don't have enough money to buy that!"

###########################################
# Task script for handling greeting event #
###########################################
NPC_Grocer_Greeting_Event:
  type: task
  script:
  - walk stop
  - queue <npc.flag[walkQueue]> pause
  - if <proc[Esteem_Determine]> == "liked" {
    - random {
      - narrate format:Talk_Format "Hey <player.name>! What can I get for you today?"
      - narrate format:Talk_Format "May I get you anything today, <player.name>?"
      - narrate format:Talk_Format "Anything you are specifically after today, <player.name>?"
      - narrate format:Talk_Format "What are you after, <player.name>?"
      - narrate format:Talk_Format "Do you need help with anything? <player.name>?"
      - narrate format:Talk_Format "Are you looking for anything, <player.name>?"
      }
    }
    else if <proc[Esteem_Determine]> == "neutral" {
    - random {
      - narrate format:Talk_Format "Hello <player.name>, can I interest you"
      - narrate format:Talk_Format "Can I interest you in some of my wares?"
      - narrate format:Talk_Format "May I help you?"
      - narrate format:Talk_Format "What do you need??"
      - narrate format:Talk_Format "What can I get you today?"
      - narrate format:Talk_Format "How can I help you?"
      }
    }
    else if <proc[Esteem_Determine]> == "disliked" {
    - random {
      - narrate format:Talk_Format "Are you looking for something?"
      - narrate format:Talk_Format "Can I help you?"
      - narrate format:Talk_Format "Watcha buying?"
      - narrate format:Talk_Format "Is there anything you want?"
      - narrate format:Talk_Format "Are you looking for something?"
      - narrate format:Talk_Format "Do you need anything?"
      }
    }
  - walk <npc.anchor[<npc.flag[anchorPoint]>]>
  - queue <npc.flag[walkQueue]> resume
#######################################
# Task script for handling who events #
#######################################
NPC_Grocer_Who_Event:
  type: task
  script:
  - walk stop
  - queue <npc.flag[walkQueue]> pause
  - if <proc[Esteem_Determine]> == "liked" {
    - random {
      - narrate format:Talk_Format "Haha, <player.name>, I'm Fred, the local grocery store owner!"
      - narrate format:Talk_Format "Oh have you forgotten old Fred? This is my shop!"
      - narrate format:Talk_Format "It's old Fred the grocer! Have you forgotten me?"
      - narrate format:Talk_Format "Is that really you, <player.name>? It's been yearss! I'm Fred, remember? Fred the grocer."
      - narrate format:Talk_Format "I'm Fred! I own my own grocery stall!"
      - narrate format:Talk_Format "Hey <player.name>, have you forgotten me already? I'm Fred!"
      }
    }
    else if <proc[Esteem_Determine]> == "neutral" {
    - random {
      - narrate format:Talk_Format "It's me, Fred! How are you, <player.name>?"
      - narrate format:Talk_Format "Have you forgotten me, old friend? It's me Freddi!"
      - narrate format:Talk_Format "I'm Fred, I run my own business, and who may you be?"
      - narrate format:Talk_Format "I'm Freddie, I own a stall here in the market."
      - narrate format:Talk_Format "I'm Freddy, I own this stall here, how about you?"
      - narrate format:Talk_Format "I'm Freddie, this grocery shop is mine, traveller."
      }
    }
    else if <proc[Esteem_Determine]> == "disliked" {
    - random {
      - narrate format:Talk_Format "I sell groceries for a living...."
      - narrate format:Talk_Format "I own this grocery shop.."
      - narrate format:Talk_Format "I'm Fred, I run my oww grocery shop here."
      - narrate format:Talk_Format "Do I know you?"
      - narrate format:Talk_Format "I'm Fred, the shop's owner."
      - narrate format:Talk_Format "I'm the owner of this shop, Fred."
      }
    }
  - walk <npc.anchor[<npc.flag[anchorPoint]>]>
  - queue <npc.flag[walkQueue]> resume
######################################
# Task script for handling how event #
######################################
NPC_Grocer_How_Event:
  type: task
  script:
  - walk stop
  - queue <npc.flag[walkQueue]> pause
  - if <proc[Esteem_Determine]> == "liked" {
    - random {
      - narrate format:Talk_Format "Hey <player.name>, how's it going? I'm doing good!"
      - narrate format:Talk_Format "It can't get any better! How's your life?"
      - narrate format:Talk_Format "Oh, never mind me! How are you?"
      - narrate format:Talk_Format "How am I???? Haha, nothing can ever make me feel down!"
      - narrate format:Talk_Format "Old Fred has been doing well, I run my own business now!"
      - narrate format:Talk_Format "Just the same as usual. Good!"
      }
    }
    else if <proc[Esteem_Determine]> == "neutral" {
    - random {
      - narrate format:Talk_Format "Old Fred has been fine! How about you?"
      - narrate format:Talk_Format "It's going well! How's it been man?"
      - narrate format:Talk_Format "I'm all good pal, how are you?"
      - narrate format:Talk_Format "Old Fred never feels down! You know that!"
      - narrate format:Talk_Format "Pal, how's it going? I'm good."
      - narrate format:Talk_Format "I'm"
      }
    }
    else if <proc[Esteem_Determine]> == "disliked" {
    - random {
      - narrate format:Talk_Format "I've been good."
      - narrate format:Talk_Format "I'm cool, what about you?"
      - narrate format:Talk_Format "It's good to see you! Old Fred has been doing well!"
      - narrate format:Talk_Format "My life has been good..."
      - narrate format:Talk_Format "It's going smoothly!"
      - narrate format:Talk_Format "My life has been good."
      }
    }
  - walk <npc.anchor[<npc.flag[anchorPoint]>]>
  - queue <npc.flag[walkQueue]> resume
########################################
# Task script for handling rude events #
########################################
NPC_Grocer_Rude_Event:
  type: task
  script:
  - walk stop
  - queue <npc.flag[walkQueue]> pause
  - if <proc[Esteem_Determine]> == "liked" {
    - random {
      - narrate format:Talk_Format "My gosh, how rude can you be?"
      - narrate format:Talk_Format "Good riddance!"
      - narrate format:Talk_Format "Do you have to?"
      - narrate format:Talk_Format "What are you trying to imply?"
      - narrate format:Talk_Format "How rude can you be?"
      - narrate format:Talk_Format "YOu're going to cause your own downfall."
      }
    }
    else if <proc[Esteem_Determine]> == "neutral" {
    - random {
      - narrate format:Talk_Format "Keep continuing... and someone's going to end up with a pumpkin shoved up."
      - narrate format:Talk_Format "Easy on it!"
      - narrate format:Talk_Format "You won't like me when I'm anrgy."
      - narrate format:Talk_Format "Hey! What's the big idea?"
      - narrate format:Talk_Format "Don't you dare call me that!"
      - narrate format:Talk_Format "Hey!"
      }
    }
    else if <proc[Esteem_Determine]> == "disliked" {
    - random {
      - narrate format:Talk_Format "You're thicker than a head of cabbage!"
      - narrate format:Talk_Format "Hey, shut it, turnip brain!"
      - narrate format:Talk_Format "Hey watch it there!"
      - narrate format:Talk_Format "Don't get all pissy with me now, chump."
      - narrate format:Talk_Format "Get lost before I ram a pumpkin up!"
      - narrate format:Talk_Format "Someone needs to shut up here."
      }
    }
  - walk <npc.anchor[<npc.flag[anchorPoint]>]>
  - queue <npc.flag[walkQueue]> resume