// Erzog in Jail
ON INIT {
 SET £type "human_guard_kingdom"
 SET £friend "NONE" 
 ACCEPT
}

ON INITEND {
 SETNAME [description_erzog]
 SET_NPC_STAT life 1
 SET §reflection_mode 0
 TWEAK HEAD "human_kultar"
 TWEAK SKIN "npc_human_base_kultar_head" "npc_human_base_erzog_head"
 LOADANIM ACTION1 "human_erzog_begging_wait"
 LOADANIM ACTION2 "human_erzog_begging_talk"
 SETWEAPON NONE
 BEHAVIOR NONE
 SETTARGET NONE
 PLAYANIM NONE
 IF (#debug == 1) ACCEPT
 OBJECT_HIDE SELF ON
 ACCEPT
}

ON RELOAD {
 IF (#statue_touched == 1) DESTROY SELF
 ACCEPT
}

ON GAME_READY {
 IF (#statue_touched == 1) DESTROY SELF
 ACCEPT
}

ON CONTROLLEDZONE_ENTER {
 IF (^$PARAM1 != PLAYER) ACCEPT
 SET §frozen 1
 PLAYANIM -l ACTION1
>>WIMP
 SPEAK [erzog_wimp_misc] TIMERwimp 0 15 GOTO WIMP
 ACCEPT
}

ON CHAT {
  IF (^SPEAKING == 1) ACCEPT
  IF (§chatpos == 0) GOTO DIALOGUE1_1
  IF (§chatpos == 1) {
   SPEAK [erzog_forgive_misc] NOP
   REFUSE
  }
 REFUSE
}

ON DIE {
 GOTO SLAP_CINEMATIC
 ACCEPT
} 

ON CHANGESTATUS {
  IF (^$PARAM1 == "GOTOJAIL") {
    OBJECT_HIDE SELF OFF
    SENDEVENT CUSTOM LIGHT_DOOR_0025 "LOCK"
    SET_CONTROLLED_ZONE "ERZOG_CELL"
    ACCEPT
  }
  IF (^$PARAM1 == "5") {
    SENDEVENT CUSTOM LIGHT_DOOR_0025 "UNCHAT"
    DESTROY ME
    HERO_SAY -d "human_base_0062 destroyed"
    ACCEPT
  }
 ACCEPT
}

>>DIALOGUE1_1
 SET #SHUT_UP 1
 TIMERwimp OFF
 TELEPORT -p MARKER_0399
 UNSET_CONTROLLED_ZONE "ERZOG_CELL"
>>SLAP_CINEMATIC
 SENDEVENT CHANGESTATUS HUMAN_BASE_0082 "4"
 TIMERlookat -m 1 10 PLAYERLOOKAT SELF
 SET_PLAYER_CONTROLS OFF
 CINEMASCOPE -s ON
 PLAYER_INTERFACE -s HIDE
 SPEAK -pc CCCLISTENER_L SELF 50 50 [player_accuse_erzog] GOTO DIALOGUE1_2
 REFUSE

>>DIALOGUE1_2
 SPEAK -co CCCLISTENER_R PLAYER 50 110 [erzog_not_high_priest] GOTO DIALOGUE1_3
 REFUSE

>>DIALOGUE1_3
 SPEAK -pc CCCLISTENER_L SELF 50 50 [player_tell_more] GOTO DIALOGUE1_4
 REFUSE

>>DIALOGUE1_4
 SPEAK -co CCCLISTENER_R PLAYER 100 100 [erzog_was_contacted] GOTO DIALOGUE1_5
 REFUSE

>>DIALOGUE1_5
 PLAYANIM WAIT
 SET §frozen 0
 SENDEVENT CINEMATIC CAMERA_0133 ""
 SPEAK -p [player_good_reason] GOTO DIALOGUE1_6
 REFUSE

>>DIALOGUE1_6
 SENDEVENT CINEMATIC CAMERA_0133 ""
 SPEAK -o [erzog_give_password] GOTO DIALOGUE1_7
 REFUSE

>>DIALOGUE1_7
 SENDEVENT CUSTOM CAMERA_0133 "OFF"
 SET #player_knows_password 1
 SET §chatpos 1
 CINEMASCOPE -s OFF
 PLAYER_INTERFACE -s SHOW
 PLAYER_LOOKAT "HUMAN_BASE_0062"
 SET_PLAYER_CONTROLS ON
 QUEST [system_Quest_log_know_password]
 PLAY "system"
 HEROSAY [system_questbook_updated]
 MAPMARKER 500 50 1 [addmarker_secret_temple]
 HEROSAY [system_map_updated]
 ADD_XP 2500
 BEHAVIOR WANDER_AROUND 200
 SETTARGET NONE
 SET #SHUT_UP 0
 REFUSE