Hi there,
Some of you have already seen me fooling around in the discord channel. But as this requires quite some attention, I thought it would be better to make a seperate post on this matter.
To show you the issue, I first show what triggers I use and what variables are involved. I use GUI, I am an amateur user that's learning some things on the go.
I will pass each trigger one by one, paired with its variables. Thank you for reading, I hope you can help me out on this one, as I'm absolutely stuck.
In my 8-player auto-battler map, I have 8 spawning zones and 8 arena zones. Players prepare for duel by recruiting units. Then they fight a duel against another player.
-----
Trigger 1: the matchups | This trigger matches every player to a region. This functions well.
The first part of this trigger decides in which arena zone the player will fight. The seconds part is where you see ArenaminX/Y; this sets the coordinates to spawn the units in trigger 2.
Trigger 2: spawning units | This trigger spawns units from the spawning zone in the correct arena zone, with the exact same position, using X/Y offset. This trigger functions well.
What you see in this trigger is the following;
Every unit in a tempgroup is selected. Then, the offset of X and Y compared to the X/Y of their spawning zone is calculated using 2 custom script for each X and Y.
Lastly, the point is set to be equal to this X/Y position. Now the units spawn on this point.
Trigger 3: turning the unit's position | This trigger does very curious things that are a mystery to me, hear me out.
For each arena zone, there is a middle point X and Y which are set. This trigger;
1. picks the units in the arena zones using temppgroup like in the previous trigger.
2. calculates anew offset, the distance between the unit and the middle point of the zrena zone for both X and Y.
3. Sets a new TempPoint that alters the position. The setTempPoint action changes the X and Y, using a formula used for turning things 90degrees around a point (the middle point of the arena zone): X=Y & Y=-X. This is what you see in this action.
4. Units get moved.
When I test alone, everything works fine. My units change their position by 90 degrees, just as intended.
When I test with another player however, all player's units swap their position twice instead of once, chnaging the unit position by 180 degrees. To me, it seems like something is stacking its action where it should not. My big question is: why is this happening, and what can I do to solve this?
To fully fix this trigger, I need the units on arena 1,3,5 and 7 to change clockwise, where units in arena 2,4,6,8 need to change counterclockwise.
If you need more info before responding, please let me know.
Thanks, Kapharna
Some of you have already seen me fooling around in the discord channel. But as this requires quite some attention, I thought it would be better to make a seperate post on this matter.
To show you the issue, I first show what triggers I use and what variables are involved. I use GUI, I am an amateur user that's learning some things on the go.
I will pass each trigger one by one, paired with its variables. Thank you for reading, I hope you can help me out on this one, as I'm absolutely stuck.
In my 8-player auto-battler map, I have 8 spawning zones and 8 arena zones. Players prepare for duel by recruiting units. Then they fight a duel against another player.
-----
Trigger 1: the matchups | This trigger matches every player to a region. This functions well.
The first part of this trigger decides in which arena zone the player will fight. The seconds part is where you see ArenaminX/Y; this sets the coordinates to spawn the units in trigger 2.
Setup Arena Groups
-
Actions
-
-------- Reset these variables / Empty these player groups: --------
-
Set VariableSet AR_Counter = 0
-
Set VariableSet AR_Index = 1
-
Player Group - Remove all players from AR_RandomPlayers.
-
For each (Integer AR_Loop) from 1 to 4, do (Actions)
-
Loop - Actions
-
Player Group - Remove all players from AR_ArenaGroup[AR_Loop].
-
-
-
-------- --------
-
-------- Get a temporary reference to all of the active users: --------
-
Set VariableSet AR_RandomPlayers = (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing)).)
-
Set VariableSet AR_TotalPlayers = (Number of players in AR_RandomPlayers)
-
-------- --------
-
-------- Loop over the players and assign them an arena: --------
-
For each (Integer AR_Loop) from 1 to AR_TotalPlayers, do (Actions)
-
Loop - Actions
-
Set VariableSet AR_Counter = (AR_Counter + 1)
-
Set VariableSet AR_RandomPlayer = (Random player from AR_RandomPlayers)
-
Set VariableSet PN = (Player number of AR_RandomPlayer)
-
Player Group - Remove AR_RandomPlayer from AR_RandomPlayers.
-
Player Group - Add AR_RandomPlayer to AR_ArenaGroup[AR_Index]
-
-------- --------
-
-------- Player_ArenaIndex represents which AR_ArenaRegion the player will use: --------
-
Set VariableSet Player_ArenaIndex[PN] = AR_Loop
-
Set VariableSet Player_ArenaRegion[PN] = AR_ArenaRegion[AR_Loop]
-
Set VariableSet Player_ArenaPoint[PN] = AR_ArenaPoint[AR_Loop]
-
-------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
AR_Counter Equal to 2
-
-
Then - Actions
-
Set VariableSet AR_Counter = 0
-
Set VariableSet AR_Index = (AR_Index + 1)
-
-
Else - Actions
-
-
-
-
-------- Arena 1 --------
-
Set VariableSet ArenaRegion[1] = Arena1 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[1]] = 672.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[1]] = 3328.00
-
-------- Arena 2 --------
-
Set VariableSet ArenaRegion[2] = Arena2 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[2]] = 3392.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[2]] = 3328.00
-
-------- Arena 3 --------
-
Set VariableSet ArenaRegion[3] = Arena3 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[3]] = -576.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[3]] = 736.00
-
-------- Arena 4 --------
-
Set VariableSet ArenaRegion[4] = Arena4 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[4]] = 2112.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[4]] = 768.00
-
-------- Arena 5 --------
-
Set VariableSet ArenaRegion[5] = Arena5 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[5]] = -3136.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[5]] = -1792.00
-
-------- Arena 6 --------
-
Set VariableSet ArenaRegion[6] = Arena6 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[6]] = -448.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[6]] = -1792.00
-
-------- Arena 7 --------
-
Set VariableSet ArenaRegion[7] = Arena7 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[7]] = -4448.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[7]] = -4384.00
-
-------- Arena 8 --------
-
Set VariableSet ArenaRegion[8] = Arena8 <gen>
-
Set VariableSet ArenasMinX[Player_ArenaIndex[8]] = -1696.00
-
Set VariableSet ArenasMinY[Player_ArenaIndex[8]] = -4352.00
-
Trigger - Turn on Spawn <gen>
-
Trigger - Turn off (This trigger)
-
Trigger 2: spawning units | This trigger spawns units from the spawning zone in the correct arena zone, with the exact same position, using X/Y offset. This trigger functions well.
What you see in this trigger is the following;
Every unit in a tempgroup is selected. Then, the offset of X and Y compared to the X/Y of their spawning zone is calculated using 2 custom script for each X and Y.
Lastly, the point is set to be equal to this X/Y position. Now the units spawn on this point.
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Set VariableSet index = (Player number of (Picked player))
-
Set VariableSet tempgroup = (Units in SpawnRegion[index])
-
Unit Group - Pick every unit in tempgroup and do (Actions)
-
Loop - Actions
-
Custom script: set udg_XOffset = GetUnitX(GetEnumUnit()) - udg_SpawnsMinX[udg_index]
-
Custom script: set udg_YOffset = GetUnitY(GetEnumUnit()) - udg_SpawnsMinY[udg_index]
-
Set VariableSet tempPoint = (Point((ArenasMinX[index] + XOffset), (ArenasMinY[index] + YOffset)))
-
Unit - Create 1 (Unit-type of (Picked unit)) for (Player(index)) at tempPoint facing Default building facing degrees
-
Custom script: call RemoveLocation(udg_tempPoint)
-
-
-
Custom script: call DestroyGroup(udg_tempgroup)
-
-
Trigger 3: turning the unit's position | This trigger does very curious things that are a mystery to me, hear me out.
For each arena zone, there is a middle point X and Y which are set. This trigger;
1. picks the units in the arena zones using temppgroup like in the previous trigger.
2. calculates anew offset, the distance between the unit and the middle point of the zrena zone for both X and Y.
3. Sets a new TempPoint that alters the position. The setTempPoint action changes the X and Y, using a formula used for turning things 90degrees around a point (the middle point of the arena zone): X=Y & Y=-X. This is what you see in this action.
4. Units get moved.
When I test alone, everything works fine. My units change their position by 90 degrees, just as intended.
When I test with another player however, all player's units swap their position twice instead of once, chnaging the unit position by 180 degrees. To me, it seems like something is stacking its action where it should not. My big question is: why is this happening, and what can I do to solve this?
-
Actions
-
Player Group - Pick every player in (All players) and do (Actions)
-
Loop - Actions
-
Set VariableSet index = (Player number of (Picked player))
-
Set VariableSet tempgroup = (Units in ArenaRegion[index])
-
Unit Group - Pick every unit in tempgroup and do (Actions)
-
Loop - Actions
-
Custom script: set udg_MidXOffset = GetUnitX(GetEnumUnit()) - udg_MidArenaX[Player_ArenaIndex[index]]
-
Custom script: set udg_MidYOffset = GetUnitY(GetEnumUnit()) - udg_MidArenaY[Player_ArenaIndex[index]]
-
Set VariableSet tempPoint = (Point((MidArenaX[(Player number of (Picked player))] + MidYOffset), (MidArenaY[(Player number of (Picked player))] - MidXOffset)))
-
Unit - Move (Picked unit) instantly to tempPoint
-
Custom script: call RemoveLocation(udg_tempPoint)
-
-
-
Custom script: call DestroyGroup(udg_tempgroup)
-
-
-
To fully fix this trigger, I need the units on arena 1,3,5 and 7 to change clockwise, where units in arena 2,4,6,8 need to change counterclockwise.
If you need more info before responding, please let me know.
Thanks, Kapharna
Last edited: