Jump to content

Photo

Brennan Risling script bug

brennan script hppercentlt

1 reply to this topic

#1 khelban12

khelban12
  • Members
  • 108 posts

Posted 27 November 2017 - 06:28 AM

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:
IF
	HPPercentLT(Myself,50)
	Global("Hurt","LOCALS",0)
	See([PC])
THEN
	RESPONSE #100
		Wait(2)
		StartDialogueNoSet([PC])
END
sevpat05.dlg contains the following:
Trigger:
HPPercentLT(Myself,50)
Global("Hurt","LOCALS",0)
Action:
SetGlobal("Hurt","LOCALS",1)
EscapeArea()
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.

1)
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.
Spoiler

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, 27 November 2017 - 06:30 AM.


#2 lynx

lynx
  • Modders
  • 3120 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 28 November 2017 - 01:24 PM

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?


GemRB - IE anywhere.
Mages needed! Looking for Planescape: Torment testers
Play android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored! Still looking for builders ...




Reply to this topic



  



Also tagged with one or more of these keywords: brennan, script, hppercentlt

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users