What's the proper way to only show an alert once?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Razputin
Posts: 2
Joined: Sat May 25, 2024 2:29 pm

What's the proper way to only show an alert once?

Post by Razputin »

I have the following tree
asd.png
asd.png (172.93 KiB) Viewed 203 times
When the player first goes down this branch I would like to play an alert that says "New Quest..."
I would like this to only happen the first time they go down this tree.

What's the best way to ensure that it only happens the first time?

Here is what the "Quest Alert" node looks like at the moment.
daaa.png
daaa.png (34.83 KiB) Viewed 203 times
It seems like even though there's no dialog you still have to press the advance key to get past this "Quest Alert" node. Is there a way to just passthrough the node and execute the scripts in it without waiting for the continue button to be pressed. Or perhaps there's a cleaner way to do this entire thing.

Thanks!
User avatar
Tony Li
Posts: 20993
Joined: Thu Jul 18, 2013 1:27 pm

Re: What's the proper way to only show an alert once?

Post by Tony Li »

Hi,

There are two parts to this:

1. To pass through a node without showing any text or waiting for a continue button click, tick the node's Group checkbox or set its Sequence field to:

Code: Select all

Continue()
This will simulate an immediate continue button click. If you don't want to type it, from the "+" menu select Continue > Simulate Continue Button Click.

2. To show a node only once, set Conditions. I see that you've set Conditions on this node already, and it looks like those Conditions should work fine with #1 above. If you wanted to allow the player to reach some node more than once but only show the alert once, you could use an "if..then" statement in the Script field, such as:

Code: Select all

if (Variable["ShowedThisAlert"] ~= true) then
   Variable["Alert"] = "This is an alert"
   Variable["ShowedThisAlert"] = true
end
Razputin
Posts: 2
Joined: Sat May 25, 2024 2:29 pm

Re: What's the proper way to only show an alert once?

Post by Razputin »

That makes sense, thanks so much!
User avatar
Tony Li
Posts: 20993
Joined: Thu Jul 18, 2013 1:27 pm

Re: What's the proper way to only show an alert once?

Post by Tony Li »

Glad to help!
Post Reply