Trigger Once and ELSE

Discussion and feedback on Construct 2

Post » Tue Feb 18, 2014 2:51 pm

Hi,

How do you use Trigger Once in conjonction of checking if an instance variable is TRUE do something, ELSE do something ?

Is that the way to do it ?

+ Condition
+ Trigger Once
     o Actions...
+ Else
+ Trigger Once
    o Actions...
     
Thanks!
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Feb 18, 2014 2:55 pm

http://www.scirra.com/forum/trigger-once-and-instances_topic86899.html
Maybe this could help you
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Tue Feb 18, 2014 2:58 pm

Interesting solution! the idea is to simulate the trigger once on an entity then.
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Feb 18, 2014 3:15 pm

Yes because trigger once is a system condition and it does not pick instances as I learned the hard way!
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Tue Feb 18, 2014 5:49 pm

Umm.. i don't know fully the problem you had but i know Trigger Once doesn't pick instances. all it do is actually trigger your actions once the conditions become true or false.

I tried another solution which seem to work (based on a post from Arima)

Pick Xyz where IsEnabled = 1
   Trigger Once
          (change animation)
Else
   Trigger Once
          (change animation)

This variation actually work very well too. Trigger Once can act alone cause no condition mean true basically.. so if it turn out to be true it won't be executed again. But i wonder if this is safer than..

Pick Xyz where IsEnabled <> 1
Trigger Once
     (change animation)

Pick Xyz where IsEnabled = 1
Trigger Once
     (change animation)

For sure both doesn't do the same thing but you know that IsEnabled can be TRUE or FALSE so an ELSE might not be needed in my case. I found ELSE to be useful in toggle scenario between 2 actions.Rushino2014-02-18 17:52:28
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Tue Feb 18, 2014 6:19 pm

Afterall the best solution was with a instance property. Pick is really different from ForEach. Sometime we are more looking for a ForEach than a Pick.Rushino2014-02-18 18:19:34
B
16
S
5
G
1
Posts: 190
Reputation: 2,489


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests