How do I get "Restart Layout" to only affect SOME things?

Get help using Construct 2

Post » Sun Feb 14, 2016 8:58 pm

I'm making a simple battle system in C2, and at the end of each turn I use "Restart Layout" to restart the turn. But while it doesn't RESET any variables, it "resets the value of all variables".

I'll try to make my issue easier to understand.

On "Attack Button" clicked
->Add 1 to "Attack Variable"

When "Attack Variable" = 1
->do the attack thingy


The problem I have is that, when the layout is restarted, it resets "Attack Variable" to 1 which "does the attack thingy" again, at the battle menu screen.

What do?
B
5
S
1
Posts: 73
Reputation: 521

Post » Sun Feb 14, 2016 9:07 pm

Reset global variables before restarting layout?
Or add an action to the - on layout start event to get everything te way you'd like?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Feb 14, 2016 9:22 pm

LittleStain wrote:Reset global variables before restarting layout?
Or add an action to the - on layout start event to get everything te way you'd like?


I've tried everything. I just need to reset the layout without "resetting" the values of the variables. After restarting the layout, all the values will stay the same, but will do whatever they do again.

If Attack = 1 means that an enemy will flash on screen for X seconds, then "Restart Layout" won't alter the actual value, but will act as if Attack has just been set to 1, therefore flashing the enemy. I need to find a way to stop the "Restart Layout" event from "redoing" the current values of some variables.
B
5
S
1
Posts: 73
Reputation: 521

Post » Sun Feb 14, 2016 9:27 pm

As explained in the manual, Global variables are NOT reset, so without seeing your events we can only guess why your actions are not triggered..

Restart layout
Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Feb 14, 2016 9:42 pm

LittleStain wrote:As explained in the manual, Global variables are NOT reset, so without seeing your events we can only guess why your actions are not triggered..

Restart layout
Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.


I've already been saying that I know that using "Restart Layout" DOESN'T reset the values of a variable. What I'm saying is this:

When Triggered
->Add 1 to "Variable"

When "Variable" = 1
-> Flash enemy on screen

Wait 1 second
->Restart Layout


My problem is that when the Layout is Restarted, "Variable" is indeed already set to 1, but when the Layout is Restarted, it acts as if "Variable" has JUST been set to 1, triggering the flashing enemy. My problem is that I don't want this to happen. I don't think you understood my problem before. I am not trying to reset any variables, all I want is for the Flash enemy event to NOT be triggered when the Layout is Restarted.
B
5
S
1
Posts: 73
Reputation: 521

Post » Sun Feb 14, 2016 9:50 pm

Well when the layout is restarted, the trigger once is ofcourse triggered, for it's the first time the condition is true..
If you don't want that to happen, just like always, you should add other conditions..

I guess I would change the whole setup and add the flashing action to the event that changes the variable in the first place..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Feb 14, 2016 9:58 pm

gomotion100 wrote:
LittleStain wrote:As explained in the manual, Global variables are NOT reset, so without seeing your events we can only guess why your actions are not triggered..

Restart layout
Restart the current layout. Note that unlike Go to layout, this action resets all event groups to their initial activation state. Global variables keep their current value - they are not reset. To reset them use the system action Reset global variables.


I've already been saying that I know that using "Restart Layout" DOESN'T reset the values of a variable. What I'm saying is this:

When Triggered
->Add 1 to "Variable"

When "Variable" = 1
-> Flash enemy on screen

Wait 1 second
->Restart Layout


My problem is that when the Layout is Restarted, "Variable" is indeed already set to 1, but when the Layout is Restarted, it acts as if "Variable" has JUST been set to 1, triggering the flashing enemy. My problem is that I don't want this to happen. I don't think you understood my problem before. I am not trying to reset any variables, all I want is for the Flash enemy event to NOT be triggered when the Layout is Restarted.


try Wait 1 second
->goto Layout[/i]
B
29
S
13
G
10
Posts: 355
Reputation: 8,327


Return to How do I....?

Who is online

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