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

is a Baldur's Gate AI script that is used by the twelve gnolls from the encounter with Drizzt Do'Urden at the Fisherman's Lake. It's an expansion of the standard gnoll script,, with additional features needed for the encounter. The Baldur's Gate: Enhanced Edition makes some changes to the code. The script is also present in the Baldur's Gate II code, but remains unused in that game and is not listed here.

Original game
IF Die THEN RESPONSE #100 IncrementGlobal("DrizztGnolls","GLOBAL",1) END

IF AttackedBy([PC],DEFAULT) Global("HelpDrizzt","GLOBAL",0) THEN RESPONSE #100 SetGlobal("HelpDrizzt","GLOBAL",1) END

IF Help([0.0.GNOLL]) THEN RESPONSE #0 Attack(LastAttackerOf(LastHelp(Myself))) END

IF AttackedBy([ANYONE],DEFAULT) MoraleLT(Myself,6) THEN RESPONSE #100 AttackOneRound(LastAttackerOf(Myself)) RunAwayFrom(LastAttackerOf(Myself),150) END

IF Delay(15) See(NearestEnemyOf(Myself)) Exists(LastAttackerOf(LastSeenBy(Myself))) NumCreatureGT([ENEMY],1) THEN RESPONSE #100 RandomWalk END

IF See("Drizzt") // Drizzt Global("DrizztFight","GLOBAL",1) THEN RESPONSE #100 Help Attack("Drizzt") // Drizzt END

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

Enhanced Edition
IF StateCheck(Myself,STATE_PANIC) THEN RESPONSE #100 RandomWalkContinuous END

IF StateCheck(Myself,STATE_REALLY_DEAD) THEN RESPONSE #100 IncrementGlobal("DrizztGnolls","GLOBAL",1) END

IF !StateCheck("Drizzt",STATE_REALLY_DEAD) // Drizzt AttackedBy([PC],DEFAULT) Global("HelpDrizzt","GLOBAL",0) THEN RESPONSE #100 SetGlobal("HelpDrizzt","GLOBAL",1) END

IF AttackedBy([ANYONE],DEFAULT) MoraleLT(Myself,6) THEN RESPONSE #100 AttackOneRound(LastAttackerOf(Myself)) RunAwayFromNoLeaveArea(LastAttackerOf(Myself),150) END

IF Delay(15) See(NearestEnemyOf(Myself)) Exists(LastAttackerOf(LastSeenBy(Myself))) NumCreatureGT([ENEMY],1) THEN RESPONSE #100 RandomWalk END

IF See("Drizzt") // Drizzt !StateCheck("Drizzt",STATE_REALLY_DEAD) // Drizzt Detect([GOODCUTOFF]) Global("DrizztFight","GLOBAL",1) THEN RESPONSE #100 Help Attack("Drizzt") // Drizzt END

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

Script
The script adds a counter to ensure, the encounter events will only continue after all twelve gnolls are dead. It sets a variable that's important for the dialogue with Drizzt. It causes the gnolls to attack Drizzt as soon as they see him, in the Enhanced Edition with the added check to do this only after having noticed a party member. It also adds some odd morale failure behavior, regarding the creatures' stats, that is fixed in the Enhanced Edition.