Jump to content

Brennan Risling script bug


Recommended Posts

Greetings and congratulations to the team for the 0.8.5 release.


There is a bug that i see for some time now but as always i forget to report a bug until i see a release announcement :)


In the "Menkar Pebblecrusher" fight there is a thief NPC named Brennan Risling (sevpat05) who, if hurt sufficiently, leaves the area. So, in order for you to kill him, you have to hit him hard and kill him quickly before his script triggers.


sevpat05.bcs contains the following code:

sevpat05.dlg contains the following:

So, if he reaches less than 50% HP, he leaves. In the original engine, this works perfectly (though it seems to me that 50% is quite large and the party should never be able to kill him before the script triggers but maybe there is a delay). In GemRB, there is a weird behavior. The script triggers perfectly if you can't kill him quickly enough but it also triggers even when he is dead.



Steps to reproduce:

* Create a character (preferably a hard-hitting character like a fighter, paladin, archer ranger, etc)

* Escape Irenicus's Dungeon and in Waukeen's Promenade go to the upper floor of "Den of the Seven Vales" (AR0712 if you want to jump there)

* Trigger the fight

* Kill everyone else with ctrl+y and fight Brennan


Observed result:

Brennan dies and then his script triggers and he "escapearea"s so his loot is gone. Even killing him in one blow with the killsw01 or with ctrl+shift+y results in the script triggering.


Can anyone else reproduce this or is it a bug in my installation ?


2) If there is a bug in my installation, of course disregard my post. If not, can this be fixed ?

I found the HPPercentLT function in core/GameScript/Triggers.cpp. As always i blindly tried to find how to make it ignore dead people and found some code in another function.



diff --git a/gemrb/core/GameScript/Triggers.cpp b/gemrb/core/GameScript/Triggers.cpp
index 18345428f..5329ce4fe 100644
--- a/gemrb/core/GameScript/Triggers.cpp
+++ b/gemrb/core/GameScript/Triggers.cpp
@@ -2007,6 +2007,11 @@ int GameScript::HPPercentLT(Scriptable* Sender, Trigger* parameters)
 	if (!scr) {
 		return 0;
+	Actor *act = (Actor *) scr;
+	//don't allow dead, don't allow maze and similar effects
+	if (!act->ValidTarget(GA_NO_DEAD) || act->GetStat(IE_AVATARREMOVAL) != 0) {
+		return 0;
+	}
 	if (GetHPPercent( scr ) < parameters->int0Parameter) {
 		return 1;


If i modify HPPercentLT as shown above, then it works and doesn't trigger for dead Brennan but something else weird happens. If i don't kill him fast enough, then the script triggers, he says the dialog but does not escape and you continue fighting him until you kill him. So this isn't the correct solution.


Thank you for your time.

Edited by khelban12
Link to post

You're right, either HPPercent* or See shouldn't match for dead actors. The loot dumping would happen in the next tick IIRC, so that death script is problematic. The second case looks like something managed to interrupt him, but it needs further inspection. Is that behaviour consistently reproducible?

Link to post
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.


×   Your previous content has been restored.   Clear editor


  • Create New...