ON INIT {
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 13
 INVENTORY ADD "PROVISIONS\\BOTTLE_WINE\\BOTTLE_WINE"
 SET £helping_buddy "HUMAN_BASE_0047"
 SET £flee_marker "FLEE_MARKER_0005"
 SET £type "human_guard_kingdom"
 SET £key_carried "KEY_BASE_0023KEY_BASE2_0001"
 SET £friend "kingdom"
 SET £voice "_vb"
 SET §inshop 1  // Check if guard is in shop =0 out of shop
 SET_GROUP ANTI_THIEF
 ACCEPT
}
ON INITEND {
 SENDEVENT -ir DURABILITY 100 "86"
 TWEAK SKIN "npc_human_chainmail_hero_head" "npc_human_chainmail_guard_head2"
 BEHAVIOR WANDER_AROUND 300
 SETTARGET NONE
 ACCEPT
}
ON RELOAD {
  IF (#PLAYER_ON_QUEST == 4) {
    TELEPORT MARKER_0031
    BEHAVIOR NONE
    SETTARGET NONE
    SET §inshop 0
    SENDEVENT CUSTOM LIGHT_DOOR_0103 "LOCK"
    SENDEVENT CLOSE LIGHT_DOOR_0103 ""
    TIMERpatrol 1 10 GOTO PATROL1_1
    ACCEPT
  }
  IF (#PLAYER_ON_QUEST > 6) {
    TIMERpatrol OFF
    TELEPORT MARKER_0524
    SET §inshop 1
    SENDEVENT CUSTOM LIGHT_DOOR_0103 "UNLOCK"
    SENDEVENT CLOSE LIGHT_DOOR_0103 ""
    BEHAVIOR WANDER_AROUND 300
    SETTARGET NONE
    ACCEPT
  } 
  IF (#player_knows_password == 0) {
   TELEPORT MARKER_0524
    BEHAVIOR WANDER_AROUND 300
    SETTARGET NONE
   ACCEPT
  }
  IF (#player_knows_password == 1) {
    TELEPORT MARKER_0031
    BEHAVIOR NONE
    SETTARGET NONE
    SET §inshop 0
    SENDEVENT CUSTOM LIGHT_DOOR_0103 "LOCK" 
    SENDEVENT CLOSE LIGHT_DOOR_0103 ""
    TIMERpatrol 1 10 GOTO PATROL1_1
    ACCEPT
  }
  IF (#player_knows_password == 2) {
    TIMERpatrol OFF
    TELEPORT MARKER_0524
    SET §inshop 1
    SENDEVENT CUSTOM LIGHT_DOOR_0103 "UNLOCK"
    SENDEVENT CLOSE LIGHT_DOOR_0103 ""
    BEHAVIOR WANDER_AROUND 300
    SETTARGET NONE
    ACCEPT
  }
 ACCEPT
}
ON PLAYER_IN_SHOP {
 IF (§player_in_sight == 0) ACCEPT
 SPEAK -a ~£thief~ NOP
 SENDEVENT ATTACK_PLAYER SELF ""
 ACCEPT
}
ON REACHEDTARGET {
  IF (^TARGET == MARKER_0470) {
    RANDOM 50 {
      BEHAVIOR MOVE_TO
      SETTARGET MARKER_0525
    }
   BEHAVIOR NONE
   SETTARGET NONE
   TIMERpatrol01 1 20 GOTO NEXT_STEP
   ACCEPT
  }
  IF (^TARGET == MARKER_0031) {
    BEHAVIOR NONE
    SETTARGET NONE
    TIMERpatrol02 1 50 NEXT_STEP01
    ACCEPT
  }
  IF (^TARGET == MARKER_0525) {
    BEHAVIOR NONE
    SETTARGET NONE
    TIMERpatrol03 1 5 NEXT_STEP02
    ACCEPT
  }
 ACCEPT
}
>>NEXT_STEP
  IF (§main_behavior_stacked != 0) {
    TIMERpatrol01 1 2 GOTO NEXT_STEP
  }
  ELSE {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0031
  }
 ACCEPT
>>NEXT_STEP01
  IF (§main_behavior_stacked != 0) {
    TIMERpatrol02 1 2 GOTO NEXT_STEP01
  }
  ELSE {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0470
  }
 ACCEPT
>>NEXT_STEP02
  IF (§main_behavior_stacked != 0) {
    TIMERpatrol03 1 2 GOTO NEXT_STEP02
  }
  ELSE {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0031
  }
 ACCEPT
>>PATROL1_1
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0470
 ACCEPT