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

is Drizzt Do'Urden's AI script in Baldur's Gate. Among other things, it also handles the events during the encounter at the Fisherman's Lake, regarding the gnolls. Its functionality was greatly expanded in the Baldur's Gate: Enhanced Edition. Though this script, as well as Drizzt's original creature file are present in the code of Baldur's Gate II, the character encountered in that game uses different resources, thus it remains unlisted here.

Original game
IF See([PC]) NumberOfTimesTalkedTo(0) THEN RESPONSE #100 SetGlobal("DrizztFight","GLOBAL",1) Dialogue([PC]) END

IF AttackedBy([PC],DEFAULT) Allegiance(Myself,NEUTRAL) THEN RESPONSE #100 Enemy END

IF Allegiance(Myself,ENEMY) THEN RESPONSE #100 AttackReevaluate([GOODCUTOFF],15) END

IF See([0.0.GNOLL]) THEN RESPONSE #100 Attack([0.0.GNOLL]) END

IF See(NearestEnemyOf(Myself)) THEN RESPONSE #100 AttackReevaluate(NearestEnemyOf(Myself),15) END

Enhanced Edition
IF OnScreen(Myself) !Allegiance(Myself,ENEMY) NumTimesTalkedTo(0) THEN RESPONSE #100 SetGlobal("DrizztFight","GLOBAL",1) END

IF AttackedBy([PC],DEFAULT) Allegiance(Myself,NEUTRAL) THEN RESPONSE #100 Enemy END

IF HPPercentLT(Myself,50) Range(NearestEnemyOf(Myself),5) HaveSpell(CLERIC_CURE_MEDIUM_WOUNDS) // SPPR315.SPL (Cure Medium Wounds) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) RunAwayFrom(NearestEnemyOf(Myself),30) Spell(Myself,CLERIC_CURE_MEDIUM_WOUNDS) // SPPR315.SPL (Cure Medium Wounds) END

IF HPPercentLT(Myself,50) !Range(NearestEnemyOf(Myself),5) HaveSpell(CLERIC_CURE_MEDIUM_WOUNDS) // SPPR315.SPL (Cure Medium Wounds) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(Myself,CLERIC_CURE_MEDIUM_WOUNDS) // SPPR315.SPL (Cure Medium Wounds) END

IF Detect([GOODCUTOFF]) !See([GOODCUTOFF]) HaveSpell(CLERIC_INVISIBILITY_PURGE) // SPPR309.SPL (Invisibility Purge) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") !StateCheck(Myself,STATE_SILENCED) !CheckStatGT(Myself,75,SPELLFAILUREPRIEST) THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(Myself,CLERIC_INVISIBILITY_PURGE) // SPPR309.SPL (Invisibility Purge) END

IF Detect([GOODCUTOFF]) GlobalLT("OH_DRPREP","AR4200",1) THEN RESPONSE #100 ApplySpell(Myself,CLERIC_BLESS) // SPPR101.SPL (Bless) ApplySpell(Myself,CLERIC_ARMOR_OF_FAITH) // SPPR111.SPL (Armor of Faith) ApplySpell(Myself,CLERIC_RESIST_FIRE) // SPPR210.SPL (Resist Fire and Cold) RemoveSpell(CLERIC_BLESS) // SPPR101.SPL (Bless) RemoveSpell(CLERIC_ARMOR_OF_FAITH) // SPPR111.SPL (Armor of Faith) RemoveSpell(CLERIC_RESIST_FIRE) // SPPR210.SPL (Resist Fire and Cold) SetGlobal("OH_DRPREP","AR4200",1) END

IF Detect([GOODCUTOFF]) Range(NearestEnemyOf(Myself),30) !Range(NearestEnemyOf(Myself),3) HaveSpell(CLERIC_DISPEL_MAGIC) // SPPR303.SPL (Dispel Magic) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") !StateCheck(NearestEnemyOf(Myself),STATE_SILENCED) !StateCheck(NearestEnemyOf(Myself),STATE_STUNNED) !StateCheck(NearestEnemyOf(Myself),STATE_SLEEPING) OR(5) StateCheck(NearestEnemyOf(Myself),STATE_HASTED) StateCheck(NearestEnemyOf(Myself),STATE_BLESS) StateCheck(NearestEnemyOf(Myself),STATE_DRAWUPONHOLYMIGHT) CheckStatGT(NearestEnemyOf(Myself),0,IMPROVEDHASTE) CheckStatGT(NearestEnemyOf(Myself),0,STONESKINS) !StateCheck(Myself,STATE_SILENCED) !CheckStatGT(Myself,75,SPELLFAILUREPRIEST) RandomNumLT(4,3) THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(NearestEnemyOf(Myself),CLERIC_DISPEL_MAGIC) // SPPR303.SPL (Dispel Magic) END

IF Detect([GOODCUTOFF]) See(NearestEnemyOfType([0.ANIMAL])) HaveSpell(RANGER_CHARM_ANIMAL) // SPCL311.SPL (Charm Animal) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") RandomNumLT(5,4) THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(LastSeenBy(Myself),RANGER_CHARM_ANIMAL) // SPCL311.SPL (Charm Animal) END

IF Detect([GOODCUTOFF]) !Range([GOODCUTOFF],30) Allegiance(Myself,ENEMY) !StateCheck(Myself,STATE_INVISIBLE) !StateCheck(Myself,STATE_IMPROVEDINVISIBILITY) Delay(15) THEN RESPONSE #100 Hide END

IF Detect([GOODCUTOFF]) Range(NearestEnemyOfType([0.HUMANOID]),30) !Range(NearestEnemyOf(Myself),3) HaveSpell(CLERIC_CHARM_PERSON) // SPPR204.SPL (Charm Person or Mammal) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_HELPLESS) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_STUNNED) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_PANIC) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_BERSERK) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_SLEEPING) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_CHARMED) !StateCheck(NearestEnemyOfType([0.HUMANOID]),STATE_CONFUSED) !Race(NearestEnemyOfType([0.HUMANOID]),ELF) OR(2) !Class(NearestEnemyOfType([0.HUMANOID]),MONK) CheckStatLT(NearestEnemyOfType([0.HUMANOID]),9,LEVEL) !Kit(NearestEnemyOfType([0.HUMANOID]),INQUISITOR) !Kit(NearestEnemyOfType([0.HUMANOID]),CAVALIER) !HasBounceEffects(NearestEnemyOfType([0.HUMANOID])) !HasItemEquiped("helm06",NearestEnemyOfType([0.HUMANOID])) // Helmet of Charm Protection CheckStatLT(NearestEnemyOfType([0.HUMANOID]),50,RESISTMAGIC) CheckStatGT(NearestEnemyOfType([0.HUMANOID]),3,SAVEVSSPELL) !CheckStat(NearestEnemyOfType([0.HUMANOID]),1,OFFENSIVE_MODIFIER) !CheckStatGT(NearestEnemyOfType([0.HUMANOID]),0,MINORGLOBE) !StateCheck(Myself,STATE_SILENCED) !CheckStatGT(Myself,75,SPELLFAILUREPRIEST) RandomNumLT(6,4) THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(NearestEnemyOfType([0.HUMANOID]),CLERIC_CHARM_PERSON) // SPPR204.SPL (Charm Person or Mammal) END

IF Detect([GOODCUTOFF]) Range(NearestEnemyOf(Myself),30) !Range(NearestEnemyOf(Myself),15) HaveSpell(CLERIC_ENTANGLE) // SPPR105.SPL (Entangle) !GlobalTimerNotExpired("OH_TIMER_CNA","LOCALS") !StateCheck(LastSeenBy(Myself),STATE_SLEEPING) !StateCheck(LastSeenBy(Myself),STATE_HELPLESS) !StateCheck(Myself,STATE_SILENCED) !CheckStatGT(Myself,75,SPELLFAILUREPRIEST) !HasBounceEffects(LastSeenBy(Myself)) RandomNumLT(7,4) THEN RESPONSE #100 SetGlobalTimer("OH_TIMER_CNA","LOCALS",ONE_ROUND) Spell(LastSeenBy(Myself),CLERIC_ENTANGLE) // SPPR105.SPL (Entangle) END

IF See([0.0.GNOLL]) Detect([GOODCUTOFF]) THEN RESPONSE #100 Attack([0.0.GNOLL]) END

IF See(NearestEnemyOf(Myself)) Detect([GOODCUTOFF]) THEN RESPONSE #100 AttackReevaluate(NearestEnemyOf(Myself),15) END