Trigger Once in a Layout When True the first time only

Get help using Construct 2

Post » Fri Sep 11, 2015 2:36 pm

hey all,

Trying to trigger a Once While True only the first time something happens, and then never again for that layout.

Other than setting a flag variable is there a better way to do this?

PlayerHealth < 10
NoAudioIsPlaying = true
Trigger Once While True
----------------PlayAudio "Blue wizard is about to die.."


Since the NoAudioIsPlaying variable changes throughout the layout the only way I see to make this happen once is to make yet another variable "PlayOnce"

PlayerHealth < 10
NoAudioIsPlaying = true
PlayOnce = 0
Trigger Once While True
----------------PlayAudio "Blue wizard is about to die.."
----------------PlayOnce set to 1


I only ask because I have a whole mess of these conditions (and I'd have to create a unique flag for each) that I only want to happen once in a layout.. was wondering if there was a cleaner way...

thanks...
Last edited by jobel on Fri Sep 11, 2015 3:37 pm, edited 1 time in total.
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Sep 11, 2015 3:00 pm

You don't need the "Trigger Once" in the second case. You dealt with it yourself.
ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

Post » Fri Sep 11, 2015 3:39 pm

ah right.. yes.. so I guess in the case of a true Trigger ONLY Once, you have to set it up yourself?
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Sep 11, 2015 3:41 pm

unless your only condition is Trigger Once, but then it triggers right away...without a condition

or the only other way is that your condition can never be untrue, and then true again...
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Sep 11, 2015 11:40 pm

I had to use an external flag to do this. You could try using a global variable defaulted to 1, and set it to 0. Then have the event conditioned on if flag == 1.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857


Return to How do I....?

Who is online

Users browsing this forum: dop2000, max2612 and 20 guests