ON INIT {
  SET £dying_marker MARKER_0188
  SET §refuse 0
  SET £type "human_guard_ss" 
  LOADANIM ACTION3 "Goblin_normal_actionlever"
  ACCEPT
}
ON GAME_READY {
 IF (#krahoz_free == 1) SET §enemy 0
ACCEPT
}

ON INITEND {
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 21
 SENDEVENT -ir DURABILITY_ARMOR 100 "74"
 SENDEVENT -ir DURABILITY 100 "53"
 SET £flee_marker "FLEE_MARKER_0023"
 SET £helping_buddy "Human_base_0086"
 SET £init_marker "MARKER_0198"
 IF ( £friend != "NONE" ) SETGROUP -r £friend
 SET £friend "NONE"
 SET §seen 0
 SET §enemy 1
 SET £key_carried "portcullis"
 ACCEPT
}

//ON RELOAD {
// SET §seen 0
// ACCEPT
//}
ON CUSTOM {
 IF (^$PARAM1 == "LEVER") {
  SET §seen 1
  SENDEVENT ATTACK_PLAYER SELF ""
  ACCEPT
 }
 IF (^$PARAM1 == "HEAR") {
  IF (§fighting_mode != 0) ACCEPT
  IF (^DIST_PRESSUREPAD_GOB_0022 > 800) ACCEPT
  SENDEVENT CUSTOM PRESSUREPAD_GOB_0022 "SEND_ME_HEAR"
  ACCEPT 
 }
 ACCEPT
}

ON REACHEDTARGET {
  IF (^TARGET == MARKER_0200) {
    TIMERtest1 1 5 SETTARGET -a MARKER_0198
    ACCEPT
  }
  IF (^TARGET == MARKER_0198) {
    TIMERtest 1 5 SETTARGET -a MARKER_0200
    ACCEPT
  }
 IF (^TARGET == LEVER_0028) {
  PLAYANIM -e ACTION3 SENDEVENT ATTACK_PLAYER SELF ""
  SENDEVENT ACTION LEVER_0028 ""
  TIMERrefuse 1 1 SET §refuse 0
  SET §seen 1
  ACCEPT
 }
 ACCEPT
}

ON KRAHOZ_FREE {
 SET §enemy 0
 TELEPORT MARKER_0905
 BEHAVIOR FRIENDLY
 SETTARGET LEVER_0028
ACCEPT
}

ON START_GUARD {
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0200
 ACCEPT
}

ON DETECTPLAYER {
 IF (#KRAHOZ_FREE == 1) ACCEPT 
  IF (#DISSIDENT == 3){
  IF (§seen == 1) ACCEPT
  SET §enemy 0
  REFUSE
 } 
  IF (#DISSIDENT < 3){
  IF (§seen == 1) ACCEPT 
  SET §enemy 0
  BEHAVIOR MOVE_TO
  SETTARGET LEVER_0028
  SETMOVEMODE RUN
  SET §refuse 1
  REFUSE
 }
 ACCEPT
}
ON COLLIDE_NPC {
 IF (§refuse == 1) REFUSE
 ACCEPT
}
ON OUCH {
 IF (§refuse == 1) REFUSE
 ACCEPT
}
ON AGRESSION {
 IF (§refuse == 1) REFUSE
 ACCEPT
}
ON CHAT {
 IF (§refuse == 1) REFUSE
 IF (#DISSIDENT == 3) {
  SPEAK -p [player_misc_hi_there] nop
  REFUSE
 }
 ACCEPT
}