Paste #7020: sentry

Date: 2014/07/17 09:05:17 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Sentry:
  type: assignment
  interact scripts:
  - 100 TheSentry
  actions:
    on assignment:
    - trigger name:click toggle:true
TheSentry:
  type: interact
  steps: 
    1:
      click trigger:
        script:
         - if <npc.owner> = <player> {
          - chat "Welcome to sentry tell me 'wallguard' to go to wallguard script or 'bodyguard' for me to guard you"
          } else {
          - chat "I'm in the service of lord <npc.owner> it's quite a honor"
          }
      chat trigger:
        'wallguard':
          trigger: "I want you to be a /wallguard/"
          script:
          - zap step:wallguard
        'bodyguard':
          trigger: "I want you to be a /bodyguard/"
          script:
          - zap 'step:bodyguard'
    wallguard:
      click trigger:
        script:
        - if <npc.owner> = <player> {
          - chat "Welcome to the wallguard menu tell me Names of people you want me to ignore then say 'point1, point2, point3, and point4' for the 4 points on point four the sentry will start guarding "
          - execute as_server "sentry <npc.id> guard <player.name>"
          }
          else {
          - chat "Good day to you sir."
          }
      chat trigger:
        'faction':
          trigger: "I want you to ignore /Regex:.+/"
          script:
          - flag npc player2ignore:<player.chat_history>
          - execute as_server "sentry <npc.id> ignore add player:<npc.flag[player2ignore]>"
          - chat "The name has been registered"
        'point1':
          trigger: "this is your /point1/"
          script:
          - narrate "point one registered."
          - ^flag <npc> pos1:<player.location>
        'point2':
          trigger: "this is your /point2/"
          script:
          - narrate "point two registered."
          - ^flag <npc> pos2:<player.location>
        'point3':
          trigger: "this is your /point3/"
          script:
          - narrate "point three registered."
          - ^flag <npc> pos3:<player.location>
        'point4':
          trigger: "this is your /point4/"
          script:
          - narrate "point four is registered and the sentry begins to patrol."
          - execute as_server "sentry <npc.id> guard"
          - ^flag <npc> pos4:<player.location>
          - execute as_server "sentry <npc.id> target add entity:PLAYER"
          - run execute
          - zap step:ChooseTask
    2:
      click trigger:
        script:
        - if <npc.owner> = <player> {
          - chat "Hello my lord which task would you like me to do?"
          - chat "Would you like me to continue or be your bodyguard"
          - zap 'step:ChooseTask'
          }
          else {
          - chat "Hello mate how are you?"
          - zap step:1
          }
    'ChooseTask':
      chat trigger:
        'continue':
          trigger: "I want you to /continue/."
          script:
          - run execute
        'bodyguard':
          trigger: "I want you to be a /bodyguard/."
          script:
          - flag <npc> STOP
          - zap 'step:bodyguard'
        'return':
          trigger: "I want you to /return/."
          script:
          - zap 'step:bodyguard'
    'continue':
      click trigger:
        script:
        - chat "Hello sir just making my rounds."
    'bodyguard':
      click trigger:
        script:
        - chat "Welcome to the bodyguard menu say hold to make me stop then follow for me to continue to guard you. or return to get back the wall sentry."
        - execute as_server "sentry <npc.id> guard <player.name>"
        - zap 'step:stop'
    'stop':
      chat trigger:
        'Stop':
          trigger: "/Stop/ here!."
          script:
          - execute as_server "sentry <npc.id> guard"
          - zap 'step:stop'
        'follow':
          trigger: "/Follow/ me!."
          script:
          - execute as_server "sentry <npc.id> guard <player.name>"
          - zap 'step:stop'
        'return':
          trigger: "/return/ to the beggining!."
          script:
          - execute as_server "sentry <npc.id> guard <player.name>"
          - flag npc STOP:!
          - zap step:1
execute:
  type: task
  script:
  - if <npc.flag[STOP]> queue clear
    else {
    - ~walk <npc> <npc.flag[pos1]>
    - ~walk <npc> <npc.flag[pos2]>
    - ~walk <npc> <npc.flag[pos3]>
    - ~walk <npc> <npc.flag[pos4]>
    - run execute
   }