Help me with a patch?
Cerevant
Member Posts: 2,314
Ok, I'm a complete newb when it comes to modding, but I'm starting to feel my way around. I found the cause of a bug (GNOLL5 challenge in AR5200) and am trying to fix it, but the game isn't behaving as I would expect. Either I'm missing some detail, the Near Infinity doesn't work properly with BGEE, or some other mystery... Anyone able to prod me in the right direction?
So, the bug is that in the DLG it uses the Global GnollFightOver=1 when it wants to fight, but the BCS uses it to mean that the challenge is in progress. I decided to leave it as defined in the DLG, so that I wouldn't have to change GNOLL5A (companions). Here's what I've done so far:
GnollFIghtOver is undefined at the start of the encounter. I have the DLG set it to 0 when there is a challenge (new), 1 when there is a fight and 2 to indicate the challenge is over (last two were already there). I also changed the triggers for the end of the challenge to check for 0 instead of 1.
The source for the BCS is now:
IF
See([PC])
AttackedBy([GOODCUTOFF],DEFAULT)
Allegiance(Myself,NEUTRAL)
THEN
RESPONSE #100
SmallWait(5)
Enemy()
END
IF
See([PC])
NumTimesTalkedTo(0)
THEN
RESPONSE #100
Dialogue([PC])
END
IF
HPLT(Myself,20)
Global("GnollFightOver","GLOBAL",0)
THEN
RESPONSE #100
Dialogue([PC])
SetGlobal("GnollFightOver","GLOBAL",2)
EscapeArea()
END
IF
HPLT(StrongestOf,5)
Global("GnollFightOver","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("GnollFightOver","GLOBAL",1)
Dialogue([PC])
END
I think the first block covers the case where you initiate a fight outside the challenge. The second block initiates the first dialog. The third block is where it is failing:
I start the challenge
I start attacking
If I start a conversation with Ludrug, he has nothing to say
I confirm with CLUAConsole that GnollFightOver is 0
I continue to attack him until I do more than 10 damage (he has 30HP to begin with)
I move away and stop attacking
Ludrug follows and keeps attacking
I start a dialog with him, and he says I won, but does not award the XP, or set GnollFightOver to 2 (actions associated with that dialog option)
Ludrug keeps attacking
Thoughts? How can I execute a dialog option and have the actions not fire (there is no trigger for the action)?
So, the bug is that in the DLG it uses the Global GnollFightOver=1 when it wants to fight, but the BCS uses it to mean that the challenge is in progress. I decided to leave it as defined in the DLG, so that I wouldn't have to change GNOLL5A (companions). Here's what I've done so far:
GnollFIghtOver is undefined at the start of the encounter. I have the DLG set it to 0 when there is a challenge (new), 1 when there is a fight and 2 to indicate the challenge is over (last two were already there). I also changed the triggers for the end of the challenge to check for 0 instead of 1.
The source for the BCS is now:
IF
See([PC])
AttackedBy([GOODCUTOFF],DEFAULT)
Allegiance(Myself,NEUTRAL)
THEN
RESPONSE #100
SmallWait(5)
Enemy()
END
IF
See([PC])
NumTimesTalkedTo(0)
THEN
RESPONSE #100
Dialogue([PC])
END
IF
HPLT(Myself,20)
Global("GnollFightOver","GLOBAL",0)
THEN
RESPONSE #100
Dialogue([PC])
SetGlobal("GnollFightOver","GLOBAL",2)
EscapeArea()
END
IF
HPLT(StrongestOf,5)
Global("GnollFightOver","GLOBAL",0)
THEN
RESPONSE #100
SetGlobal("GnollFightOver","GLOBAL",1)
Dialogue([PC])
END
I think the first block covers the case where you initiate a fight outside the challenge. The second block initiates the first dialog. The third block is where it is failing:
I start the challenge
I start attacking
If I start a conversation with Ludrug, he has nothing to say
I confirm with CLUAConsole that GnollFightOver is 0
I continue to attack him until I do more than 10 damage (he has 30HP to begin with)
I move away and stop attacking
Ludrug follows and keeps attacking
I start a dialog with him, and he says I won, but does not award the XP, or set GnollFightOver to 2 (actions associated with that dialog option)
Ludrug keeps attacking
Thoughts? How can I execute a dialog option and have the actions not fire (there is no trigger for the action)?
0
Comments
Could the first or second block be testing true in some way as to prevent the third block from being tested or applied correctly? I'm not solid on how the allegiance line works, might it not actually be testing differently even after enemy()?
The DLG was starting the challenge combat with Attack() - two problems with that. First, Attack() stops evaluating the script until the target is dead. The other problem is that calling AttackReevaluate() from a DLG doesn't do anything.
I got it to work by setting the state variables in the script, and putting the attack code in the BCS. Voila!
One more thing I want to figure out - If you get lucky, you can do more than 20 points of damage and kill him before his script can respond. Anyone have an example of a death-override script? (target is reduced to 0 hit points, but is still alive)
You could work around the issue with a combination of opcodes 0x127 and 0x020.
0x127 Disables most forms of permanent death (such as chunking), though they will still die at 0 hp.
0x020 Is just "Cure Death" and raises the target, but should do it without animation.
That should result in him falling dead then appearing to just stand back up, implying that he was badly hurt and knocked down but not actually killed.
https://docs.google.com/open?id=0BwOwEmwBQcTWQUVBYUQ1LXFVUEE
Obligatory Edit:
minhp1 also adds protection from Confusion, Poison, Stun, Sleep, Held, Imprisonment and so on... so maybe this is not the way to go...