• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] Trigger Only working for player 1

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2012
Messages
204
Hey Guys...

I just made a simple setup system for my map and for some reason the system only works for Player 1.

I narrowed it down to one point: the Trigger doesnt delete the Game Settings Unit for anyone except player 1. Because the next step checks if there are Game Setting Units it doesnt continue and the Game gets stuck. I tried everything i could think of and set like a thousand debug messages...

The Array for saving the Setup units works fine and gets setup properly.
The counter for how many Upgrades have been made by a player seems to work.
None of the conditions blocks the trigger (well... then it wouldnt work for pl1 as well)

Any Ideas?

The Start Player Setup (sets the Setup Unit array):
  • player start setup
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in Team_Groups[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
              • ((Picked player) controller) Equal to User
            • Then - Actions
              • Set temp_point = ((Picked player) start location)
              • Unit - Create 1 Game Settings for (Picked player) at temp_point facing Default building facing degrees
              • Set Gamesetter_array[(Player number of (Picked player))] = (Last created unit)
              • Custom script: call RemoveLocation (udg_temp_point)
              • Set Player_Nr = (Player_Nr - 1.00)
              • Player - Set (Picked player) Current gold to 50
              • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Team 1 <gen>
              • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across HeroT2 <gen>
            • Else - Actions
      • Player Group - Pick every player in Team_Groups[2] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
              • ((Picked player) controller) Equal to User
            • Then - Actions
              • Set temp_point = ((Picked player) start location)
              • Unit - Create 1 Game Settings for (Picked player) at temp_point facing Default building facing degrees
              • Set Gamesetter_array[(Player number of (Picked player))] = (Last created unit)
              • Custom script: call RemoveLocation (udg_temp_point)
              • Set Player_Nr = (Player_Nr - 1.00)
              • Player - Set (Picked player) Current gold to 50
              • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across Team 2 <gen>
              • Visibility - Create an initially Enabled visibility modifier for (Picked player) emitting Visibility across HeroT1 <gen>
            • Else - Actions
      • Custom script: call DestroyTrigger( GetTriggeringTrigger() )
The actual Game Setup Trigger:
  • Game Settings
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Entering unit)) Equal to Consecutive Waves
          • (Unit-type of (Entering unit)) Equal to Single Waves (standard)
          • (Unit-type of (Entering unit)) Equal to Single Lanes (standard)
          • (Unit-type of (Entering unit)) Equal to Team Lanes
          • (Unit-type of (Entering unit)) Equal to Long Game
          • (Unit-type of (Entering unit)) Equal to Medium Game
          • (Unit-type of (Entering unit)) Equal to Short Game (standard)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Single Lanes (standard)
        • Then - Actions
          • Player - Make Team Lanes Unavailable for training/construction by (Owner of (Entering unit))
          • Player - Make Single Lanes (standard) Unavailable for training/construction by (Owner of (Entering unit))
          • Set Lanevote[1] = (Lanevote[1] + 1)
          • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
          • Unit - Remove (Entering unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Entering unit)) Equal to Team Lanes
            • Then - Actions
              • Player - Make Team Lanes Unavailable for training/construction by (Owner of (Entering unit))
              • Player - Make Single Lanes (standard) Unavailable for training/construction by (Owner of (Entering unit))
              • Set Lanevote[2] = (Lanevote[2] + 1)
              • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
              • Unit - Remove (Entering unit) from the game
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Single Waves (standard)
        • Then - Actions
          • Player - Make Consecutive Waves Unavailable for training/construction by (Owner of (Entering unit))
          • Player - Make Single Waves (standard) Unavailable for training/construction by (Owner of (Entering unit))
          • Set Wavevote[1] = (Wavevote[1] + 1)
          • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
          • Unit - Remove (Entering unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Entering unit)) Equal to Consecutive Waves
            • Then - Actions
              • Player - Make Consecutive Waves Unavailable for training/construction by (Owner of (Entering unit))
              • Player - Make Single Waves (standard) Unavailable for training/construction by (Owner of (Entering unit))
              • Set Wavevote[2] = (Wavevote[2] + 1)
              • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
              • Unit - Remove (Entering unit) from the game
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Entering unit)) Equal to Short Game (standard)
        • Then - Actions
          • Player - Make Long Game Unavailable for training/construction by (Owner of (Entering unit))
          • Player - Make Medium Game Unavailable for training/construction by (Owner of (Entering unit))
          • Player - Make Short Game (standard) Unavailable for training/construction by (Owner of (Entering unit))
          • Set Length_Vote[1] = (Length_Vote[1] + 1)
          • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
          • Unit - Remove (Entering unit) from the game
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Entering unit)) Equal to Medium Game
            • Then - Actions
              • Player - Make Long Game Unavailable for training/construction by (Owner of (Entering unit))
              • Player - Make Medium Game Unavailable for training/construction by (Owner of (Entering unit))
              • Player - Make Short Game (standard) Unavailable for training/construction by (Owner of (Entering unit))
              • Set Length_Vote[2] = (Length_Vote[2] + 1)
              • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
              • Unit - Remove (Entering unit) from the game
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Entering unit)) Equal to Long Game
                • Then - Actions
                  • Player - Make Long Game Unavailable for training/construction by (Owner of (Entering unit))
                  • Player - Make Medium Game Unavailable for training/construction by (Owner of (Entering unit))
                  • Player - Make Short Game (standard) Unavailable for training/construction by (Owner of (Entering unit))
                  • Set Length_Vote[3] = (Length_Vote[3] + 1)
                  • Set Setting_Count_Array[(Player number of (Owner of (Entering unit)))] = (Setting_Count_Array[(Player number of (Owner of (Entering unit)))] + 1)
                  • Unit - Remove (Entering unit) from the game
                • Else - Actions
      • Wait 0.50 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Setting_Count_Array[(Player number of (Owner of (Entering unit)))] Greater than or equal to 3
        • Then - Actions
          • Unit - Remove Gamesetter_array[(Player number of (Owner of (Entering unit)))] from the game
        • Else - Actions
      • Wait 0.50 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in (Units of type Game Settings)) Equal to 0
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Lanevote[2] Greater than Lanevote[1]
            • Then - Actions
              • Game - Display to (All players) the text: Team Lanes Chosen!
              • Set Spawn_array[1] = Lane 2T1 <gen>
              • Set Spawn_array[2] = Lane 2T1 <gen>
              • Set Spawn_array[3] = Lane 3T1 <gen>
              • Set Spawn_array[4] = Lane 3T1 <gen>
              • Set Spawn_array[5] = Lane 2T2 <gen>
              • Set Spawn_array[6] = Lane 2T2 <gen>
              • Set Spawn_array[7] = Lane 3T2 <gen>
              • Set Spawn_array[8] = Lane 3T2 <gen>
            • Else - Actions
              • Game - Display to (All players) the text: Single Lanes Chosen!
              • Set Spawn_array[1] = Lane 1T1 <gen>
              • Set Spawn_array[2] = Lane 2T1 <gen>
              • Set Spawn_array[3] = Lane 3T1 <gen>
              • Set Spawn_array[4] = Lane 4T1 <gen>
              • Set Spawn_array[5] = Lane 1T2 <gen>
              • Set Spawn_array[6] = Lane 2T2 <gen>
              • Set Spawn_array[7] = Lane 3T2 <gen>
              • Set Spawn_array[8] = Lane 4T2 <gen>
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Wavevote[2] Greater than Wavevote[1]
            • Then - Actions
              • Game - Display to (All players) the text: Consecutive Waves C...
              • Trigger - Turn off Wave 1 <gen>
              • Trigger - Turn off Wave 2 <gen>
              • Trigger - Turn off Wave 3 <gen>
              • Trigger - Turn off Wave 4 <gen>
              • Trigger - Turn off Wave End Gen <gen>
              • Trigger - Turn off Lane Clear <gen>
              • Trigger - Turn on Wave 1 Consec <gen>
              • Trigger - Turn on Wave 2 Consec <gen>
              • Trigger - Turn on Wave 3 Consec <gen>
              • Trigger - Turn on Wave 4 Consec <gen>
              • Trigger - Turn on Wave End Gen Consec <gen>
              • Trigger - Turn on Lane Clear Consec <gen>
            • Else - Actions
              • Game - Display to (All players) the text: Single Waves Chosen!
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • Length_Vote[1] Greater than Length_Vote[2]
                  • Length_Vote[1] Greater than Length_Vote[3]
            • Then - Actions
              • Game - Display to (All players) the text: Short Game Chosen!
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Length_Vote[2] Greater than Length_Vote[1]
                      • Length_Vote[2] Greater than Length_Vote[3]
                • Then - Actions
                  • Game - Display to (All players) the text: Medium Game Chosen!
                  • Unit - Add Medium Game to Paladin 0114 <gen>
                  • Unit - Add Medium Game to Death Knight 0115 <gen>
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • And - All (Conditions) are true
                        • Conditions
                          • Length_Vote[3] Greater than Length_Vote[2]
                          • Length_Vote[3] Greater than Length_Vote[1]
                    • Then - Actions
                      • Game - Display to (All players) the text: Long Game Chosen!
                      • Unit - Add Long Game to Paladin 0114 <gen>
                      • Unit - Add Long Game to Death Knight 0115 <gen>
                    • Else - Actions
          • Player Group - Pick every player in Team_Groups[1] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked player) slot status) Equal to Is playing
                  • ((Picked player) controller) Equal to User
                • Then - Actions
                  • Set temp_point = ((Picked player) start location)
                  • Unit - Create 1 Race Choose T1 for (Picked player) at temp_point facing Default building facing degrees
                  • Special Effect - Create a special effect at temp_point using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Custom script: call RemoveLocation (udg_temp_point)
                  • Wait 0.10 seconds
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
          • Player Group - Pick every player in Team_Groups[2] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked player) slot status) Equal to Is playing
                  • ((Picked player) controller) Equal to User
                • Then - Actions
                  • Set temp_point = ((Picked player) start location)
                  • Unit - Create 1 Race Choose T2 for (Picked player) at temp_point facing Default building facing degrees
                  • Special Effect - Create a special effect at temp_point using Abilities\Spells\Demon\DarkPortal\DarkPortalTarget.mdl
                  • Custom script: call RemoveLocation (udg_temp_point)
                  • Wait 0.10 seconds
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
        • Else - Actions
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
I will just put in some random information you might not know.
All players: against the description, which says "includes neutral and unused player slots" it only picks used player slots.
Position of Player start location only works for used player slots.
Before you can set a value to a unit group the unit group must have been created. If you an array only as many unit groups are created as you have set the array size.
This is probably the same for player groups, but I have not tested it yet.

Second trigger:
You should make a temporary player-variable and save Owner of Entering unit to it.
You are using this function so often, so this would make it more efficient (not important in this kind of trigger though) and would make it faster to make the trigger.

Probably solution:
wait
owner of entering unit

after the wait you cannot access entering unit anymore
you should get rid of all the waits
 
Level 7
Joined
Sep 19, 2012
Messages
204
Before you can set a value to a unit group the unit group must have been created. If you an array only as many unit groups are created as you have set the array size.

not sure if it is me being awake for over 24 hours, but i dont get what youre trying to say ^^

The rest i will do right now....maybe it works.



OT: There he is again :p
How did you manage not to be awarded for being the Trigger Jesus? :D
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
not sure if it is me being awake for over 24 hours, but i dont get what youre trying to say ^^

variable editor:

MyGroup[3]

creates 3 empty groups: MyGroup[0],MyGroup[1],MyGroup[2]
MyGroup[3] was not created so you cannot add units to it.

What I said above is not completely correct though. You can set a value to MyGroup[3], but you cannot add units to it.

Not possible, if MyGroup[3] was not created before:
  • Unit Group - Add (Triggering unit) to MyGroup[3]
Possible, if MyGroup[3] was not created before:
  • Set MyGroup[3] = (Units in (Playable map area))

Anyways, I think avoiding the waits should solve some problems.

OT: There he is again :p
How did you manage not to be awarded for being the Trigger Jesus? :D
Trigger Jesus? :D
 
Level 7
Joined
Sep 19, 2012
Messages
204
variable editor:

MyGroup[3]

creates 3 empty groups: MyGroup[0],MyGroup[1],MyGroup[2]
MyGroup[3] was not created so you cannot add units to it.

What I said above is not completely correct though. You can set a value to MyGroup[3], but you cannot add units to it.

Not possible, if MyGroup[3] was not created before:
  • Unit Group - Add (Triggering unit) to MyGroup[3]
Possible, if MyGroup[3] was not created before:
  • Set MyGroup[3] = (Units in (Playable map area))

Anyways, I think avoiding the waits should solve some problems.


Trigger Jesus? :D

Yeah you were absolutely right. The waits werent the problem (the second one is needed or it wont work) but setting a temp player did the job. Thx again!

Trigger Jesus: You put a hand on it and it magically starts to work ;)
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
I think the second wait is ok, as you no longer use entering unit after that. But the first wait is still bad, because your variable can be overriden if a new unit enters the map within the 0.5 seconds. This means that the gamesetter unit of the first player will not be removed, if another player triggers the trigger within 0.5 seconds.
I think the first wait is not needed.

Why do you need the second wait? Does it take some time before (Number of units in (Units of type Game Settings)) gets reduced?
I think you could keep track of the ampunt of game setter units with a variable. Then you could avoid the wait.

(Number of units in (Units of type Game Settings)) Equal to 0 leaks. It's a unit group and it uses "units of type". "units of type" always leaks so you should use "units in playable map matching unit type is Game Settings" and store it to a variable and destroy it later.
 
Level 7
Joined
Sep 19, 2012
Messages
204
I think the second wait is ok, as you no longer use entering unit after that. But the first wait is still bad, because your variable can be overriden if a new unit enters the map within the 0.5 seconds. This means that the gamesetter unit of the first player will not be removed, if another player triggers the trigger within 0.5 seconds.
I think the first wait is not needed.

Yea you are right. I removed it and it still works, so it is better without i guess.

Why do you need the second wait? Does it take some time before (Number of units in (Units of type Game Settings)) gets reduced?
I think you could keep track of the ampunt of game setter units with a variable. Then you could avoid the wait.

I think exactly that is the case...yes. I just tried changing it and it works perfectly. Thx!
(Number of units in (Units of type Game Settings)) Equal to 0 leaks. It's a unit group and it uses "units of type". "units of type" always leaks so you should use "units in playable map matching unit type is Game Settings" and store it to a variable and destroy it later.

Yea i again forgot about the Leaks.... FIXED ;)
 
Status
Not open for further replies.
Top