/* Amarande Remove Escape Area*/
ALTER_TRANS ~%tutu_var%AMARAN~
BEGIN 3 5 END
BEGIN 0 END
BEGIN
"ACTION" ~SetGlobal("X#RemovedEscape","GLOBAL",1)~
END

/* PDialogue repairs */
REPLACE_TRANS_ACTION _JAHEIP BEGIN 7 END BEGIN END ~JoinParty()~ ~ActionOverride("jaheira",JoinParty())~ 

REPLACE_TRANS_ACTION _IMOENP BEGIN 2 END BEGIN END ~JoinParty()~ ~ActionOverride("imoen",JoinParty())~ 

REPLACE_TRANS_ACTION _QUAYLP BEGIN 2 END BEGIN END ~JoinParty()~ ~SetGlobal("KickedOut","LOCALS",0) JoinParty()~

/* YESLICK */
REPLACE_STATE_TRIGGER ~_BYESLI~ 9 ~InteractingWith("kagain") RandomNum(8,1) Global("X#BIOYE1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 10 ~InteractingWith("kagain") RandomNum(8,2) Global("X#BIOYE2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 12 ~InteractingWith("kagain") RandomNum(8,3) Global("X#BIOYE3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 17 ~InteractingWith("kagain") RandomNum(8,4) Global("X#BIOYE4","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 18 ~InteractingWith("kagain") RandomNum(8,5) Global("X#BIOYE5","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 19 ~InteractingWith("kagain") RandomNum(8,6) Global("X#BIOYE6","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 20 ~InteractingWith("kagain") RandomNum(8,7) Global("X#BIOYE7","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BYESLI~ 13 ~InteractingWith("kagain") RandomNum(8,8) Global("X#BIOYE8","LOCALS",0)~

ADD_TRANS_ACTION ~_BYESLI~ BEGIN 9 END BEGIN END ~SetGlobal("X#BIOYE1","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 10 END BEGIN END ~SetGlobal("X#BIOYE2","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 12 END BEGIN END ~SetGlobal("X#BIOYE3","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 17 END BEGIN END ~SetGlobal("X#BIOYE4","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 18 END BEGIN END ~SetGlobal("X#BIOYE5","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 19 END BEGIN END ~SetGlobal("X#BIOYE6","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 20 END BEGIN END ~SetGlobal("X#BIOYE7","LOCALS",1)~
ADD_TRANS_ACTION ~_BYESLI~ BEGIN 13 END BEGIN END ~SetGlobal("X#BIOYE8","LOCALS",1)~

/* XZAR */
REPLACE_STATE_TRIGGER ~_BXZAR~ 0 ~InteractingWith("montaron") RandomNum(3,1) Global("X#BIOXZ1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BXZAR~ 1 ~InteractingWith("montaron") RandomNum(3,2) Global("X#BIOXZ2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BXZAR~ 2 ~InteractingWith("montaron") RandomNum(3,3) Global("X#BIOXZ3","LOCALS",0)~

ADD_TRANS_ACTION ~_BXZAR~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOXZ1","LOCALS",1)~
ADD_TRANS_ACTION ~_BXZAR~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOXZ2","LOCALS",1)~
ADD_TRANS_ACTION ~_BXZAR~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOXZ3","LOCALS",1)~

/* XAN */
REPLACE_STATE_TRIGGER ~_BXANNN~ 0 ~InteractingWith("eldoth") RandomNum(3,1) Global("X#BIOXA1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BXANNN~ 1 ~InteractingWith("eldoth") RandomNum(3,2) Global("X#BIOXA2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BXANNN~ 2 ~InteractingWith("eldoth") RandomNum(3,3) Global("X#BIOXA3","LOCALS",0)~

ADD_TRANS_ACTION ~_BXANNN~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOXA1","LOCALS",1)~
ADD_TRANS_ACTION ~_BXANNN~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOXA2","LOCALS",1)~
ADD_TRANS_ACTION ~_BXANNN~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOXA3","LOCALS",1)~

/* VICONIA */
REPLACE_STATE_TRIGGER ~_BVICON~ 0 ~InteractingWith("kivan") RandomNum(4,1) Global("X#BIOVI1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BVICON~ 8 ~InteractingWith("kivan") RandomNum(4,2) Global("X#BIOVI2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BVICON~ 9 ~InteractingWith("kivan") RandomNum(4,3) Global("X#BIOVI3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BVICON~ 10 ~InteractingWith("kivan") RandomNum(4,4) Global("X#BIOVI4","LOCALS",0)~

ADD_TRANS_ACTION ~_BVICON~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOVI1","LOCALS",1)~
ADD_TRANS_ACTION ~_BVICON~ BEGIN 8 END BEGIN END ~SetGlobal("X#BIOVI2","LOCALS",1)~
ADD_TRANS_ACTION ~_BVICON~ BEGIN 9 END BEGIN END ~SetGlobal("X#BIOVI3","LOCALS",1)~
ADD_TRANS_ACTION ~_BVICON~ BEGIN 10 END BEGIN END ~SetGlobal("X#BIOVI4","LOCALS",1)~

/* TIAX */
REPLACE_STATE_TRIGGER ~_BTIAX~ 6 ~InteractingWith("quayle") RandomNum(7,1) Global("X#BIOTI1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 7 ~InteractingWith("quayle") RandomNum(7,2) Global("X#BIOTI2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 9 ~InteractingWith("quayle") RandomNum(7,3) Global("X#BIOTI3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 14 ~InteractingWith("quayle") RandomNum(7,4) Global("X#BIOTI4","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 15 ~InteractingWith("quayle") RandomNum(7,5) Global("X#BIOTI5","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 16 ~InteractingWith("quayle") RandomNum(7,6) Global("X#BIOTI6","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 17 ~InteractingWith("quayle") RandomNum(7,7) Global("X#BIOTI7","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 10 ~InteractingWith("branwen") RandomNum(3,1) Global("X#BIOTI8","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 11 ~InteractingWith("branwen") RandomNum(3,2) Global("X#BIOTI9","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BTIAX~ 12 ~InteractingWith("branwen") RandomNum(3,3) Global("X#BIOTI10","LOCALS",0)~

ADD_TRANS_ACTION ~_BTIAX~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOTI1","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOTI2","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 9 END BEGIN END ~SetGlobal("X#BIOTI3","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 14 END BEGIN END ~SetGlobal("X#BIOTI4","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 15 END BEGIN END ~SetGlobal("X#BIOTI5","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 16 END BEGIN END ~SetGlobal("X#BIOTI6","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 17 END BEGIN END ~SetGlobal("X#BIOTI7","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 10 END BEGIN END ~SetGlobal("X#BIOTI8","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 11 END BEGIN END ~SetGlobal("X#BIOTI9","LOCALS",1)~
ADD_TRANS_ACTION ~_BTIAX~ BEGIN 12 END BEGIN END ~SetGlobal("X#BIOTI10","LOCALS",1)~

/* SKIE */
REPLACE_STATE_TRIGGER ~_BSKIE~ 0 ~InteractingWith("eldoth") RandomNum(4,1) Global("X#BIOSK1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSKIE~ 1 ~InteractingWith("eldoth") RandomNum(4,2) Global("X#BIOSK2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSKIE~ 9 ~InteractingWith("eldoth") RandomNum(4,3) Global("X#BIOSK3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSKIE~ 10 ~InteractingWith("eldoth") RandomNum(4,4) Global("X#BIOSK4","LOCALS",0)~

ADD_TRANS_ACTION ~_BSKIE~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOSK1","LOCALS",1)~
ADD_TRANS_ACTION ~_BSKIE~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOSK2","LOCALS",1)~
ADD_TRANS_ACTION ~_BSKIE~ BEGIN 9 END BEGIN END ~SetGlobal("X#BIOSK3","LOCALS",1)~
ADD_TRANS_ACTION ~_BSKIE~ BEGIN 10 END BEGIN END ~SetGlobal("X#BIOSK4","LOCALS",1)~

/* SHAR-TEEL */
REPLACE_STATE_TRIGGER ~_BSHART~ 12 ~InteractingWith("eldoth") RandomNum(4,1) Global("X#BIOSH1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSHART~ 13 ~InteractingWith("eldoth") RandomNum(4,2) Global("X#BIOSH2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSHART~ 14 ~InteractingWith("eldoth") RandomNum(4,3) Global("X#BIOSH3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BSHART~ 15 ~InteractingWith("eldoth") RandomNum(4,4) Global("X#BIOSH4","LOCALS",0)~

ADD_TRANS_ACTION ~_BSHART~ BEGIN 12 END BEGIN END ~SetGlobal("X#BIOSH1","LOCALS",1)~
ADD_TRANS_ACTION ~_BSHART~ BEGIN 13 END BEGIN END ~SetGlobal("X#BIOSH2","LOCALS",1)~
ADD_TRANS_ACTION ~_BSHART~ BEGIN 14 END BEGIN END ~SetGlobal("X#BIOSH3","LOCALS",1)~
ADD_TRANS_ACTION ~_BSHART~ BEGIN 15 END BEGIN END ~SetGlobal("X#BIOSH4","LOCALS",1)~

/* SAFANA NONE */

/* QUAYLE */
REPLACE_STATE_TRIGGER ~_BQUAYL~ 0 ~InteractingWith("tiax") RandomNum(4,1) Global("X#BIOQU1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BQUAYL~ 5 ~InteractingWith("tiax") RandomNum(4,2) Global("X#BIOQU2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BQUAYL~ 6 ~InteractingWith("tiax") RandomNum(4,3) Global("X#BIOQU3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BQUAYL~ 7 ~InteractingWith("tiax") RandomNum(4,4) Global("X#BIOQU4","LOCALS",0)~

ADD_TRANS_ACTION ~_BQUAYL~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOQU1","LOCALS",1)~
ADD_TRANS_ACTION ~_BQUAYL~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIOQU2","LOCALS",1)~
ADD_TRANS_ACTION ~_BQUAYL~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOQU3","LOCALS",1)~
ADD_TRANS_ACTION ~_BQUAYL~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOQU4","LOCALS",1)~

/* MONTARON NONE */

/* MINSC */
REPLACE_STATE_TRIGGER ~_BMINSC~ 7 ~InteractingWith("dynaheir") RandomNum(2,1) Global("X#BIOMI1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BMINSC~ 8 ~InteractingWith("dynaheir") RandomNum(2,2) Global("X#BIOMI2","LOCALS",0)~

ADD_TRANS_ACTION ~_BMINSC~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOMI1","LOCALS",1)~

ADD_TRANS_ACTION ~_BMINSC~ BEGIN 8 END BEGIN END ~SetGlobal("X#BIOMI2","LOCALS",1)~

/* KIVAN */
REPLACE_STATE_TRIGGER ~_BKIVAN~ 0 ~InteractingWith("viconia") RandomNum(5,1) Global("X#BIOKI1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BKIVAN~ 1 ~InteractingWith("viconia") RandomNum(5,2) Global("X#BIOKI2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BKIVAN~ 5 ~InteractingWith("viconia") RandomNum(5,3) Global("X#BIOKI3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BKIVAN~ 6 ~InteractingWith("viconia") RandomNum(5,4) Global("X#BIOKI4","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BKIVAN~ 7 ~InteractingWith("viconia") RandomNum(5,5) Global("X#BIOKI5","LOCALS",0)~

ADD_TRANS_ACTION ~_BKIVAN~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOKI1","LOCALS",1)~
ADD_TRANS_ACTION ~_BKIVAN~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOKI2","LOCALS",1)~
ADD_TRANS_ACTION ~_BKIVAN~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIOKI3","LOCALS",1)~
ADD_TRANS_ACTION ~_BKIVAN~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOKI4","LOCALS",1)~
ADD_TRANS_ACTION ~_BKIVAN~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOKI5","LOCALS",1)~

/* KHALID */
ADD_STATE_TRIGGER ~_BKHALI~ 3 ~Global("X#BIOKH1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BKHALI~ 8 ~Global("X#BIOKH2","LOCALS",0)~

REPLACE_STATE_TRIGGER ~_BKHALI~ 9 ~InteractingWith("xzar") RandomNum(2,2) Global("X#BIOKH3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BKHALI~ 10 ~InteractingWith("montaron") RandomNum(2,2) Global("X#BIOKH4","LOCALS",0)~

ADD_TRANS_ACTION ~_BKHALI~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOKH1","LOCALS",1)~
ADD_TRANS_ACTION ~_BKHALI~ BEGIN 8 END BEGIN END ~SetGlobal("X#BIOKH2","LOCALS",1)~
ADD_TRANS_ACTION ~_BKHALI~ BEGIN 9 END BEGIN END ~SetGlobal("X#BIOKH3","LOCALS",1)~
ADD_TRANS_ACTION ~_BKHALI~ BEGIN 10 END BEGIN END ~SetGlobal("X#BIOKH4","LOCALS",1)~

/* KAGAIN- NONE */

/* JAHEIRA */
ADD_STATE_TRIGGER ~_BJAHEI~ 0 ~Global("X#BIOJA1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BJAHEI~ 3 ~Global("X#BIOJA2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BJAHEI~ 6 ~Global("X#BIOJA4","LOCALS",0)~
ADD_STATE_TRIGGER ~_BJAHEI~ 7 ~Global("X#BIOJA5","LOCALS",0)~

REPLACE_STATE_TRIGGER ~_BJAHEI~ 5 ~InteractingWith("khalid") RandomNum(3,2) Global("X#BIOJA3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BJAHEI~ 8 ~InteractingWith("khalid") Global("X#BIOJA6","LOCALS",0)~

ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOJA1","LOCALS",1)~
ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOJA2","LOCALS",1)~
ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIOJA3","LOCALS",1)~
ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOJA4","LOCALS",1)~
ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOJA5","LOCALS",1)~
ADD_TRANS_ACTION ~_BJAHEI~ BEGIN 8 END BEGIN END ~SetGlobal("X#BIOJA6","LOCALS",1)~

/* GARRICK */
ADD_STATE_TRIGGER ~_BGARRI~ 0 ~Global("X#BIOGA1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BGARRI~ 1 ~Global("X#BIOGA2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BGARRI~ 4 ~Global("X#BIOGA3","LOCALS",0)~
ADD_STATE_TRIGGER ~_BGARRI~ 5 ~Global("X#BIOGA4","LOCALS",0)~
ADD_STATE_TRIGGER ~_BGARRI~ 6 ~Global("X#BIOGA5","LOCALS",0)~
ADD_STATE_TRIGGER ~_BGARRI~ 7 ~Global("X#BIOGA6","LOCALS",0)~

ADD_TRANS_ACTION ~_BGARRI~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOGA1","LOCALS",1)~
ADD_TRANS_ACTION ~_BGARRI~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOGA2","LOCALS",1)~
ADD_TRANS_ACTION ~_BGARRI~ BEGIN 4 END BEGIN END ~SetGlobal("X#BIOGA3","LOCALS",1)~
ADD_TRANS_ACTION ~_BGARRI~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIOGA4","LOCALS",1)~
ADD_TRANS_ACTION ~_BGARRI~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOGA5","LOCALS",1)~
ADD_TRANS_ACTION ~_BGARRI~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOGA6","LOCALS",1)~

/* FALDORN */
ADD_STATE_TRIGGER ~_BFALDO~ 0 ~Global("X#BIOFA1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BFALDO~ 1 ~Global("X#BIOFA2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BFALDO~ 2 ~Global("X#BIOFA3","LOCALS",0)~
ADD_STATE_TRIGGER ~_BFALDO~ 3 ~Global("X#BIOFA4","LOCALS",0)~

ADD_TRANS_ACTION ~_BFALDO~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOFA1","LOCALS",1)~
ADD_TRANS_ACTION ~_BFALDO~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOFA2","LOCALS",1)~
ADD_TRANS_ACTION ~_BFALDO~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOFA3","LOCALS",1)~
ADD_TRANS_ACTION ~_BFALDO~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOFA4","LOCALS",1)~

/* ELDOTH */
REPLACE_STATE_TRIGGER ~_BELDOT~ 17 ~InteractingWith("sharteel") RandomNum(4,1) Global("X#BIOEL1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BELDOT~ 18 ~InteractingWith("sharteel") RandomNum(4,2) Global("X#BIOEL2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BELDOT~ 19 ~InteractingWith("sharteel") RandomNum(4,3) Global("X#BIOEL3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BELDOT~ 20 ~InteractingWith("sharteel") RandomNum(4,4) Global("X#BIOEL4","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BELDOT~ 21 ~InteractingWith("xan") RandomNum(2,1) Global("X#BIOEL5","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BELDOT~ 22 ~InteractingWith("xan") RandomNum(2,2) Global("X#BIOEL6","LOCALS",0)~

ADD_TRANS_ACTION ~_BELDOT~ BEGIN 17 END BEGIN END ~SetGlobal("X#BIOEL1","LOCALS",1)~
ADD_TRANS_ACTION ~_BELDOT~ BEGIN 18 END BEGIN END ~SetGlobal("X#BIOEL2","LOCALS",1)~
ADD_TRANS_ACTION ~_BELDOT~ BEGIN 19 END BEGIN END ~SetGlobal("X#BIOEL3","LOCALS",1)~
ADD_TRANS_ACTION ~_BELDOT~ BEGIN 20 END BEGIN END ~SetGlobal("X#BIOEL4","LOCALS",1)~
ADD_TRANS_ACTION ~_BELDOT~ BEGIN 21 END BEGIN END ~SetGlobal("X#BIOEL5","LOCALS",1)~
ADD_TRANS_ACTION ~_BELDOT~ BEGIN 22 END BEGIN END ~SetGlobal("X#BIOEL6","LOCALS",1)~

REPLACE_STATE_TRIGGER ~_ELDOTJ~ 0 ~Global("EldothMove","GLOBAL",0) InParty("eldoth") AreaCheck("FW0100")~

REPLACE_STATE_TRIGGER ~_ELDOTH~ 8 ~Global("EldothMove","GLOBAL",0) InParty("eldoth") AreaCheck("FW0100")~

/* EDWIN */
ADD_STATE_TRIGGER ~_BEDWIN~ 3 ~Global("X#BIOED1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BEDWIN~ 14 ~Global("X#BIOED2","LOCALS",0)~

ADD_TRANS_ACTION ~_BEDWIN~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOED1","LOCALS",1)~
ADD_TRANS_ACTION ~_BEDWIN~ BEGIN 14 END BEGIN END ~SetGlobal("X#BIOED2","LOCALS",1)~


/* DYNAHEIR */
ADD_STATE_TRIGGER ~_BDYNAH~ 0 ~Global("X#BIODY1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 5 ~Global("X#BIODY2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 6 ~Global("X#BIODY3","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 7 ~Global("X#BIODY4","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 12 ~Global("X#BIODY5","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 15 ~Global("X#BIODY6","LOCALS",0)~
ADD_STATE_TRIGGER ~_BDYNAH~ 16 ~Global("X#BIODY7","LOCALS",0)~

ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIODY1","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIODY2","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIODY3","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIODY4","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 12 END BEGIN END ~SetGlobal("X#BIODY5","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 15 END BEGIN END ~SetGlobal("X#BIODY6","LOCALS",1)~
ADD_TRANS_ACTION ~_BDYNAH~ BEGIN 16 END BEGIN END ~SetGlobal("X#BIODY7","LOCALS",1)~

/* CORAN */
REPLACE_STATE_TRIGGER ~_BCORAN~ 0 ~InteractingWith("safana") RandomNum(9,1) Global("X#BIOCO1","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 1 ~InteractingWith("safana") RandomNum(9,2) Global("X#BIOCO2","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 2 ~InteractingWith("safana") RandomNum(9,3) Global("X#BIOCO3","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 3 ~InteractingWith("safana") RandomNum(9,4) Global("X#BIOCO4","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 4 ~InteractingWith("safana") RandomNum(9,5) Global("X#BIOCO5","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 5 ~InteractingWith("safana") RandomNum(9,6) Global("X#BIOCO6","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 6 ~InteractingWith("safana") RandomNum(9,7) Global("X#BIOCO7","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 7 ~InteractingWith("safana") RandomNum(9,8) Global("X#BIOCO8","LOCALS",0)~
REPLACE_STATE_TRIGGER ~_BCORAN~ 8 ~InteractingWith("safana") RandomNum(9,9) Global("X#BIOCO9","LOCALS",0)~

ADD_TRANS_ACTION ~_BCORAN~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOCO1","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOCO2","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOCO3","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOCO4","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 4 END BEGIN END ~SetGlobal("X#BIOCO5","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 5 END BEGIN END ~SetGlobal("X#BIOCO6","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 6 END BEGIN END ~SetGlobal("X#BIOCO7","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 7 END BEGIN END ~SetGlobal("X#BIOCO8","LOCALS",1)~
ADD_TRANS_ACTION ~_BCORAN~ BEGIN 8 END BEGIN END ~SetGlobal("X#BIOCO9","LOCALS",1)~

/* BRANWEN */
REPLACE_STATE_TRIGGER ~_BBRANW~ 2 ~InteractingWith("tiax") RandomNum(2,1) Global("X#BIOBR3","LOCALS",0)~

ADD_STATE_TRIGGER ~_BBRANW~ 0 ~Global("X#BIOBR1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BBRANW~ 1 ~Global("X#BIOBR2","LOCALS",0)~

ADD_TRANS_ACTION ~_BBRANW~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOBR1","LOCALS",1)~
ADD_TRANS_ACTION ~_BBRANW~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOBR2","LOCALS",1)~
ADD_TRANS_ACTION ~_BBRANW~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOBR3","LOCALS",1)~

/* AJANTIS */
ADD_STATE_TRIGGER ~_BAJANT~ 0 ~Global("X#BIOAJ1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BAJANT~ 1 ~Global("X#BIOAJ2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BAJANT~ 2 ~Global("X#BIOAJ3","LOCALS",0)~
ADD_STATE_TRIGGER ~_BAJANT~ 3 ~Global("X#BIOAJ4","LOCALS",0)~
ADD_STATE_TRIGGER ~_BAJANT~ 4 ~Global("X#BIOAJ5","LOCALS",0)~

ADD_TRANS_ACTION ~_BAJANT~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOAJ1","LOCALS",1)~
ADD_TRANS_ACTION ~_BAJANT~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOAJ2","LOCALS",1)~
ADD_TRANS_ACTION ~_BAJANT~ BEGIN 2 END BEGIN END ~SetGlobal("X#BIOAJ3","LOCALS",1)~
ADD_TRANS_ACTION ~_BAJANT~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOAJ4","LOCALS",1)~
ADD_TRANS_ACTION ~_BAJANT~ BEGIN 4 END BEGIN END ~SetGlobal("X#BIOAJ5","LOCALS",1)~

/* ALORA */
ADD_STATE_TRIGGER ~_BALORA~ 0 ~Global("X#BIOAL1","LOCALS",0)~
ADD_STATE_TRIGGER ~_BALORA~ 1 ~Global("X#BIOAL2","LOCALS",0)~
ADD_STATE_TRIGGER ~_BALORA~ 3 ~Global("X#BIOAL3","LOCALS",0)~
ADD_STATE_TRIGGER ~_BALORA~ 4 ~Global("X#BIOAL4","LOCALS",0)~

ADD_TRANS_ACTION ~_BALORA~ BEGIN 0 END BEGIN END ~SetGlobal("X#BIOAL1","LOCALS",1)~
ADD_TRANS_ACTION ~_BALORA~ BEGIN 1 END BEGIN END ~SetGlobal("X#BIOAL2","LOCALS",1)~
ADD_TRANS_ACTION ~_BALORA~ BEGIN 3 END BEGIN END ~SetGlobal("X#BIOAL3","LOCALS",1)~
ADD_TRANS_ACTION ~_BALORA~ BEGIN 4 END BEGIN END ~SetGlobal("X#BIOAL4","LOCALS",1)~

/* Patching "unhappiness" P-file entries */
ADD_TRANS_ACTION ~_YESLIP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_XZARP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_XZARP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_VICONP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_XANP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_TIAXP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_SKIEP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_SKIEP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_SHARTP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_SAFANP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_QUAYLP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_MONTAP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_MONTAP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_MINSCP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_MINSCP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_KIVANP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_KHALIP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_KHALIP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_KAGAIP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_JAHEIP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_JAHEIP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_IMOENP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_GARRIP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_ELDOTP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_ELDOTP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_EDWINP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_DYNAHP~ BEGIN 2 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_DYNAHP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_CORANP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_BRANWP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_ALORAP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_AJANTP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~
ADD_TRANS_ACTION ~_FALDOP~ BEGIN 3 END BEGIN END ~SetGlobal("IHATEYOUALL","LOCALS",0) ChangeAIScript("",DEFAULT)~

REPLACE_ACTION_TEXT ~_MINSC~ ~ActionOverride("jaheira",LeaveParty())[^!]*ActionOverride("jaheira",EscapeArea())~ ~ActionOverride("dynaheir",LeaveParty()) ActionOverride("dynaheir",EscapeArea())~