[SOLVED]How do I "trigger once while true" for each instance

Get help using Construct 2

Post » Tue Jul 04, 2017 2:00 pm

Hi,
first of all here is what I try to solve:
- "build_res_th" is a building which generates a resource like gold or something
- it has an instance var "res_count" which counts up every second
- when it reaches 3 or more, then there should spawn a button "btn_ok" at "build_res_th" to collect the gold.

Here it works only for the first instance:
Image

Further instances of "build_res_th" spawn a "btn_ok" very tick and not only once. Why this is not working?
Or do you have another idea to solve this?

Thanks for your help!
Alex
Last edited by Buggi on Tue Jul 04, 2017 3:38 pm, edited 1 time in total.
B
3
Posts: 8
Reputation: 191

Post » Tue Jul 04, 2017 2:09 pm

The condition is always true and it goes into a never ending loop, make it as a function and call the function every 1 sec or something like that.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,367

Post » Tue Jul 04, 2017 2:30 pm

You have to manually track the state. Just set an instance variable that you've spawned the button, and add that to your conditions.
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Tue Jul 04, 2017 2:49 pm

Ok, I have no idea if this is a good solution but it works for now :D
Image

I added a instant var "res_collectable" to check the state

Thank you!
B
3
Posts: 8
Reputation: 191


Return to How do I....?

Who is online

Users browsing this forum: jorgmaquoi, senecaa and 16 guests