Jump to content

NextTriggerObject documentation not accurate


Recommended Posts

0x40E0 NextTriggerObject(O:Object*)
Defines the object that the next trigger will be evaluated in reference to. This trigger does not evaluate and does not count as a trigger in an OR() block. If the object cannot be found, the next trigger will evaluate to false. will cause the entire trigger to fail.  For example:

OR(2)
	!InParty(Player4)
	NextTriggerObject(Player4)
	!Global("MyGlobal","LOCALS",1)

Will not return true even though the first part (!InParty(Player4)) is true.  It'll cause the entire OR statement to fail

Link to comment

It works if you put it the last in trigger block.

gibberlings3.net/forums/topic/31466-looking-for-a-talked-to-such-and-such-condition/?tab=comments#comment-282595

Quote

 

TriggerOverride() doesn't work on objects not present in the active area. Worse, it doesn't return false either in such cases. And *worse yet*, it will even break OR() trigger if you put it in there as workaround, unless it goes the last in the entire condition section. From SoD's BDJAHEIR.D, this is how I managed to check that Jaheira is not inside of any Flaming Fist camps, without having to put dummy ff_camp region into each and every area:


IF ~IsValidForPartyDialog("khalid") OR(2) !Range("ff_camp",999) !TriggerOverride("ff_camp",IsOverMe("jaheira"))~

Changing the order of triggers would break it.

 

 

Link to comment

Are you two sure? Because the current description predicts this OR breakage in two ways.

Also:

TriggerOverride(who,action)

is just a weidu shorthand for

NextTriggerObject(who)
action()

So the way I see it, at most the last-placing with negation is a new corner case.

Link to comment

I spent the better part of the day working on this with @Bubb.  Unless, as @Ardanissaid, put it in the last block and fiddle with its placement, it will make the entire trigger block fail if you try to use on an object that doesn't exist in the area.  Also, if you need to have more than one checked ... just forget about it.  It won't happen.  It's best left to be used only if you're sure that object is in the area.

 

Link to comment

It's easier just to show the flaw in the trigger block evaluation code.

if (hasNextTriggerObjectOverride)
{
    if (nextTriggerObjectOverride != NULL)
    {
        // do eval stuff
        hasNextTriggerObjectOverride = false
    }
}
else
{
    // do eval stuff
}

NextTriggerObject sets both hasNextTriggerObjectOverride=true, and if it can't find a valid object, nextTriggerObjectOverride=NULL. Once this happens, the engine gets stuck in a bad state. Since nextTriggerObjectOverride is NULL it never clears hasNextTriggerObjectOverride, and it forever skips evaluating further triggers, (in the current trigger block).

Note though, while it's not evaluating the triggers, it is still running through all of them and doing janitorial actions. Meaning - every non-OR'd trigger still sets the whole block's result to false, the active OR count still ticks down - another NextTriggerOverride has the potential of fixing the deadlock, etc.

The only way a trigger block can still succeed after NextTriggerOverride breaks is:

  1. The NextTriggerOverride was in an OR block
  2. There are no subsequent triggers after the OR block
  3. A trigger in the OR block, that is positioned above the NextTriggerOverride, already evaluated to true

or, further in the same OR block, another NextTriggerOverride evaluates to a valid creature, and fixes the bad state. Once that happens, the trigger block will start evaluating normally again from that point onward. So, I suppose, one way to prevent NextTriggerOverride from breaking everything would be something like this:

IF
    OR(3)
        TriggerOverride(Player6,Global("B3WEIRD","LOCALS",1))
        TriggerOverride(Myself,False()) // This will fix the deadlock
        // Whatever trigger here
THEN

 

Link to comment

I can verify that putting in the fix after the local check will work.  I did the following and it worked brilliantly.  Thank you once again, @Bubb!

 

	OR(3)
		!IsValidForPartyDialogue(Player2)
		!TriggerOverride(Player2,Global("MYGLOBAL","LOCALS",1))
		TriggerOverride(Player1,False())
	OR(3)
		!IsValidForPartyDialogue(Player3)
		!TriggerOverride(Player3,Global("MYGLOBAL","LOCALS",1))
		TriggerOverride(Player1,False())
	OR(3)
		!IsValidForPartyDialogue(Player4)
		!TriggerOverride(Player4,Global("MYGLOBAL","LOCALS",1))
		TriggerOverride(Player1,False())
	OR(3)
		!IsValidForPartyDialogue(Player5)
		!TriggerOverride(Player5,Global("MYGLOBAL","LOCALS",1))
		TriggerOverride(Player1,False())
	OR(3)
		!IsValidForPartyDialogue(Player6)
		!TriggerOverride(Player6,Global("MYGLOBAL","LOCALS",1))
		TriggerOverride(Player1,False())

 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...