ON INIT {
 SET £type "human_guard_ss"
 SET £key_carried "key_base_0033key_base_0078"
 SET §forbidden 0
 IF (§dead == 2) {
  BEHAVIOR FRIENDLY
  SETTARGET MARKER_0729
  SET §enemy 1
  ACCEPT
 }
 SET §dead 0
 ACCEPT
}

ON INITEND {
 INVENTORY ADD "PROVISIONS\\TORCH\\TORCH"
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 12
 SENDEVENT -ir DURABILITY 100 "54"
 SET £flee_marker "FLEE_MARKER_0031"
 SET £helping_buddy "Human_base_0086"
 SET £init_marker "Marker_0727"
 ACCEPT
}

ON ALARM {
 SPEAK -a ~£heardnoise~ NOP
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0727
 SET_MOVE_MODE RUN
ACCEPT
}

ON REACHEDTARGET {
 IF (^target == MARKER_0724) {
  BEHAVIOR FRIENDLY
  SETTARGET LIGHT_DOOR_0015
  ACCEPT
 }
 IF (^target == MARKER_0727) {
  BEHAVIOR FRIENDLY
  SETTARGET MARKER_0192
  TIMERback 1 5 GOTO TODUTY
  ACCEPT
 }
 IF (^target == MARKER_0813) {
  SET §watching 1
  HEROSAY -d "108 IS WATCHING THRU THE DOOR"
  BEHAVIOR FRIENDLY
  SETTARGET LIGHT_DOOR_0005
  SENDEVENT WATCHTHRU LIGHT_DOOR_0005 "YES"
  TIMERguard1 1 4 GOTO GUARD1
  ACCEPT
 }
 IF (^target == MARKER_0336) {
  BEHAVIOR FRIENDLY
  SETTARGET MARKER_0815
  TIMERguard2 1 20 GOTO GUARD2
  ACCEPT
 }
 IF (^target == MARKER_0816) {
  BEHAVIOR FRIENDLY
  SETTARGET CANDEL_0003
  ACCEPT
 }

ACCEPT
}

>>TODUTY
 BEHAVIOR MOVE_TO
 SET_MOVE_MODE WALK
 SETTARGET -a MARKER_0724
 ACCEPT

ON RELOAD {
 IF (§dead == 1) {
  SET §dead 2 
  TELEPORT MARKER_0728
  REVIVE
 }
 ACCEPT
}

ON DIE {
 IF (§dead == 0) SET §dead 1
 ACCEPT
}

ON CHAT {
 IF (§watching == 1) REFUSE
 IF (#DISSIDENT == 3) {
  SPEAK -p [player_misc_hi_there] nop
  REFUSE
 }
 ACCEPT
}

ON PREREDSET {
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0816
 ACCEPT
}

ON REDSET1 {
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0813
 ACCEPT
}

ON REDSET2 {
 BEHAVIOR MOVE_TO
 SETTARGET -a Marker_0336
 ACCEPT
}

>>GUARD1
 HEROSAY -d "108 is guarding in front of the door"
 SET §watching 0
 SENDEVENT WATCHTHRU LIGHT_DOOR_0005 "NO"
 BEHAVIOR FRIENDLY
 SETTARGET MARKER_0814
 ACCEPT

>>GUARD2
 IF ( §main_behavior_stacked != 0 ) {
  BEHAVIOR NONE
  SETTARGET NONE
  TIMERoff2 1 3 GOTO GUARD2
  ACCEPT
 }
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0727
 ACCEPT

ON ALLOWED {
 IF (^$PARAM1 == "YES") SET §enemy 0
 IF (^$PARAM1 == "NO") SET §enemy 1
 ACCEPT
}

ON GAME_READY {
 IF (§enemy == 1) ACCEPT
 IF (^TARGET == MARKER_0336) {
  BEHAVIOR MOVE_TO
  SETTARGET -a Marker_0336
  ACCEPT
 }
 ACCEPT
}