How do I loop an event until x condition is met?

0 favourites
  • 4 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • Hey experts. In the game I'm building, you can build a mine or oil pump. Currently if the block already has a mine or oil pump built (instance variable = 1), then the player is prompted with a warning that a structure already exists, would they like to replace existing structure (yes and no buttons appear).

    If they select no, menus/buttons become invisible and they play on. However I'm struggling on the "yes" portion. If they select oil pump, get the warning and select "yes", the instance variable = 0 but I can't get the oil pump to be built unless they select the oil pump again.

    How do I program it so if they select the structure, select yes on replacing existing structure that they don't have to select the build option again?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When they select the unit to spawn you can store that as a variable. When they select Yes you have conditions against that variable to spawn the correct unit, you'll also need to use the store block ID again to spawn it on the right block.

  • When they select the unit to spawn you can store that as a variable. When they select Yes you have conditions against that variable to spawn the correct unit, you'll also need to use the store block ID again to spawn it on the right block.

    I appreciate your time/insight. If you can think of a tutorial that would help me with that process, I will gladly do the legwork of researching and studying it. I get the theory but not the execution.

  • Looks like you've already done most of it though? When you shared events you did miss out some important ones such as open build menu function which I assume just displays possible units to build. Also the click on build unit logic for when the variable is equal to 1 is missing but I assume this prompts the Yes or No options. Also we can't see the event for when you select Yes and No and what happens but I assume when you press No it destroys/closes everything. When you press Yes you use the same check event but where variable = 1, then you destroy the current unit overlapping it and spawn the new one (stored as variable).

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