Issue with global variable increasing from multiple events.

  • Hello, so first time posting here, but I've just spent a good amount of time trying to figure out why a global variable in my code is increasing multiple times without being stopped by a condition that is supposed to prevent the actions happening until the variable reaches that value. To see what I mean, check the capx and run it in debug. The variable ChatStage should only go up by 1 with each message sent by clicking the A or B button. I hope the link works.

    drive.google.com/file/d/1i771IRvcgCwwPVjknGxpuEmlH2mFPSEo/view

  • Your events "On mouse clicked on ChoiceA" in all 6 groups are executed all at once, on one tick. Events are working from top to bottom, so after in Stage1 you incremented ChatStage variable, condition "ChatStage=2" in Stage2 group becomes true and is also executed, and so on.

  • Your events "On mouse clicked on ChoiceA" in all 6 groups are executed all at once, on one tick. Events are working from top to bottom, so after in Stage1 you incremented ChatStage variable, condition "ChatStage=2" in Stage2 group becomes true and is also executed, and so on.

    Yes I realize that is the issue. But I would imagine because I set a second condition for each click event to only activate when the variable chatstage is a certain number that it shouldn't do that. So how would I be able to fix or prevent it from executing them all at once? Have only been using Construct for about 2 months and this is a new obstacle for me.

  • You can add "Wait 0 seconds" seconds before changing the variable.

    Another option you can try is to reverse the order of groups - put group Stage6 on top, then Stage5 and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the suggestions, I think I found a slightly different solution by moving an action, but knowing these will be helpful.

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