// Alicia
ON INIT {
 INVENTORY ADD "JEWELRY\\GOLD_RING\\GOLD_RING"
 INVENTORY ADD "JEWELRY\\BRACELET\\BRACELET"
 INVENTORY ADD "JEWELRY\\NECKLACE\\NECKLACE"
 INVENTORY ADD_FROM_SCENE "KEY_BASE_0032"
 SET £key_carried "KEY_BASE_0032"
 SET £type "human_female_base"
 SET £friend "kingdom"
 ACCEPT
}

ON INITEND {
 LOADANIM ACTION2 "human_normal_lay_in"
 LOADANIM ACTION3 "human_normal_lay_cycle"
 LOADANIM ACTION4 "human_normal_lay_out"
 TWEAK LOWER "human_female_villager"
 TWEAK HEAD "human_female_villager_head2"
 TWEAK SKIN "npc_human_villager_female_tizzy" "npc_human_villager_female_alicia"
 GOTO DECISION
 ACCEPT
}

ON LOAD {
 USE_MESH "HUMAN_FEMALE_BASE\HUMAN_FEMALE_BASE.TEO"
 ACCEPT
}

ON DETECTPLAYER {
  IF (^PLAYER_ZONE == "ALICIA_SECRET_ROOM") {
    SPEAK -a ~£thief~ NOP
    SENDEVENT PLAYER_ENEMY SELF ""    
    ACCEPT
  }
 ACCEPT
}

ON CHAT {
  IF (^SPEAKING == 1) ACCEPT
  IF (§chatpos == 0) GOTO DIALOGUE1_1
  IF (§chatpos == 1) {
    GOSUB START_CHAT
    SPEAK [alicia_love_gary_misc] GOSUB END_CHAT
    ACCEPT
  }
  IF (§chatpos == 2) {
    GOSUB START_CHAT
    SPEAK [alicia_bank_craked] GOSUB END_CHAT
    ACCEPT
  }
 ACCEPT
}

ON REACHEDTARGET {
  IF (^TARGET == MARKER_0717) {
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0022
    ACCEPT
  }
  IF (^TARGET == MARKER_0026) {
    BEHAVIOR WANDER_AROUND 400
    SETTARGET NONE
    ACCEPT
  }
  IF (^TARGET == MARKER_0036) {
    BEHAVIOR WANDER_AROUND 200
    SETTARGET NONE
    ACCEPT
  }
  IF (^TARGET == MARKER_0022) {
    SENDEVENT CUSTOM LIGHT_DOOR_0023 "UNLOCK"
    BEHAVIOR WANDER_AROUND 200
    SETTARGET NONE
    ACCEPT
  }
 ACCEPT
}

//#behavior

// ---------------------------------------------------------------------------------
// BEHAVIOR INCLUDE START ----------------------------------------------------------
// ---------------------------------------------------------------------------------
>>CLEAR_MICE_TARGET
 // if we care about mice : clear current mice target and listen to other mice
 IF ( §care_about_mice == 1 )
 {
  SET £targeted_mice "NOMOUSE"
  SETGROUP MICECARE // listen to other mice
 }
RETURN

>>SAVE_BEHAVIOR
 TIMERcolplayer OFF 
// to avoid TIMERcolplayer to restore the behavior 1 sec later
 IF (§main_behavior_stacked == 0) 
 {
  IF (§frozen == 1)
  { 
// frozen anim -> wake up !
    SET §frozen 0
    PLAYANIM NONE
    PLAYANIM -2 NONE
    PHYSICAL ON
    COLLISION ON
    BEHAVIOR FRIENDLY
    SETTARGET PLAYER
  }
  SET §main_behavior_stacked 1
  HEROSAY -d "STACK"
  BEHAVIOR STACK
 }
 ELSE
 { // behavior already saved : clear mice target if one
  GOSUB CLEAR_MICE_TARGET
 }
RETURN

>>RESTORE_BEHAVIOR
 IF (§main_behavior_stacked == 1) 
 {
  GOSUB CLEAR_MICE_TARGET
  HEROSAY -d "UNSTACK"
  BEHAVIOR UNSTACK
  SET §main_behavior_stacked 0
  RETURN
 }
IF (£init_marker != "NONE")
  { 
   BEHAVIOR MOVE_TO
   SETTARGET -a ~£init_marker~
   SETMOVEMODE WALK
   RETURN
  }
HEROSAY -d "go_home"
BEHAVIOR GO_HOME
SETTARGET PLAYER
RETURN

// ---------------------------------------------------------------------------------
// BEHAVIOR INCLUDE END ------------------------------------------------------------
// ---------------------------------------------------------------------------------

//#
//#LocalChat
// ---------------------------------------------------------------------------------
// LocalChat INCLUDE START ---------------------------------------------------------
// ---------------------------------------------------------------------------------
>>START_CHAT
 // save misc reflection mode
 SET §saved_reflection §reflection_mode
 // no more stupid reflections !
 SET §reflection_mode 0
 // fo not change behavior if frozen
 IF ( §frozen == 1 ) RETURN
 // save behavior (if not saved)
 GOSUB SAVE_BEHAVIOR
 // look at player
 BEHAVIOR FRIENDLY
 SETTARGET PLAYER
RETURN

>>END_CHAT
 SET_EVENT COLLIDE_NPC ON
 SET §collided_player 0
 // restor behavior only if not in fighting mode
 IF ( §fighting_mode == 0 )
 {
  // restore misc reflection mode
  SET §reflection_mode §saved_reflection
  // if frozen : don't restore behavior
  IF ( §frozen == 1 ) RETURN
  // restore behavior
  GOSUB RESTORE_BEHAVIOR
 }
RETURN
// ---------------------------------------------------------------------------------
// LocalChat INCLUDE END -----------------------------------------------------------
// ---------------------------------------------------------------------------------

//#

>>DECISION
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0026
 ACCEPT

>>DIALOGUE1_1
 GOSUB START_CHAT
 SET_PLAYER_CONTROLS OFF
 PLAYER_INTERFACE -s HIDE
 CINEMASCOPE -s ON
 GOTO DIALOGUE1_2
 ACCEPT

>>DIALOGUE1_2
 SETNAME [description_alicia]
 SPEAK -c CCCLISTENER_R PLAYER 40 40 [alicia_gary_partner] GOTO DIALOGUE1_3
 ACCEPT

>>DIALOGUE1_3
 SPEAK -pc KEEP [player_sounds_good] GOTO DIALOGUE1_4
 ACCEPT

>>DIALOGUE1_4
 SPEAK -c CCCLISTENER_R PLAYER 40 40 [alicia_why_work] GOTO DIALOGUE1_5
 ACCEPT

>>DIALOGUE1_5
 SET §chatpos 1
 PLAYER_INTERFACE -s SHOW
 CINEMASCOPE -s OFF
 SET_PLAYER_CONTROLS ON
 GOSUB END_CHAT
 ACCEPT

ON RELOAD {
  IF (#bank_stollen == 1) SET §chatpos 2
  IF (#PLAYER_ON_QUEST < 2) {
	TWEAK LOWER "human_female_villager"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_blue2"
	TELEPORT -i
    GOTO DECISION
    ACCEPT
  }  
  IF (#PLAYER_ON_QUEST == 2) {
    TWEAK LOWER "human_female_villager"
	TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_red2"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_female_white_red2" "npc_human_female_white_red"
	TELEPORT MARKER_0040
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0717
    ACCEPT
  }  
  IF (#PLAYER_ON_QUEST == 3) {
    TWEAK LOWER "human_female_villager"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_blue"
    SET §sleeping 0
    SET §frozen 0
    PLAYANIM NONE
    TELEPORT MARKER_0026
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0036
    ACCEPT
  }
  IF (#PLAYER_ON_QUEST == 4) {
    TWEAK LOWER "human_female_villager"
	TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_red2"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_female_white_red2" "npc_human_female_white_red"
	TELEPORT MARKER_0040
    BEHAVIOR MOVE_TO 
    SETTARGET MARKER_0026
    ACCEPT
  }
  IF (#PLAYER_ON_QUEST == 5) {
    TWEAK LOWER "human_female_villager"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_blue"
	TELEPORT MARKER_0040
    BEHAVIOR MOVE_TO 
    SETTARGET MARKER_0026
    ACCEPT
  }
  IF (#PLAYER_ON_QUEST == 6) {
    TWEAK LOWER "human_female_villager"
	TWEAK SKIN "npc_human_villager_female_body" "npc_human_female_white_red2"
	IF (#bank_stollen == 1) TWEAK SKIN "npc_human_female_white_red2" "npc_human_female_white_red"
	TELEPORT MARKER_0022
    PLAYANIM NONE
    BEHAVIOR NONE
    SETTARGET NONE
    SET §reflection_mode 0
    SET §frozen 0
    ACCEPT
  }
  IF (#PLAYER_ON_QUEST == 7) {
	SET §reflection_mode 1
    SENDEVENT CUSTOM LIGHT_DOOR_0023 "LOCK"
    TELEPORT MARKER_0040
    BEHAVIOR MOVE_TO
    SETTARGET MARKER_0026
    ACCEPT
  }
 ACCEPT
}