Baldur's Gate Wiki:Game source files/BCS/OHFGTK01

Line 0001
IF StateCheck(Myself,STATE_PANIC) THEN RESPONSE #100 RandomWalkContinuous END

Line 0008
IF !ActuallyInCombat Global("TimerSet","LOCALS",1) THEN RESPONSE #100 SetGlobal("TimerSet","LOCALS",0) END

Line 0016
IF ActuallyInCombat Global("TimerSet","LOCALS",0) THEN RESPONSE #100 SetGlobal("TimerSet","LOCALS",1) SetGlobalTimer("KENSAI_KIA","LOCALS",1) SetGlobalTimer("RAGE","LOCALS",1) SetGlobalTimer("STUNNING_BLOW","LOCALS",1) SetGlobalTimer("SWITCH_TARGET","LOCALS",1) SetGlobalTimer("BUFF","LOCALS",1) SetGlobalTimer("BLACKGUARD_POISON","LOCALS",1) Continue END

Line 0031
IF ActuallyInCombat !InWeaponRange(NearestEnemyOf(Myself)) !Range(NearestEnemyOf(Myself),15) THEN RESPONSE #100 EquipRanged Continue END

Line 0041
IF ActuallyInCombat OR(2) !HasWeaponEquiped(Myself) Range(NearestEnemyOf(Myself),15) THEN RESPONSE #100 EquipMostDamagingMelee Continue END

Line 0052
IF Global("TARGET_LOCK","LOCALS",1) HPLT(LastSeenBy(Myself),1) THEN RESPONSE #100 SetGlobal("TARGET_LOCK","LOCALS",0) END

Line 0060
IF TookDamage HPPercentLT(Myself,50) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #100 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) END

Line 0070
IF TookDamage HPPercentGT(Myself,49) HPPercentLT(Myself,60) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #50 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) RESPONSE #50 Continue END

Line 0083
IF TookDamage HPPercentGT(Myself,59) HPPercentLT(Myself,70) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #40 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) RESPONSE #60 Continue END

Line 0096
IF TookDamage HPPercentGT(Myself,69) HPPercentLT(Myself,80) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #30 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) RESPONSE #70 Continue END

Line 0109
IF TookDamage HPPercentGT(Myself,79) HPPercentLT(Myself,90) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #20 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) RESPONSE #80 Continue END

Line 0122
IF TookDamage HPPercentGT(Myself,89) HPPercentLT(Myself,100) GlobalTimerExpired("SWITCH_TARGET","LOCALS") THEN RESPONSE #10 AttackReevaluate(LastAttackerOf(Myself),75) SetGlobalTimer("SWITCH_TARGET","LOCALS",ONE_MINUTE) RESPONSE #90 Continue END

Line 0135
IF HaveSpellRES("spcl423") // Poison Weapon GlobalTimerExpired("BLACKGUARD_POISON","LOCALS") GlobalTimerExpired("BUFF","LOCALS") ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #100 SpellRES("spcl423",Myself) // Poison Weapon SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) SetGlobalTimer("BLACKGUARD_POISON","LOCALS",SIX_MINUTES) RESPONSE #20 Continue END

Line 0150
IF HaveSpellRES("spcl103") // Aura of Despair GlobalTimerExpired("BUFF","LOCALS") ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #40 SpellRES("spcl103",Myself) // Aura of Despair SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #60 Continue END

Line 0163
IF HaveSpell(BARBARIAN_RAGE) // SPCL152.SPL (Barbarian Rage) GlobalTimerExpired("RAGE","LOCALS") GlobalTimerExpired("BUFF","LOCALS") ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 Spell(Myself,BARBARIAN_RAGE) // SPCL152.SPL (Barbarian Rage) SetGlobalTimer("RAGE","LOCALS",FIVE_ROUNDS) SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0178
IF HaveSpell(CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) StateCheck(NearestEnemyOfType,STATE_INVISIBLE) ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 Spell(Myself,CLERIC_TRUE_SIGHT) // SPPR505.SPL (True Seeing) SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0191
IF HaveSpellRES("SPRA301") // Haste ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 SpellRES("SPRA301",Myself) // Haste SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0203
IF HaveSpellRES("SPRA303") // Protection From Normal Missiles TookDamage ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 SpellRES("SPRA303",Myself) // Protection From Normal Missiles SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0216
IF HaveSpellRES("SPRA302") // Minor Spell Deflection ActuallyInCombat Detect(NearestEnemyOf(Myself)) OR(4) See(NearestEnemyOfType([0.0.0.MAGE_ALL])) See(NearestEnemyOfType([0.0.0.SORCERER])) See(NearestEnemyOfType([0.0.0.DRUID_ALL])) See(NearestEnemyOfType([0.0.0.CLERIC_ALL])) THEN RESPONSE #80 SpellRES("SPRA302",Myself) // Minor Spell Deflection SetGlobalTimer("BUFF","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0233
IF HaveSpell(KENSAI_KIA) // SPCL144.SPL (Kai) GlobalTimerExpired("KENSAI_KIA","LOCALS") ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 Spell(Myself,KENSAI_KIA) // SPCL144.SPL (Kai) SetGlobalTimer("KENSAI_KIA","LOCALS",TWO_MINUTES) RESPONSE #20 Continue END

Line 0246
IF GlobalTimerExpired("STUNNING_BLOW","LOCALS") HaveSpell(MONK_STUNNING_BLOW) // SPCL811.SPL (Stunning Blow) ActuallyInCombat Detect(NearestEnemyOf(Myself)) THEN RESPONSE #80 Spell(Myself,MONK_STUNNING_BLOW) // SPCL811.SPL (Stunning Blow) SetGlobalTimer("STUNNING_BLOW","LOCALS",ONE_ROUND) RESPONSE #20 Continue END

Line 0259
IF Global("TARGET_LOCK","LOCALS",0) OR(3) See(StrongestOf(NearestEnemyOfType([0.0.0.FIGHTER_ALL]))) See(StrongestOf(NearestEnemyOfType([0.0.0.MONK]))) See(StrongestOf(NearestEnemyOfType([0.0.0.PALADIN_ALL]))) THEN RESPONSE #60 Attack(LastSeenBy(Myself)) SetGlobal("TARGET_LOCK","LOCALS",1) RESPONSE #40 Continue END

Line 0273
IF Global("TARGET_LOCK","LOCALS",0) OR(3) See(StrongestOf(NearestEnemyOfType([0.0.0.CLERIC_ALL]))) See(StrongestOf(NearestEnemyOfType([0.0.0.DRUID_ALL]))) See(StrongestOf(NearestEnemyOfType([0.0.0.THIEF_ALL]))) THEN RESPONSE #60 Attack(LastSeenBy(Myself)) SetGlobal("TARGET_LOCK","LOCALS",1) RESPONSE #40 Continue END

Line 0287
IF Global("TARGET_LOCK","LOCALS",0) OR(2) See(StrongestOf(NearestEnemyOfType([0.0.0.MAGE_ALL]))) See(StrongestOf(NearestEnemyOfType([0.0.0.SORCERER]))) THEN RESPONSE #60 Attack(LastSeenBy(Myself)) SetGlobal("TARGET_LOCK","LOCALS",1) RESPONSE #40 Continue END

Line 0300
IF Global("TARGET_LOCK","LOCALS",0) See(NearestEnemyOf(Myself)) THEN RESPONSE #100 Attack(LastSeenBy(Myself)) SetGlobal("TARGET_LOCK","LOCALS",1) END

Line 0309
IF HaveSpell(MONK_QUIVERING_PALM) // SPCL820.SPL (Quivering Palm) HPPercentLT(Myself,30) THEN RESPONSE #90 Spell(LastSeenBy(Myself),MONK_QUIVERING_PALM) // SPCL820.SPL (Quivering Palm) RESPONSE #10 Continue END

Line 0319
IF HaveSpell(CLERIC_DISPEL_MAGIC) // SPPR303.SPL (Dispel Magic) OR(2) HasBounceEffects(LastSeenBy(Myself)) HasImmunityEffects(LastSeenBy(Myself)) THEN RESPONSE #60 Spell(LastSeenBy(Myself),CLERIC_DISPEL_MAGIC) // SPPR303.SPL (Dispel Magic) RESPONSE #40 Continue END

Line 0331
IF Global("TARGET_LOCK","LOCALS",1) THEN RESPONSE #100 AttackReevaluate(LastSeenBy(Myself),75) END