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

  • 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:

    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

  • 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.

  • You have to manually track the state. Just set an instance variable that you've spawned the button, and add that to your conditions.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Ok, I have no idea if this is a good solution but it works for now

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

    Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)