ON KEY_PRESSED {
 IF (§cine == 1) {
  SET §cine 2
  SENDEVENT STOP CAMERA_0105 ""
  SENDEVENT CUSTOM CAMERA_0078 "END"
  TIMERgo OFF
  TIMERspeak OFF
  TIMERcamera OFF
  TIMERmove OFF
  SPEAK KILLALL
  PLAYANIM -p NONE
  PLAYANIM -p WAIT
  TELEPORT -p MARKER_0587
  TELEPORT MARKER_0203
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  PLAYERLOOKAT ME
  GOTO DIALOGUE_TRUE13
  ACCEPT
 }
 ACCEPT
}
ON INIT {
  SET §cine 0
  SET §shield 0
  INVENTORY ADD_FROM_SCENE "dissident_key_0001"
  INVENTORY ADD "Quest_item\\dissident_key\\dissident_key"
  INVENTORY ADD_FROM_SCENE "key_base_0014"
  LOADANIM ACTION5 "human_normal_alia_balcony"
  LOADANIM ACTION6 "human_normal_alia_wait_balcony"
  LOADANIM ACTION7 "human_normal_alia_sign"
  LOADANIM ACTION8 "human_alia_bed_tease"
  LOADANIM ACTION9 "human_alia_bed_tease_cycle"
  LOADANIM ACTION2 "human_alia_bed_out2"
  LOADANIM ACTION4 "human_alia_bed_sit_cycle"
  SET £type "human_guard_ss"
  SET §nightmare 0
  SET §chatpos 0
  SET §know 0
  SET §return 0
  SET §krahoz_given 0
  SET §zohark_given 0 
  SET §status1 0 //S'UTILISE POUR LANCER REMERCIEMENT AU PLAYER DE RAPPORTER KRAHOZ VOLEE
  SET §status2 0 //S'UTILISE POUR AUTORISER UN IN_BED_WITH_ALIA
  SET §status3 0 //S'UTILISE POUR ALIA REFUSE LE SHIELD
  SET §status4 0 // POUR pousser le garde
  SET §know_queen_quest 0
  SET §know_about_shield 0
  SET §slept 0
  SET §test 0
  SET §nocombine 0
  ACCEPT
 }
ON INITEND {
 INVENTORY ADD "JEWELRY\\GOLD_RING\\GOLD_RING"
 INVENTORY ADDMULTI "JEWELRY\\GOLD_COIN\\GOLD_COIN" 67
 SENDEVENT -ir DURABILITY_ARMOR 100 "87"
 SENDEVENT -ir DURABILITY 100 "57"
 SET £flee_marker "FLEE_MARKER_0030"
 SET £helping_buddy "Human_base_0086"
 SETNAME [description_alia]
 LOADANIM WALK        "human_woman_normal_walk"
 LOADANIM RUN         "human_woman_normal_run"
 LOADANIM HIT         "human_fight_receive_damage"
 LOADANIM DIE         "human_woman_death"
 SET £hail []
 SET £thief [human_female_thief]
 SET £strike [female_striking]
 SET £victory []
 SET £whogoesthere []
 SET £heardnoise []
 SET £back2guard []
 SET £threat []
 SET £search []
 SET £youmad []
 SET £dying [human_female_dying]
 SET £ouch [female_ouch]
 SET £ouch_medium [female_ouch_medium]
 SET £ouch_strong [female_ouch_strong]
 SET £help [human_female_help]
 SET £comeback []
 SET £justyouwait []
 TWEAK lower "human_female_plate"
 TWEAK SKIN "npc_human_villager_female_body" "npc_human_villager_female_body2"
 LOADANIM WAIT "Human_normal_wait_short" 
 SET £misc [Alia_misc]
 SET_XP_VALUE 200
 ACCEPT
}
ON LOAD {
 USEMESH "human_female_base\human_female_base.teo"
 ACCEPT
}
ON RELOAD {
 IF (§shield == 1) {
  IF (#DISSIDENT_ENEMY == 1) GOTO SUITE
  SET §shield 2
  SENDEVENT SHIELD_ADD CHEST_METAL_0003 ""
 }
>>SUITE
 IF (#DISSIDENT_ENEMY == 1) SET §enemy 1
 IF (#weapon_enchanted == 1) {
  //SET #alia_dead 1
  DESTROY SELF
  REFUSE
 }
 IF (§enemy == 1) {
  IF (#weapon_enchanted == 2) OBJECT_HIDE -m SELF YES
  REFUSE
 }
 REFUSE
}

ON GAME_READY {
 IF (#KRAHOZ_FREE == 1) ACCEPT /////POUR LA SAUCISSE SCENARIQUE
 IF (#alia_dead == 1) {
   DESTROY SELF          
   ACCEPT
  } 
 IF (§know_about_shield == 1) ACCEPT
>>SIMULATE_RELOAD
IF (#DEBUG == 1) ACCEPT 
 WORLDFADE OUT 500 0 0 0
 SET #SHUT_UP 1                  
 AMBIANCE -V 90 ambient_rebels_intense
 LOADANIM -p ACTION3 "human_normal_lay_cycle"
 LOADANIM -p WALK "human_normal_walk_guard"
 SENDEVENT CINEMATIC CAMERA_0078 "OPEN_EYES"
 GOTO DIALOGUE_TRUE01
 ACCEPT
}

ON COLLIDE_NPC
{
 REFUSE
}

ON CONTROLLEDZONE_ENTER 
{
IF (§enemy == 1) ACCEPT
IF (§krahoz_given == 1) {
 UNSET_CONTROLLED_ZONE FRONT_DOOR_ALIA
 ACCEPT
 }
 IF (^speaking == 1) ACCEPT
 IF (^$PARAM1 != PLAYER) ACCEPT
 IF (^PLAYERSPELL_INVISIBILITY == 1) ACCEPT
 UNSET_CONTROLLED_ZONE FRONT_DOOR_ALIA
 SET_PLAYER_CONTROLS OFF
 CINEMASCOPE -s ON
 SET #SHUT_UP 1
 PLAYER_INTERFACE -s HIDE
 PLAYER_LOOKAT human_base_0111
 SPEAK [alia_krahoz_stolen] GOTO END_KRAHOZ_STOLEN
 //HEROSAY -d "REMETTRE alia_krahoz_stolen"
 ACCEPT
}

>>END_KRAHOZ_STOLEN
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 SET #SHUT_UP 0
 PLAYER_INTERFACE -s SHOW
 ACCEPT

ON DIE 
{
 SET #alia_dead 1
 ACCEPT
}

ON COMBINE {
 IF ( §nocombine != 0 ) ACCEPT
 IF (^speaking == 1) {
  SPEAK -p [player_not_now] nop
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "shield_elders") 
 {                   //Le player r le shield                                   
  LOADANIM WAIT       "Human_normal_wait_short"
  IF (#statue_destroyed == 1) {
   IF (§status3 >= 1) {
     SET #shield_elder_retrieved 2  //  A UPGRADER (verifier) 
     HEROSAY -d "REND LE BOUCLIER LA STATUE EST DETRUITE, Krahoz et Zohark rendues" 
     SPEAK [alia_player_bring_krahoz] nop
     ACCEPT
   }
   HEROSAY -d "REND LE BOUCLIER LA STATUE EST DETRUITE"
   //SET #shield_elder_retrieved 1
   //GOTO DIALOGUE_SHIELD01
  }
  HEROSAY -d "REND LE BOUCLIER LA STATUE NON DETRUITE"
  SET #shield_elder_retrieved 2
  GOTO DIALOGUE_SHIELD01
 }
 IF (^$PARAM1 ISCLASS "ZOHARK") 
 {                           //Le player rend ZOHARK
  LOADANIM WAIT       "Human_normal_wait_short"
  IF (#statue_destroyed == 1) { 
   PLAYERLOOKAT SELF
   SET_PLAYER_CONTROLS OFF
   CINEMASCOPE -s ON
   SET #SHUT_UP 1
   PLAYER_INTERFACE -s HIDE                           
   IF (§krahoz_given == 1) {
    SET §zohark_given 1
    INVENTORY ADDFROMSCENE "zohark_0002"
    PLAY system      ///////TESTER AVEC>>>>>zohark_0003
    HEROSAY -d "LA STATUE EST DETRUITE KRAHOZ A ETE DONNEE"
    SET §status3 1
    GOTO KRAHOZ_ZOHARK1
   }
   SET §zohark_given 1
   IF (#DEBUG == 0) INVENTORY ADDFROMSCENE "zohark_0002" PLAY system      ///////a virer>>>>>zohark_0003
   IF (#DEBUG == 1) INVENTORY ADDFROMSCENE "zohark_0003" PLAY system
   HEROSAY -d "LA STATUE EST DETRUITE KRAHOZ NON DONNEE"
   GOTO IN_BED_WITH_ALIA  
  }
  HEROSAY -d "LA STATUE NON DETRUITE"
  SPEAK -u [Alia_player_bring_krahoz] nop
  ACCEPT
 }
 IF (^$PARAM1 ISCLASS "KRAHOZ") 
 {                        //Le player rend KRAHOZ
  LOADANIM WAIT       "Human_normal_wait_short"
  //////////////////////////////////STATUE DETRUITE//////////////     
  IF (#statue_destroyed == 1) 
  {
   ///////////////////////////////KRAHOZ VOLEE/////////////////
   IF (#krahoz_stolen == 1) 
   {
    PLAYERLOOKAT SELF
    SET §krahoz_given 1
    SET #krahoz_free 1
    INVENTORY ADDFROMSCENE "Krahoz_0001" 
    SENDEVENT KRAHOZ_FREE HUMAN_BASE_0051 ""
    SENDEVENT KRAHOZ_FREE HUMAN_BASE_0088 ""
    SENDEVENT KRAHOZ_FREE HUMAN_BASE_0089 ""
    SENDEVENT KRAHOZ_FREE HUMAN_BASE_0090 ""
    SET #krahoz_stolen 0
    ///////////////////////////////SHIELD RENDU//////////////////
    IF (#shield_elder_retrieved == 2) 
    {
     //////////////////////////////ZOHARK DONNEE/////////////////
     IF (§Zohark_given == 1) 
     {
      HEROSAY -d "REND KRAHOZ VOLEE SHIELD RENDU ZOHARK DONNEE STATUE DETRUITE"
      SET §krahoz_given 1
      SET §status1 1 
      GOTO KRAHOZ_ZOHARK1
     }
     //////////////////////////////ZOHARK NON DONNEE/////////////////
     HEROSAY -d "REND KRAHOZ VOLEE SHIELD RENDU ZOHARK NON DONNEE STATUE DETRUITE"
     SET §krahoz_given 1
     SET §status2 1 
     GOTO KRAHOZ_BACK_THIEF01
    }
    //////////////////////////////SHIELD NON RENDU/////////////////
    //////////////////////////////ZOHARK DONNEE/////////////////
    IF (§Zohark_given == 1) 
    {
     HEROSAY -d "REND KRAHOZ VOLEE SHIELD NON RENDU ZOHARK DONNEE STATUE DETRUITE"
     SET §krahoz_given 1
     INVENTORY ADDFROMSCENE "Krahoz_0001" 
     SENDEVENT LOCK light_door_0015 ""
     SENDEVENT LOCK light_door_0124 ""
     SET §status4 1
     SET §status3 1
     SET §status1 1 
     GOTO KRAHOZ_ZOHARK1
    }
    //////////////////////////////ZOHARK NON DONNEE/////////////////
    HEROSAY -d "REND KRAHOZ VOLEE SHIELD NON RENDU ZOHARK NON DONNEE STATUE DETRUITE"                                                      
    SET §krahoz_given 1
    SENDEVENT LOCK light_door_0015 ""
    SENDEVENT LOCK light_door_0124 ""
    SET §status2 1 
    GOTO KRAHOZ_BACK_THIEF01
   }
   /////////////////////////////KRAHOZ NON VOLEE////////////////////
   HEROSAY -d "REND KRAHOZ NON VOLEE STATUE DETRUITE (SHIELD RENDU)"
   SET §krahoz_given 1
   IF (§slept == 1) 
   {
    SET §status3 1
    INVENTORY ADDFROMSCENE "Krahoz_0001" 
    GOTO KRAHOZ_ZOHARK1
    //SPEAK [alia_player_bring_krahoz] nop 
    ACCEPT
   }
   PLAYERLOOKAT SELF
   INVENTORY ADDFROMSCENE "Krahoz_0001" 
   GOTO IN_BED_WITH_ALIA
  }
  IF (#krahoz_stolen == 1) 
  {
   HEROSAY -d "REND KRAHOZ VOLEE STATUE NON DETRUITE"
   SET #krahoz_free 1
   SENDEVENT KRAHOZ_FREE HUMAN_BASE_0051 ""
   SENDEVENT KRAHOZ_FREE HUMAN_BASE_0088 ""
   SENDEVENT KRAHOZ_FREE HUMAN_BASE_0089 ""
   SENDEVENT KRAHOZ_FREE HUMAN_BASE_0090 ""
   SET #krahoz_stolen 0
   SET §krahoz_given 1
   SENDEVENT LOCK light_door_0015 ""
   SENDEVENT LOCK light_door_0124 ""
   GOTO KRAHOZ_BACK_THIEF01
  }
  HEROSAY -d "REND KRAHOZ NON VOLEE STATUE NON DETRUITE"
  SET §krahoz_given 1
  GOTO KRAHOZ_BACK01
 }
 LOADANIM WAIT       "Human_alia_wait"
 ACCEPT
}

ON _HAT {
  IF (^speaking == 1) ACCEPT
  IF (#DISSIDENT == 3) {
  SPEAK -p [player_no] nop
  REFUSE
 }
  IF (§chatpos == 2) {
   IF (#krahoz_stolen == 1){
    SET §chatpos 4                   // Dialogue if Krahoz have been stolen 
    GOTO CHATPOS
    ACCEPT
   }
   GOSUB START_CHAT
   IF (#shield_elder_retrieved == 1){
    IF (§know == 0){
     SPEAK [Alia_player_with_shield_01] GOSUB END_CHAT
     SET §know 1
     ACCEPT
    }
    RANDOM 10 
    {
     SPEAK [Alia_player_with_shield_01] GOSUB END_CHAT
     ACCEPT
    }
    SPEAK [Alia_real_introduce_misc] GOSUB END_CHAT
    ACCEPT
   }
   SPEAK [Alia_real_introduce_misc] GOSUB END_CHAT
   ACCEPT
  }
  IF (§chatpos == 3) 
  {
   GOSUB START_CHAT
   SPEAK [Alia_misc] GOSUB END_CHAT
   ACCEPT
  }
  IF (§chatpos == 4) 
  {
   >>CHATPOS
    GOSUB START_CHAT
    SPEAK [alia_krahoz_stolen_misc] GOSUB END_CHAT
    ACCEPT
  }
 ACCEPT
}
 

// Dialogue when player is first in Alia's room
 
>>DIALOGUE_TRUE01
 TIMERgo 1 2 TELEPORT -pa 270 MARKER_0390
 IF (#SHUT_UP == 1) WORLDFADE IN 4000
 SET §know_about_shield 1
 SET_PLAYER_CONTROLS OFF
 PLAYANIM -pl ACTION3                 ///human_normal_lay_cycle
 //SENDEVENT CINEMATIC CAMERA_0078 "OPEN_EYES"
 CINEMASCOPE -s ON
 PLAYERINTERFACE -s HIDE
 set §cine 1
 SET #SHUT_UP 1
 SPEAK -o [Alia_real_introduce_01] GOTO DIALOGUE_TRUE02 //GOTO DIALOGUE_TRUE13 // RACCOURCI LA CINEMATIQUE
ACCEPT

>>DIALOGUE_TRUE02
 IF (§cine == 2) ACCEPT
  TIMERspeak 1 4 GOTO TURN 
  SPEAK -opu [player_alia_real_introduce_01] GOTO DIALOGUE_TRUE03
 ACCEPT

>>TURN
 IF (§cine == 2) ACCEPT
 BEHAVIOR FRIENDLY
 SETTARGET PLAYER
 ACCEPT

>>DIALOGUE_TRUE03
 IF (§cine == 2) ACCEPT
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0149
 TIMERcamera -m 1 2800 SENDEVENT CINEMATIC CAMERA_0062 "HEADHACHE"
 SPEAK -ou [Alia_real_introduce_02] GOTO DIALOGUE_TRUE04
 ACCEPT

>>DIALOGUE_TRUE04
 IF (§cine == 2) ACCEPT
 TIMERmove 1 6 GOTO ALIA_MOVE
 SPEAK -pou [player_alia_real_introduce_02] GOTO DIALOGUE_TRUE05
 ACCEPT

>>ALIA_MOVE
 IF (§cine == 2) ACCEPT
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0203
 ACCEPT

>>DIALOGUE_TRUE05
 IF (§cine == 2) ACCEPT
 SPEAK -ou [Alia_real_introduce_03] GOTO DIALOGUE_TRUE06
 ACCEPT

>>DIALOGUE_TRUE06
 IF (§cine == 2) ACCEPT
 SPEAK -pou [player_alia_real_introduce_03] GOTO DIALOGUE_TRUE07
 ACCEPT

>>DIALOGUE_TRUE07
 IF (§cine == 2) ACCEPT
 SPEAK -ou [Alia_real_introduce_04] GOTO DIALOGUE_TRUE08
 ACCEPT

>>DIALOGUE_TRUE08
 IF (§cine == 2) ACCEPT
 SPEAK -pou [player_alia_real_introduce_04] GOTO DIALOGUE_TRUE09
 ACCEPT

>>DIALOGUE_TRUE09
 IF (§cine == 2) ACCEPT
 CAMERA_ACTIVATE NONE
 SPEAK -cuo ZOOM 0 0 0 0 60 30 [Alia_real_introduce_05] GOTO DIALOGUE_TRUE10A
 ACCEPT

>>DIALOGUE_TRUE10A
 IF (§cine == 2) ACCEPT
 SPEAK -puo [player_alia_real_introduce_05A] GOTO DIALOGUE_TRUE10B
 ACCEPT

>>DIALOGUE_TRUE10B 
 IF (§cine == 2) ACCEPT
 SPEAK -puo [player_alia_real_introduce_05B] GOTO DIALOGUE_TRUE11
 ACCEPT

>>DIALOGUE_TRUE11
 IF (§cine == 2) ACCEPT
 SPEAK -ou [Alia_real_introduce_06] GOTO DIALOGUE_TRUE12
 ACCEPT

>>DIALOGUE_TRUE12
 IF (§cine == 2) ACCEPT
 SPEAK -puo [player_alia_real_introduce_06] GOTO DIALOGUE_TRUE13
 ACCEPT

>>DIALOGUE_TRUE13
 LOADANIM WAIT       "Human_alia_wait"
 CAMERA_ACTIVATE NONE
 AMBIANCE KILL
 QUEST [system_Quest_log_Shield] 
 PLAY system
 HEROSAY [system_questbook_updated]
 //////ADDMARKER [addmarker_elder_shield]
 mapmarker 469 320 6 [addmarker_elder_shield]
 INVENTORY PLAYERADDFROMSCENE "dissident_key_0001" 
 HEROSAY [system_object_received]
 PLAYER_LOOKAT HUMAN_BASE_0111
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 SET #SHUT_UP 0
 PLAYER_INTERFACE -s SHOW
 SET #need_shield 1
 SET §cine 2
 SET §reflection_mode 1 
 SET §chatpos 2
 SET #SHUT_UP 0
 HEROSAY [system_map_updated]
 AMBIANCE -v 90 ambient_rebels_cool
 ACCEPT


>>DIALOGUE_SHIELD01
 SET §shield 1
 PLAYERLOOKAT SELF
 SET #SHUT_UP 1
 SET_PLAYER_CONTROLS OFF
 CINEMASCOPE -s ON
 PLAYER_INTERFACE -s HIDE
 INVENTORY ADDFROMSCENE "shield_elders_0001" PLAY system               /////TESTER AVEC>>>shield_elders_0002
 SPEAK -poc ZOOM 0 0 0 0 40 40 [Player_Alia_back_with_shield_01] GOTO DIALOGUE_SHIELD03
 ACCEPT

>>DIALOGUE_SHIELD03
 //HEROSAY -d "1"
 SPEAK -oc ZOOM 0 0 0 0 60 30 [Alia_player_back_with_shield_02] GOTO DIALOGUE_SHIELD04
 ACCEPT

>>DIALOGUE_SHIELD04
 //HEROSAY -d "2"
 SPEAK -poc ZOOM 0 20 0 20 40 40 [Player_Alia_back_with_shield_02] GOTO DIALOGUE_SHIELD05
 ACCEPT

>>DIALOGUE_SHIELD05
 //HEROSAY -d "3"
 SPEAK -co ZOOM 30 0 0 0 80 60 [Alia_player_back_with_shield_03] GOTO DIALOGUE_SHIELD06
 ACCEPT

>>DIALOGUE_SHIELD06
 //HEROSAY -d "4"
 SPEAK -poc SIDE_L SELF 0 50 30 150 0 [Player_Alia_back_with_shield_03] GOTO DIALOGUE_SHIELD07
 ACCEPT

>>DIALOGUE_SHIELD07
 //HEROSAY -d "5"
 SPEAK -oc KEEP [Alia_player_back_with_shield_04A] GOTO DIALOGUE_SHIELD07B 
 ACCEPT


>>DIALOGUE_SHIELD07B
 //HEROSAY -d "6"
 SPEAK -oc ZOOM 0 0 0 0 60 20 [Alia_player_back_with_shield_04B] GOTO DIALOGUE_SHIELD08A 
 ACCEPT

>>DIALOGUE_SHIELD08A
 //HEROSAY -d "7"
IF (§know_queen_quest == 1) GOTO DIALOGUE_SHIELD08C
IF (#QUEEN_QUEST == 2) {
  SET §know_queen_quest 1
  //HEROSAY -d "QUEEN"
  SPEAK -opu [Player_Alia_back_with_news] GOTO DIALOGUE_SHIELD08B
  ACCEPT 
 }
  GOTO DIALOGUE_SHIELD08C
  ACCEPT

>>DIALOGUE_SHIELD08B
 //HEROSAY -d "8"
 SPEAK -ou [Alia_player_back_with_news] GOTO DIALOGUE_SHIELD08C
 ACCEPT

>>DIALOGUE_SHIELD08C
 //HEROSAY -d "9"
 SPEAK -pou [Player_Alia_back_with_shield_04] GOTO DIALOGUE_SHIELD09
 ACCEPT

>>DIALOGUE_SHIELD09
 BEHAVIOR NONE
 SETTARGET NONE
 SENDEVENT CINEMATIC CAMERA_0062 "TRAVELING_OUT"
 TELEPORT -pa 180 MARKER_0586
 IF (#KRAHOZ_STOLEN == 1) SENDEVENT LETPASS HUMAN_BASE_0110 ""
 IF (§status4 == 1) SENDEVENT LETPASS HUMAN_BASE_0110 ""
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0331
 TELEPORT -pa 300 MARKER_0587
 TIMERlookat -m 50 10 PLAYERLOOKAT ME
 //HEROSAY -d "10"
 TIMERwalk 1 6 PLAYERLOOKAT ME
 TIMERlook 1 15 PLAYERLOOKAT SELF
 TIMERout2 1 1 GOTO SPK
 ACCEPT

>>SPK
 SPEAK -ou [Alia_player_back_with_shield_05] GOTO DIALOGUE_SHIELD10
 ACCEPT

>>DIALOGUE_SHIELD10
 //HEROSAY -d "11"
 SPEAK -p [Player_Alia_back_with_shield_05] GOTO DIALOGUE_SHIELD11A
 ACCEPT

>>DIALOGUE_SHIELD11A
 IF (#krahoz_stolen == 1) {   // Alia ne peut pas envoyer le player chercher KRAHOZ
  //HEROSAY -d "12"                          // puisqu'il est volé
  PLAYANIM WAIT
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  SET §chatpos 4 
  SPEAK -o [Alia_player_back_with_shield_06A] GOTO FIN_DIALOGUE_SHIELDA
  ACCEPT
 }
 //HEROSAY -d "13"
  PLAYANIM WAIT
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
 SPEAK -o [Alia_player_back_with_shield_06A] GOTO DIALOGUE_SHIELD11B
 ACCEPT

>>DIALOGUE_SHIELD11B
 SET §chatpos 3
 SET §back 1
 IF (§status3 == 1) GOTO STATUS3
 SENDEVENT UNLOCK light_door_0015 ""
 SENDEVENT UNLOCK light_door_0124 ""
 SET #krahoz_free 1
 SENDEVENT KRAHOZ_FREE HUMAN_BASE_0051 ""
 SENDEVENT KRAHOZ_FREE HUMAN_BASE_0088 ""
 SENDEVENT KRAHOZ_FREE HUMAN_BASE_0089 ""
 SENDEVENT KRAHOZ_FREE HUMAN_BASE_0090 ""
 //HEROSAY -d "14"
 SPEAK -ou [Alia_player_back_with_shield_06B] GOTO FIN_DIALOGUE_SHIELDB
 ACCEPT

>>FIN_DIALOGUE_SHIELDA
 //HEROSAY -d "15"
 SPEAK -uo [player_alia_real_introduce_05A] nop
 PHYSICAL OFF
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0588
 SET §nocombine 1
 SET §back 1
 TIMERcontrol 1 2 GOTO CONTROL_BACK
ACCEPT

>>CONTROL_BACK
//HEROSAY -d "16"
 PHYSICAL ON
 CAMERA_ACTIVATE NONE
 PLAYERLOOKAT SELF
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 PLAYER_INTERFACE -s SHOW
 //SET §chatpos 3
 SET #SHUT_UP 0
 IF (§status3 == 1) GOTO STATUS3
ACCEPT

>>FIN_DIALOGUE_SHIELDB
 //HEROSAY -d "17"
 IF (§status4 == 1) GOTO GUARD_LEAVE
>>SUITE
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0588
 SET §nocombine 1
 CAMERA_ACTIVATE NONE
 PLAYERLOOKAT SELF
 PLAYER_INTERFACE -s SHOW
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 HEROSAY -d "CINEMASCOPE OFF"
 SET #SHUT_UP 0
 IF (§status4 == 1) 
 {
  ACCEPT
 }
 IF (§status1 == 1) GOTO STATUS1
ACCEPT

>>GUARD_LEAVE
 //HEROSAY -d "18"
 PLAYANIM ACTION7
 TIMERcome 1 1 SENDEVENT TAKE_KRAHOZ HUMAN_BASE_0110 ""
 TIMERreward 1 3 SPEAK -ou [alia_stolen_krahoz_thanks] GOTO SUITE 
ACCEPT


// Dialogue if Krahoz is given back to Alia after stolen

>>KRAHOZ_BACK_THIEF01
//HEROSAY -d "19"
 SET_PLAYER_CONTROLS OFF
 CINEMASCOPE -s ON
 SET #SHUT_UP 1
 PLAYER_INTERFACE -s HIDE
 PLAYER_LOOKAT SELF
 SPEAK -opu [player_bring_stolen_krahoz] GOTO KRAHOZ_BACK_THIEF02  //CINEMATIQUE DU GARDE VENANT CHECHER KRAHOZ
ACCEPT

>>KRAHOZ_BACK_THIEF02
 //HEROSAY -d "20"
 GOSUB CINEMATIQUE_KRAHOZ_BACK
 SET §return 1
ACCEPT

ON REACHEDTARGET 
{
 IF (^TARGET == "MARKER_0153") 
 {
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  ACCEPT
 }
 IF (^TARGET == "MARKER_0149") 
 {
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  ACCEPT
 }
 IF (^TARGET == "human_base_0110") 
 {
  IF (§return == 1) 
  {
   BEHAVIOR NONE
   SETTARGET NONE
   TIMERkrahoz1 1 5 GOTO KRAHOZ_BACK_THIEF03
   TIMERkrahoz2 1 1 SENDEVENT GOHOME human_base_0110 ""
   TIMERkrahoz3 1 1 GOTO BACK_TO_PLAYER
   ACCEPT
  }
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  ACCEPT
 }
 IF (^TARGET == "MARKER_0203") 
 {
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  TIMERlight 1 8 GOTO LIGHT
  ACCEPT
 }
 IF (^TARGET == "MARKER_0568") 
 {
herosay -d "REACHED MARKER 568"
  SET §nocombine 0
  IF (§back != 1) GOTO LIGHT2
  IF (§return == 2) 
  {    ////A VIRER (QUAND PLUS DE BUG REACHEDTARGET)
   TIMERtelep 1 2 TELEPORT MARKER_0568  ////A VIRER (QUAND PLUS DE BUG REACHEDTARGET)
   SET §return 3        ////A VIRER (QUAND PLUS DE BUG REACHEDTARGET)
  }
  TIMERplookat 1 4 PLAYERLOOKAT SELF                      
  TIMERlookat 1 1 GOTO LOOKAT 
  ACCEPT
 }
 IF (^TARGET == "MARKER_0588") 
 {
herosay -d "REACHED MARKER 588"
  BEHAVIOR MOVE_TO 
  SETTARGET MARKER_0568
  ACCEPT
 }
 IF (^TARGET == "MARKER_0331") 
 {
  //HEROSAY -d "0331 REACHED"
  BEHAVIOR MOVE_TO
  SETTARGET MARKER_0584
//  TELEPORT -pa 300 MARKER_0587
  ACCEPT
 }
 IF (^TARGET == "MARKER_0584") 
 {
  //HEROSAY -d "0584 REACHED"
  BEHAVIOR FRIENDLY 
  SETTARGET MARKER_0585
  TIMERbalcon 1 1 PLAYANIM -e ACTION5 PLAYANIM -l ACTION6
  ACCEPT
 }
 ACCEPT
}

>>LOOKAT
  BEHAVIOR FRIENDLY
  SETTARGET PLAYER
  ACCEPT

>>LIGHT
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0568
 ACCEPT

>>LIGHT2
 BEHAVIOR FRIENDLY
 SETTARGET BOOK_0031
 TIMERlight2 1 1 SPELLCAST -msf 1 IGNIT ""
 TELEPORT -pa 350 MARKER_0390
 TIMERplay 1 1 PLAYANIM -p WALK
 TIMERface 1 2 SETTARGET PLAYER
 TIMERstop 1 5 PLAYANIM -p WAIT
 ACCEPT

>>BACK_TO_PLAYER
  BEHAVIOR MOVE_TO
  SETTARGET MARKER_0568
  SET §return 2
  ACCEPT

>>KRAHOZ_BACK_THIEF03
 SET §return 2
 IF (#shield_elder_retrieved == 2) 
 {     //Le shield est deja rendu
  TIMERspeak1 1 2 SPEAK -opu [player_bring_stolen_krahoz2] GOTO KRAHOZ_BACK_THIEF_HONOR
  ACCEPT
 }
 SET §chatpos 2
 TIMERspeak2 1 2 SPEAK -pou [player_bring_stolen_krahoz2] GOTO KRAHOZ_BACK_THIEF04
ACCEPT

>>KRAHOZ_BACK_THIEF_HONOR
 SENDEVENT UNLOCK light_door_0015 ""
 SENDEVENT UNLOCK light_door_0124 ""
 IF (§status3 == 1) 
 {
   GOTO KRAHOZ_BACK_THIEF04
   ACCEPT
 }
 SET §chatpos 3 
 SPEAK -ou [Alia_player_back_with_shield_06B] GOTO KRAHOZ_BACK_THIEF04
 ACCEPT

>>KRAHOZ_BACK_THIEF04
 ADDGOLD 250 
 PLAYERLOOKAT SELF
 IF (§status2 == 1) GOTO IN_BED_WITH_ALIA
 CINEMASCOPE -s OFF
 SET #SHUT_UP 0
 PLAYER_INTERFACE -s SHOW
 SET_PLAYER_CONTROLS ON
ACCEPT


>>KRAHOZ_BACK01
 SPEAK -ou [Alia_player_bring_krahoz] nop
 //PLAYER_LOOKAT HUMAN_BASE_0111
 //SET_PLAYER_CONTROLS ON
 //CINEMASCOPE -s OFF
 //PLAYER_INTERFACE -s SHOW
 ACCEPT


>>KRAHOZ_ZOHARK1
 SET #SHUT_UP 1
 SET_PLAYER_CONTROLS OFF
 PLAYERINTERFACE -s HIDE
 CINEMASCOPE -s ON
 SPEAK -ou [alia_bring_krahoz-zohark] GOTO KRAHOZ_ZOHARK2
ACCEPT

>>KRAHOZ_ZOHARK2
 IF (#shield_elder_retrieved < 2) 
 { 
  SPEAK -ou [alia_bring_krahoz-zohark2] GOTO DIALOGUE_SHIELD04
  ACCEPT
 }
 SPEAK -ou [alia_bring_krahoz-zohark2] GOTO STATUS1
ACCEPT

>>STATUS1
 IF (§status3 == 1) GOTO STATUS3
 IF (§status1 == 1) GOTO KRAHOZ_BACK_THIEF02 
 SPEAK -ou [alia_stolen_krahoz_thanks] GOTO KRAHOZ_BACK_THIEF03
ACCEPT

>>STATUS3
 SET §status3 2
 IF (#shield_elder_retrieved == 2) 
 {
  PLAY "system"
  HEROSAY [system_object_received]
  INVENTORY PLAYERADDFROMSCENE "shield_elders_0001"    /////TESTER AVEC >>>shield_elders_0002
  SPEAK -ou [alia_let_shield] GOTO CONVERSATION_OUT
  ACCEPT
 }
 GOTO CONVERSATION_OUT
 //SPEAK -uo [alia_let_shield] GOTO DIALOGUE_SHIELD11B 
ACCEPT


//////////////////////////////TEMPORAIRE voir anvil 0005 & 0007////////////////////////////////
>>RACCOURCI
 OBJECT_HIDE SELF OFF
 BEHAVIOR NONE
 SETTARGET NONE
 TELEPORT -p MARKER_0390             // Teleporte Player dans le camp des rebelles
 TELEPORT MARKER_0568                // Teleporte alia dans le camp des rebelles
 TWEAK lower "human_female_plate"
 TWEAK SKIN "npc_human_villager_female_body" "npc_human_villager_female_body2"
 GOTO DIALOGUE_TRUE13
 ACCEPT


ON RESET {
 SET §chatpos 0
 SET §know 0
 SET #shield_elder_retrieved 0
 SET §return 0
 SET §krahoz_given 0
 SET #krahoz_stolen 0
 SET #statue_destroyed 0
 SET §zohark_given 0 
 SET §status1 0 
 SET §status2 0 
 SET §status3 0
 SET §know_queen_quest 0
ACCEPT
}
////////////////////////////////////////////////




ON CUSTOM {

////////////////////////////TEMPORAIRE A VIRER //////////////////////////////////////////////////                  
 
IF (^$PARAM1 == "SAUCISSE") {
  SET #shield_elder_retrieved 1
  SET §know 1
  SET §chatpos 2 
  ACCEPT
 }

IF (^$param1 == "CAMP") {
  SET §back 1
  GOTO RACCOURCI
  ACCEPT
 }
 IF (^$param1 == "GO") { 
  GOTO SIMULATE_RELOAD
  ACCEPT
 }
IF (^$param1 == "GO2") { 
  GOTO ALIA_MOVE
  ACCEPT
 }

IF (^$param1 == "TRANSFORM") {
  TWEAK all "human_female_base" 
  SET §nightmare 0
  GOTO TRANSFORM2
  ACCEPT
 }


////////////////////////////////////////////////////////////////////////////////////
 
IF (^$PARAM1 == "CONTROL_FRONT_DOOR") {
  SENDEVENT CHANGESTATUS human_base_0110 "1"
  SET_CONTROLLED_ZONE FRONT_DOOR_ALIA
  ACCEPT
 }
ACCEPT
}

>>CINEMATIQUE_KRAHOZ_BACK 
 IF (#shield_elder_retrieved == 2) GOTO KEEPIT
 SENDEVENT KRAHOZ_IN_CHEST chest_metal_0003 ""
 SENDEVENT CINEMATIC CAMERA_0071 "1"
 TELEPORT -pa 135 MARKER_0586
 PLAYANIM ACTION7
 SENDEVENT TAKE_KRAHOZ HUMAN_BASE_0110 ""
 TIMERreward 1 3 SPEAK -ou [alia_stolen_krahoz_thanks] GOTO KRAHOZ_BACK_THIEF03 
RETURN

>>KEEPIT
 SPEAK [alia_player_bring_krahoz] GOTO KRAHOZ_BACK_THIEF04
 ACCEPT

ON LOOKATME 
{
 BEHAVIOR FRIENDLY
 SETTARGET HUMAN_BASE_0110
 TIMERlookp 1 2 GOTO LOOKAT
 ACCEPT
}

>>CONVERSATION_OUT
 //PLAY system
 //PLAYERLOOKAT SELF
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 CAMERAACTIVATE NONE
 PLAYER_INTERFACE -s SHOW
 SET #SHUT_UP 0
ACCEPT

>>IN_BED_WITH_ALIA
 CINEMASCOPE -s ON
 SETPLAYERCONTROLS OFF
 PLAYERINTERFACE -s HIDE
 SET #SHUT_UP 1
 SET §slept 1
 SPEAK -u [alia_thanks_krahoz] GOTO BED
 ACCEPT

>>BED
 BEHAVIOR NONE
 SETTARGET NONE
 //HEROSAY -d "CINEMATIC : IN BED WITH ALIA"
 PHYSICAL OFF
 WORLD_FADE OUT 1000 0 0 0
 TIMERcensor 1 6 GOTO CENSURE
///////
// TIMERtrans 1 2 GOSUB TRANSFORM
// TIMERfadein 1 3 GOTO FADEIN 
// TIMERwalk 1 9 PLAYANIM -p WALK
// TIMERstop 1 12 PLAYANIM -p WAIT
//////

ACCEPT

>>FADEIN
 SET_SHADOW OFF
 WORLD_FADE IN 3000
 PLAYANIM -e ACTION8 PLAYANIM -l ACTION9
ACCEPT

>>TRANSFORM
 SENDEVENT CINEMATIC CAMERA_0071 "INBED"
 TELEPORT -ap 175 MARKER_0203
 TWEAK all "human_female_base"
 TELEPORT MARKER_0373
 FORCEANGLE 185
RETURN

ON ENDBED1 
{
 //HEROSAY -d "ENDBED1"
 TIMERfade1 1 5 WORLD_FADE OUT 5000 0 0 0
 TIMERtransform2 1 7 GOTO TRANSFORM2
 ACCEPT
}

>>TRANSFORM2
 >>CENSURE
 TWEAK lower "human_female_villager"
 TWEAK SKIN "npc_human_villager_female_body" "npc_human_villager_female_body2"
 LOADANIM -p ACTION2 "human_normal_on_bed"
 TELEPORT MARKER_0376
 TELEPORT -pa 30 MARKER_0377
 PLAYANIM -pl ACTION2
 GOTO CENSURE2
ACCEPT

ON ENDBED2 
{
 >>CENSURE2
 LOADANIM ACTION8 "human_alia_bed_out_normal"
 LOADANIM ACTION3 "human_alia_bed_out_cycle"
>>AWAKE
 //HEROSAY -d "ENDBED2"
 FORCEANGLE 285
 WORLD_FADE IN 3000
 PLAYANIM -l ACTION4
 IF (§nightmare == 1) 
 {
  SENDEVENT CINEMATIC CAMERA_0071 "NIGHTMARE"
  SPEAK -aou [alia_nightmare] GOTO TRUE
  ACCEPT
 }
 IF (§nightmare == 0) 
 {
  SENDEVENT CINEMATIC CAMERA_0071 "NIGHTMARE"
  SPEAK -aou [alia_nightmare] GOTO NIGHTMARE
  ACCEPT
 }
 ACCEPT
}

>>NIGHTMARE
 FORCE_ANGLE 320
 SPEAK -aou [alia_nightmare2] NOP
 SET §nightmare 1
 TIMERchange 1 2 SENDEVENT CINEMATIC CAMERA_0071 "CHANGE"
 TIMERskin 1 2 TWEAK SKIN "npc_human_female_base_head""npc_human_female_base_demon_head"
ACCEPT

ON FLASH 
{
 PLAY "FLASH"
 WORLDFADE OUT 200 1 1 1
 TWEAK SKIN "npc_human_female_base_demon_head""npc_human_female_base_head" 
 //TIMERtransform -m 1 200 WORLDFADE IN 600
 //CAMERA_ACTIVATE NONE
 ACCEPT
}

ON RED_FLASH 
{
 PLAY "FLASH"
 WORLDFADE OUT 200 0 0 0
 TWEAK SKIN "npc_human_female_base_demon_head""npc_human_female_base_head" 
 //TIMERtransform -m 1 200 WORLDFADE IN 600
 ACCEPT
}



ON AWAKE 
{
 TIMERgoto 1 7 GOTO AWAKE
ACCEPT
}

>>TRUE
 CAMERA_ACTIVATE NONE
 PLAYANIM -l ACTION3
 SPEAK -aou [alia_nightmare3] GOTO STAND
 ACCEPT

>>STAND
 SET_SHADOW ON
 WORLD_FADE OUT 2000 0 0 0
 TIMERend 1 2 GOTO END_CINE_BED
 PLAYANIM -e ACTION8 GOTO WALK
ACCEPT

>>WALK
 BEHAVIOR MOVE_TO
 SETTARGET MARKER_0335
 ACCEPT

>>END_CINE_BED
 BEHAVIOR NONE
 SETTARGET NONE
 TWEAK lower "human_female_plate"
 TWEAK SKIN "npc_human_villager_female_body" "npc_human_villager_female_body2"
 TELEPORT MARKER_0568
 FORCEANGLE 270 
 TELEPORT -ap 0 MARKER_0374
 WORLD_FADE IN 1000
 SET_PLAYER_CONTROLS ON
 CINEMASCOPE -s OFF
 PLAYER_INTERFACE -s SHOW
 SET #SHUT_UP 0
 PLAYANIM -p WAIT
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 -----------------------------------------------------------
// ---------------------------------------------------------------------------------

//# 


ON CHAT {
  IF (^speaking == 1) ACCEPT
  IF (#DISSIDENT == 3) {
  SPEAK -p [player_no] nop
  REFUSE
 }
  IF (#alia_destiny > 0) {
   SPEAK [alia_debriefing] NOP
   ACCEPT
  }
  IF (§chatpos == 2) {
   IF (#krahoz_stolen == 1){
    SET §chatpos 4                   // Dialogue if Krahoz have been stolen 
    GOTO CHATPOS
    ACCEPT
   }
   GOSUB START_CHAT
   IF (#shield_elder_retrieved == 1){
    IF (§know == 0){
     SPEAK [Alia_player_with_shield_01] GOSUB END_CHAT
     SET §know 1
     ACCEPT
    }
    RANDOM 10 
    {
     SPEAK [Alia_player_with_shield_01] GOSUB END_CHAT
     ACCEPT
    }
    SPEAK [Alia_real_introduce_misc] GOSUB END_CHAT
    ACCEPT
   }
   SPEAK [Alia_real_introduce_misc] GOSUB END_CHAT
   ACCEPT
  }
  IF (§chatpos == 3) 
  {
   GOSUB START_CHAT
   SPEAK [Alia_misc] GOSUB END_CHAT
   ACCEPT
  }
  IF (§chatpos == 4) 
  {
   >>CHATPOS
    GOSUB START_CHAT
    SPEAK [alia_krahoz_stolen_misc] GOSUB END_CHAT
    ACCEPT
  }
 ACCEPT
}