Paste #23247: next greeter

Date: 2015/11/30 10:11:19 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


#this script was originally posted as a video by mcmonkey at 
# http://mcmonkey.org/denizen/vids/Putting%20It%20Together:%20NPC%20Guides
#my only real addition to the script was the guide now walks back to the
#start position instead of just disappearing. 
#format chat for the NPC
#last edit 11/29/2015
cchat:
  type: format
  format: "<&b><npc.name><&f> <&co> <&a><text>"
#my npc greeter, no need to be 65 or older to work at walmart.
greeter:
  type: assignment
  actions:
    on assignment:
    - trigger name:click state:true
    - trigger name:chat state:true
  interact scripts:
  - 10 greet_em
#now the actual scripts
greet_em:
  type: interact
  steps:
    1:
      click trigger:
        script:
        - narrate format:cchat "Hello I am <npc.name>, would you care for a tour?"
        - narrate "Type /yes/ or /no/"
      chat trigger:
        1:
          trigger: /Yes/ sure
          script:
          - narrate format:cchat "Ok then follow me"
#creater an NPC named greeter and saves it for later use in the script.
          - ^create player NPCGreeter <npc.location> save:greeter
          - ^adjust <player> hide_entity:<npc>
# Now to make the npc not be in the list of online players.
          - ^adjust <server.list_online_players.exclude[<player>]> hide_entity:<entry[greeter].created_npc>
#now run the greeter_path and greeter_talk tasks
          - ^run greeter_path npc:<entry[greeter].created_npc> def:<^npc>
          - ^run greeter_talk npc:<entry[greeter].created_npc>
          - zap 2
        2:
          trigger: /No/ thanks
          script:
          - narrate format:cchat "Ok then enjoy your time here"
#now taks scrips for path
greeter_path:
  type: task
  definitions: masternpc
  script:
#ok i need to remember the start location of the npc so we can walk there at the end
#hide_entity is a mechanism 
      - ^flag <npc> startlocation:<npc.location>
      - ^narrate "Start location = <npc.flag[startlocation]>"
   - while <player.is_online.is[==].to[true] {
#just the stops on the tour      
      - ^flag <npc> step:1
      - ~walk <def[masternpc].anchor[tourstop1]> auto_range
      - ^inject greeter_waits
      - flag <npc> step:2
      - ~walk <def[masternpc].anchor[tourstop2]> auto_range
      - ^inject greeter_waits
      - flag <npc> step:3
      - ~walk <def[masternpc].anchor[tourstop3]> auto_range
      - ^inject greeter_waits
      - flag <npc> step:4
      - ~walk <def[masternpc].anchor[tourstop4]> auto_range
      - ^inject greeter_waits
#Now we want the NPC to walk back to the start location
      - flag <npc> step:5
      - ~walk <npc.flag[startlocation]> auto_range
      - wait 1
      }
      - run greeter_cleanup
greeter_cleanup:
  type: task
  script:
   #this next line is actually a problem as of the edit date and will throw an error known by mcmonkey
     - remove <npc>    
     - adjust <player> show_entity:<def[masternpc]>        
     - zap step:1 script:s@greet_em player:<player> 
#the greeter waits for player to catch up
greeter_waits:
  type: task
  script:
  - ^while <npc.location.distance[<player.location>].is[OR_MORE].than[5]> {
    - narrate format:cchat "Come along, please try and keep up"
    - wait 2
    }
#now the taks script for talking points on the path
#is still some errors and timing definately sucks
#as to the location and speech. 
greeter_talk:
  type: task
  script:
  - narrate format:cchat "We are glad you joined the Chapel Perilous"
  - narrate format:cchat "A modded survival server"
  - narrate "step= <npc.flag[step]>"
  - wait 4
  - while <npc.flag[step].is[OR_LESS].than[0]> {
    - wait 3
    }
  - narrate "step= <npc.flag[step]>"
  - narrate format:cchat "Here we have the Erisian Temple of Dealey Plaza"
  - narrate format:cchat "Here you can get promoted as well as get"
  - narrate format:cchat "healing from the High Priest Hagbard Celine"
  - while <npc.flag[step].is[OR_LESS].than[1]> {
    - wait 3
    }
  - narrate "step= <npc.flag[step]>"
  - narrate format:cchat "Here we have the JFK Inn of Dealey Plaza"
  - narrate format:cchat "The inn keeper is DealyLlama the Mayor of Dealey Plaza"
  - narrate format:cchat "Room rentals are for 30 days right click a sign to rent a room"
  - while <npc.flag[step].is[OR_LESS].than[2]> {
    - wait 1
    }
  - narrate "step= <npc.flag[step]>"
  - narrate format:cchat "Here we have the DealeyLlama's Deal o'Rama"
  - narrate format:cchat "you can buy or sell items here"
  - narrate format:cchat "left click checks. right click does the deal"
  - while <npc.flag[step].is[OR_LESS].than[3]> {
    - wait 17
    }
  - narrate "step= <npc.flag[step]>"
  - narrate format:cchat "Here we have the Dealey Plaza Jail!"
  - narrate format:cchat "not a very nice place to spend time"
  - while <npc.flag[step].is[OR_LESS].than[4]> {
    - wait 1
    }
  - narrate "step= <npc.flag[step]>"
  - narrate format:cchat "That ends the tour"