For Each loop with trigger once and every X seconds

  • In the For Each loop,trigger once while true only affected the first loop. I need to apply trigger once to all loop.(As in normal user view, trigger once is expected to apply to all loops) My event must contain For Each and Trigger Once. Same problem goes to every X seconds. Just replace Trigger once to Every X seconds condition.

  • I cannot see this capx, as I am not on a computer right now, but I recall that having trigger once after a loop breaks it (since, well, the trigger once only let the first looping pass), however having the trigger once first should not make this happen IIRC. However if it is the way I think it is done, the evry X seconds issue is actually pretty weird..

  • The problem is the first loop stop while all the other loops keep going

    But how to make it so that the trigger once would affect all loop(without using variables)?

  • Is this what you want to achieve?

  • like i said it only applies to one of the loop , i wish to apply to all of the loops

  • I'd say it's another case of bad usage of a for each loop. Is that what you wanted to do?

  • for loop is a must because i need it to retrieve expression for each instance

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have had this problem before too. Worst-case scenario if "trigger once" used with "For Each" still fails to work like you intended it to , use a "switch" instance variable.

    instance var called "WhateverYouAreChecking", initial value = "No"

    Add this condition to your event

    WhateverYouAreChecking = "No"

    add this action to your event

    Set WhateverYouAreChecking = "Yes"

    You can use boolean or number instead of text-type

    That will act similar to how a "trigger once" used with "for each" should theoretically act.

    Yes, you wasted memory by using another variable, but hey, as long as you got what you wanted to work, it's ok. I did the same before (similar problem with trigger once and for each)

  • Just want to know if it is a bug so i can report it

    Also, there is a problem when using For loop before Else. Both For loop and Else event will run together. If this is also a bug, i will report it at once.

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