For Each loop with trigger once and every X seconds

Get help using Construct 2

Post » Sun Dec 28, 2014 10:59 pm

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.
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Sun Dec 28, 2014 11:10 pm

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..
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sun Dec 28, 2014 11:13 pm

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)?
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Mon Dec 29, 2014 1:37 pm

Is this what you want to achieve?
You do not have the required permissions to view the files attached to this post.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Mon Dec 29, 2014 5:13 pm

like i said it only applies to one of the loop , i wish to apply to all of the loops
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Mon Dec 29, 2014 6:34 pm

I'd say it's another case of bad usage of a for each loop. Is that what you wanted to do?
You do not have the required permissions to view the files attached to this post.
http://www.schizokoa.com we are a small game jam group, visit us!
B
25
S
6
G
1
Posts: 51
Reputation: 1,934

Post » Tue Dec 30, 2014 8:27 am

for loop is a must because i need it to retrieve expression for each instance
B
17
S
4
G
1
Posts: 203
Reputation: 1,583

Post » Tue Dec 30, 2014 8:51 am

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)
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Tue Dec 30, 2014 10:49 am

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.
B
17
S
4
G
1
Posts: 203
Reputation: 1,583


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 33 guests