trigger once and instances

Get help using Construct 2

Post » Tue Feb 18, 2014 2:32 am

You need to add an instance variable to the entity you change the animation on

In sight> Do stuff + set variable to 1
Not In sight + Variable=1 > Do stuff, set variable to 0

This makes it when they are not in sight, that it checks for that variable, and if that variable is 1 (because it was set when they were in sight), then it does stuff and sets the variable to 0

Since the variable is 0 for that entity next tick, it does not trigger the not in sight actions again. This makes it so it leaves whatever you had set, set.


This is essentially how the Trigger Once condition works, except you're coding it in-engine for specific entities.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Tue Feb 18, 2014 9:20 am

@Thndr
you are a life saver!
so simple and yet I lost 2 days of my life with this.
sometimes you overthink I guess :p
I had tried your way before and failed but with your advice I felt confident that this is the right way to go so I experimented a little bit and here is the result for future reference for people who get stuck like me
https://www.dropbox.com/s/mx1vd1132no5va4/Screenshot%202014-02-18%2011.07.24.png
I owe you a beer!
Roccinio2014-02-18 09:26:54
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Wed Feb 19, 2014 1:57 am

Yeah I wasted like a day or so myself until I did that, trying to figure out how I went wrong since a function kept going off every tick and then suddenly it came to me, seemed backwards, but it works and I can't simplify it more so :D
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Previous

Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 22 guests