ON INIT {
 SET §reload 0
 SET £dying_marker MARKER_0727
 INVENTORY ADDFROMSCENE "KEY_BASE_0049"
 SET £type "human_guard_ss"
 SET £friend "NONE"
 SET §enemy 1 
 SET §seen 0
 ACCEPT
} 

ON CUSTOM {
 IF (^$PARAM1 == "HEAR") {
  IF (§fighting_mode != 0) ACCEPT
  IF (^DIST_PRESSUREPAD_GOB_0024 > 600) ACCEPT
  SENDEVENT CUSTOM PRESSUREPAD_GOB_0024 "SEND_ME_HEAR"
  ACCEPT 
 }
 ACCEPT
}

ON INITEND {
  SENDEVENT -ir DURABILITY 100 "57"
  SET £flee_marker "FLEE_MARKER_0024"
  SET £helping_buddy "Human_base_0051"
  IF ( £friend != "NONE" ) SETGROUP -r £friend
  SET £friend "NONE"
  SET £key_carried "portcullis"
  SET £init_marker MARKER_0194
 ACCEPT
 }

ON GAME_READY {
 IF (#krahoz_free == 1) SET §enemy 0
 ACCEPT
}

ON RELOAD {
 SET §seen 0
 ACCEPT
}

ON REACHEDTARGET {
  IF (^TARGET == MARKER_0833) {
   BEHAVIOR FRIENDLY
   SETTARGET PRESSUREPAD_GOB_0024
   TIMERgo1 1 5 GOTO NEXT1
   ACCEPT
  }  
  IF (^TARGET == MARKER_0196) {
    TIMERgo1 1 5 GOTO NEXT2
    ACCEPT
  }
  IF (^TARGET == MARKER_0194) {
    TIMERgo2 1 5 GOTO NEXT3
    ACCEPT
  }
 ACCEPT
}

ON KRAHOZ_FREE {
 SET §reload 1
 SET §enemy 0
 TELEPORT MARKER_0904 
 BEHAVIOR FRIENDLY
 SETTARGET PLAYER
ACCEPT
}

ON START_GUARD {
 IF (§reload == 1) ACCEPT
 BEHAVIOR MOVE_TO
 SETTARGET -a MARKER_0833
// SETTARGET -a MARKER_0196
 ACCEPT
}

ON DETECTPLAYER {
 IF (#KRAHOZ_FREE == 1) ACCEPT
  IF (#DISSIDENT == 3){
  IF (§seen == 1) ACCEPT 
  SET §enemy 0
  REFUSE
 } 
  IF (#DISSIDENT < 3){ 
  SET §enemy 1
  SET §seen 1
  REFUSE
 }
 ACCEPT
}

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

>>NEXT1
IF (§fighting_mode != 0) ACCEPT
IF ( §main_behavior_stacked != 0 ) {
 BEHAVIOR NONE
 SETTARGET NONE
 TIMERtc 1 2 GOTO NEXT1
 ACCEPT
}
BEHAVIOR Move_to 
SETTARGET -a MARKER_0196
ACCEPT

>>NEXT2
IF (§fighting_mode != 0) ACCEPT
IF ( §main_behavior_stacked != 0 ) {
 BEHAVIOR NONE
 SETTARGET NONE
 TIMERtc 1 2 GOTO NEXT1
 ACCEPT
}
BEHAVIOR Move_to 
SETTARGET -a MARKER_0194
ACCEPT

>>NEXT3
IF (§fighting_mode != 0) ACCEPT
IF ( §main_behavior_stacked != 0 ) {
 BEHAVIOR NONE
 SETTARGET NONE
 TIMERtc 1 2 GOTO NEXT1
 ACCEPT
}
BEHAVIOR Move_to 
SETTARGET -a MARKER_0196
ACCEPT