ON INIT {
 SET £helping_buddy "HUMAN_BASE_0050"
 SET £flee_marker "FLEE_MARKER_0009"
 SET_GROUP ANTI_THIEF
 SET £type "human_guard_kingdom"
 SET £friend "kingdom"
 SET £voice "_vc"
 SET §reflection_mode 0
 SET §message_received 0
 ACCEPT
}

ON INITEND {
 TWEAK SKIN "npc_human_chainmail_hero_head" "npc_human_chainmail_guard_head2"
 BEHAVIOR FRIENDLY
 SETTARGET PLAYER
 SENDEVENT -ir DURABILITY 100 "85"
 ACCEPT
}

ON REACHEDTARGET {
  IF (^TARGET == MARKER_0053) {
    BEHAVIOR NONE
    SETTARGET NONE
    TIMERpatrol01 1 2 GOTO NEXT_STEP
    ACCEPT
  }
  IF (^TARGET == MARKER_0139) {
    BEHAVIOR FRIENDLY
    SETTARGET PLAYER
    TIMERtalk -m 1 500 GOTO TALK
    ACCEPT
  }
  IF (^TARGET == MARKER_0051) {
    BEHAVIOR NONE
    SETTARGET NONE
    TIMERpatrol02 1 2 GOTO NEXT_STEP01
    ACCEPT
  }
 ACCEPT
}

>>TALK
 SET §message_received 1    
 SPEAK -o [Human_guard_1st_time_special_entrance] GOTO PATROL
 ACCEPT

ON PLAYER_IN_SHOP {
 IF (§player_in_sight == 0) ACCEPT
 SPEAK -a ~£thief~ NOP
 SENDEVENT ATTACK_PLAYER SELF ""
 ACCEPT
}

>>NEXT_STEP
  IF (§main_behavior_stacked != 0) {
    TIMERpatrol01 1 2 GOTO NEXT_STEP
  }
  ELSE {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0051
  }
 ACCEPT

>>NEXT_STEP01
  IF (§main_behavior_stacked != 0) {
    TIMERpatrol02 1 2 GOTO NEXT_STEP01
  }
  ELSE {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0053
  }
 ACCEPT

ON CUSTOM {
  IF (§message_received == 1) ACCEPT
  IF (^$PARAM1 == "TALK") {
    IF (#PLAYER_ON_QUEST > 2) GOTO PATROL_DEMO
    SET §second 1
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0139
    SET_PLAYER_CONTROLS OFF
    PLAYER_LOOKAT MARKER_0054
    CINEMASCOPE -s ON
    PLAYER_INTERFACE -s HIDE
    ACCEPT
  }
 ACCEPT
}

>>PATROL
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 PLAYER_INTERFACE -s SHOW
 SET §reflection_mode 1
>>PATROL_DEMO
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0053
 ACCEPT

ON RELOAD {
 IF (§enemy == 1) ACCEPT
 IF (#PLAYER_ON_QUEST == 6) ACCEPT
 IF (§second == 1) {
  TIMERpatrol01 OFF
  TIMERpatrol02 OFF
  TELEPORT -i
  BEHAVIOR MOVE_TO
  SETTARGET MARKER_0053
  ACCEPT
 }
 ACCEPT
}