The script GNOLLF.bcs handles AI behavior of gnolls.
The script as it appears in all games except the Baldur's Gate: Enhanced Edition, whether or not its expansion Siege of Dragonspear is installed.
IF AttackedBy([ANYONE],DEFAULT) THEN RESPONSE #100 AttackReevaluate(LastAttackerOf(Myself),45) END IF Delay(15) See(NearestEnemyOf(Myself)) Exists(LastAttackerOf(LastSeenBy(Myself))) NumCreatureGT([ENEMY],1) THEN RESPONSE #100 RandomWalk() END IF See(NearestEnemyOf(Myself)) THEN RESPONSE #100 Help() AttackReevaluate(NearestEnemyOf(Myself),45) END
Baldur's Gate: Enhanced Edition[]
IF StateCheck(Myself,STATE_PANIC) THEN RESPONSE #100 RandomWalkContinuous() END IF AttackedBy([ANYONE],DEFAULT) THEN RESPONSE #100 AttackReevaluate(LastAttackerOf(Myself),45) END IF Delay(15) See(NearestEnemyOf(Myself)) Exists(LastAttackerOf(LastSeenBy(Myself))) NumCreatureGT([ENEMY],1) THEN RESPONSE #100 RandomWalk() END IF See(NearestEnemyOf(Myself)) THEN RESPONSE #100 Help() AttackReevaluate(NearestEnemyOf(Myself),45) END