[SOLVED] Baffled by behavior of two events

Discussion and feedback on Construct 2

Post » Thu Jun 20, 2013 4:14 am

EDIT/UPDATE: After a couple hours playing around with a dummy capx, I finally discovered my mistake. When checking the "PlayerSelecting" variable, I was using two events: one that ran on the condition that the variable returned "1" and a second event that ran on the condition that the variable returned "2". The error arose however, when in the first event, the variable was set to "2" in order to pass the turn, and after the first event ran the second event checked for "2" and since it was just set to that, it ran the event for player 2 immediately! I switched the second events condition to an "Else" statement and it works perfectly, just another case of over coding causing unintended events!

.Capx file: *REMOVED*

Context: I am making a basic game to help some friends playtest a board game they are making. The issue I am having is during a phase of the game where players draft their dice, the game is supposed to alternate between each player after a selection is made. Assuming the other player has enough points to draft at least one dice, the turn is supposed to shift after a selection is made.

The bug: The first player to pick is randomly chosen at the start of the layer, if player 2 is chosen first the event works as intended. But when it becomes player 1 turn, the turn will not shift until player 1 has reached the maximum point value. After player 1 has reached the maximum point value, the turn shifts to player 2 and when player 2 reaches maximum point value the dialog pops up prompting the start of the new layer as is intended.

Relevant lines: Line 19 starts the player 1 events, line 38 starts the player 2 events.

Intended flow:

1. Check PlayerSelecting variable for who's turn it is (1 is player one, 2 is player two).

2. Check if value of dice is <= DraftMode maximum value (15 for now).

3. Determine if the selected dice is a weapon or not, if it is then make sure the player does not already have a weapon.

4. Move correct dice to player area, determine the LowestDice value from the remaining dice.

5. Check if LowestDice value is <= Maximum value - Opponents current value total. If so pass the turn.

6. Else, if LowestDice is > Maximum value - your current value total, start the next game layer.

malphos2013-06-20 10:04:23
Posts: 3
Reputation: 206

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests