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

0 favourites
  • 7 posts
  • 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?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Reset global variables before restarting layout?

    Or add an action to the - on layout start event to get everything te way you'd like?

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

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

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

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

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

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