It appears that the StartingConditional gets evaluated as soon as the ActionsTaken dialog branch is clicked, not when the Actions in the ActionsTaken have finished execution (even with an ActionPause/Resume Conversation wrapped around them). So the result of the StartingCondition is always FALSE.
Is there a way to defer evaluation of the StartingCondition until after Actions in the ActionsTaken have actually completed? Or am I missing something blindingly obvious …
Why do you need to delay 5.0 before setting the variable?
As to the actual question, no I don’t believe there is. You can end the dialog and automatically start it again after a delay (or rather one with just the next part in it).
I think you can also pause and resume the conversation, but in my experience that has been really fragile.
Thanks meaglyn - the ‘wait 5.0’ is just a simple example of what I want to do (i.e. I want to perform some Actions, then check a result based on the success of some of those Actions). And then check that result in the StartingCondition.
Pause and resume has no effect on when the Starting Condition gets executed, alas. Restarting the dialog is a good idea, but I’m not sure it will be suitable for the structure of the conversation, but will give it some thought, thanks.
I don’t see why ActionPauseConversation would not work (aside from its fragility). It does effect when the starting conditionals of the next node run because it pauses at the node that called it in action taken.
The example in the lexicon for ActionPauseConversation does more or less what you are doing.
I’m assuming your starting conditional is not on the same node as the action taken
Thanks meaglyn - I have some debug in the Starting Condition (which is on the NPC line of dialog following the PC’s Actions Taken script) and it appears in the console while the conversation is Paused. I’d love you try it if you have the time and inclination to see if you (or anyone) gets the same results…
I tend to avoid ActionWait as I’ve had similar issues with it (without entirely understanding why).
Why not stop the conversation, DelayCommand 5 seconds, then start a new one? Depending on the context, you might want to do the whole thing in cutscene mode, to prevent the player from breaking anything.
Thanks Proleric - ActionWait is just an example to simplify things, my real ‘use case’ is more complicated (and using other Actions, but not ActionWait). But the fundamental problem seems to be if a variable is getting set in an Action command, it’s value is not getting picked up by the StartingCondition script. Starting the conversation again or cutscene mode isn’t really an option as it’s going to be a widely used script across multiple NPC conversations.
From a bit more debug in the above code, all of the Actions get processed (added to the queue I guess) before StartingCondition is called, but they don’t get ‘executed’ before StartingCondition is called. So StartingCondition is determining the int to be its original value, not what it’s been changed to.
I suspect your results are due to the fact that action stacks (including conversations) are handled separately to script execution logic. In another thread so to speak. This means that your Actions Taken script calls all of its subroutines and terminates immediately making the conversation move forward to Starting Condition. NPC’s conversation is paused however for 5 seconds, which causes the game to wait that time before showing further dialogue. It already knows what to show you - it just doesn’t show it yet.
NWN really has no “halt script and wait for an event” function. It only has “do this part of script later”.
Another approach would be to add an intermediate node to the conversation. So you select a response, your ActionsTaken runs, and the dialog displays the NPC saying “…”, with your only choice being [Continue]. If you click [Continue] before the timer has elapsed, it sends you back to the same node. After the timer completes, you can proceed with the dialog.
Thanks NWShacker - I guess there’s no real way round this that suits my needs, it would be nice if ActionPauseConversation deferred execution of the StartingCondition or there was some other way to do that… but it doesn’t
And thanks sherincall - I think an intermediate node would work, I’ll give it some thought as to whether my OCD can live with a slightly unnecessary conversation node