How do I reset all global variables but one?

Get help using Construct 2

Post » Mon Mar 10, 2014 4:24 pm

Title says all.
I want to reset all the variables, with the exception of one.
Is there any possible way?
B
12
S
3
G
1
Posts: 80
Reputation: 2,109

Post » Mon Mar 10, 2014 5:03 pm

Declare a local variable before the loop/actions, set this local var to your global var, reset all globar var then set the one you want to keep with the local var ?
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Wed Mar 12, 2014 2:00 am

Sorry for this noob question but how do i declare a local variable? on righ click i can only create a global variable :(.
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Wed Mar 12, 2014 2:15 am

You don't need to reset all the variables.
Just use the set action and it would change the variable to what you want right before you need to access it.

That's all the advice I can offer.
B
9
S
3
G
1
Posts: 191
Reputation: 1,725

Post » Wed Mar 12, 2014 2:50 am

this game have all the variables reseted, how can i declare a local variable?
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Wed Mar 12, 2014 3:27 am

Create a global variable, and then drag the global variable into the event where you want the local variable. The icon will change from a world icon to a pin icon when it's done correctly. In the case of my example picture below you can also just right click on the group name and select add>add variable.

Here is a pic:
myVar.png
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Wed Mar 12, 2014 1:02 pm

Thanks a lot Shirokuma :)
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Wed Mar 12, 2014 1:29 pm

Also, if you are resetting all variables except one many times throughout your Event Sheet, you can just create a function that does it.
B
33
S
7
G
8
Posts: 312
Reputation: 8,528


Return to How do I....?

Who is online

Users browsing this forum: divsyntax, volumetv and 8 guests