guard1


Author: jstmemage
Created: 2014-01-02T10:33:30-0500
Edited: 2014-01-02T10:33:30-0500
Denizen Version: 0.9
Views: 13
Downloads: 766
Likes: 0


WGET
Description: This is a simple bodyguard that will follow you around and kill anything within detection range. They are very powerful but only stick around for a couple minutes, was designed as a way to use up player gold.
They also can be clicked to see how much longer they are working for you.

Note: Problems with general chat when bodyguard present

# This script is for a bodyguard that can be hired on.
"guard1":

  type: assignment
  
  default constants:
    guard1duration: 600
    guard1cost: 50
  
  actions:
  
    on assignment:
    - trigger name:chat toggle:true radius:6
    - trigger name:click: toggle:true
    - trigger name:proximity toggle:true
    - execute as_op "npc sel"
    - execute as_op "trait sentry"
    - execute as_op "sentry armor 3"
    - execute as_op "sentry healrate 1"
    - execute as_op "sentry strength 10"
    - execute as_op "sentry target add entity:monster"
 
    
  interact scripts:
  - 10 guard1_script
  
"guard1_script":
  type: interact
  
  steps:
    1:
      click trigger:
        script:
        # On clicking, run a script to check requirements before starting quest.
        - run "guard1 Quest Requirement"
        
    2:
      chat trigger:
        'yes':
          trigger: /Yes/, I will hire you.
          script: 
          - engage
          - take money "qty:<cons:guard1cost>"
          - execute as_op "npc sel <npc.id>"
          - execute as_op "sentry guard <player.name>"
          - flag player "guard1:hired" "duration:<cons:guard1duration>"
          - chat "Good. I'll kill anybody that gets close."
          - narrate "<red>Guard Hired."
          - wait <cons:guard1duration>
          - chat "Well, its time to go."
          - narrate "<red>Guard Quit"
          - EXECUTE AS_SERVER "npc select <npc.id>"
          - EXECUTE AS_SERVER "sentry guard"
          - EXECUTE AS_SERVER "npc despawn"
          - disengage

      proximity trigger:
        exit:
          script:
          - ^zap "script:guard1_script" 1
          
      click trigger:
        script:
        # This is simply to present the options again if the player accidently clicks the NPC rather than type a response.
        - run "guard1 Quest Requirement"
        
"guard1 Quest Requirement":
  type: task
  script:
  - if "<player.flag[guard1]>" == "hired" chat "Hey Boss. I'm here for another <red><flag.p:guard1.expiration>"
    else if <player.money> < "<cons:guard1cost>" chat "Not a big earner are you?"
    else runtask "guard1 Present Quest"
    
"guard1 Present Quest":
  type: task
  script:
  - chat "Hey, you look like you could use a hand.  I'll help you for <cons:guard1cost> gold."
  - narrate "<red>Yes <white>or <blue>No"
  - zap "guard1_script" 2
 
 
 




Comments
2014-01-13 06:52:40 - Adrain:

Nice quest but have a bug :(