• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[General] Making this trigger for multiple players

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
I'm trying to make a car in the World Editor for my city map that has 10 players. It has 1 problem, it only works for 1 player, as in trigger 2, if 2 players are inside a car in the same time, the PlayerNumber integer gets overwritten by the latter player entering a car. How do I fix this?

[Trigger 1]
Car Add Movement
Events
Unit - A unit Is loaded into a transport
Conditions
(Unit-type of (Transporting unit)) Equal to Car
Actions
Unit - Set (Transporting unit) movement speed to 300.00
Unit Group - Add (Triggering unit) to InsideCar[(Player number of (Owner of (Triggering unit)))]
Set PlayerNumber = (Player number of (Owner of (Triggering unit)))
Trigger - Turn off Car is inside <gen>

[Trigger 2]
Car is inside
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in InsideCar[PlayerNumber] and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is being transported) Equal to False
Then - Actions
Unit Group - Remove (Picked unit) from InsideCar[PlayerNumber]
Else - Actions
 
Like this! :D

  • Car 1
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • (Unit-type of (Transporting unit)) Equal to Car
    • Actions
      • Unit - Set (Transporting unit) movement speed to 300.00
      • Unit Group - Add (Triggering unit) to CampSite[(Player number of (Owner of (Triggering unit)))]
  • Car 2
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • For each (Integer TempInteger) from 1 to 10, do (Actions)
        • Loop - Actions
          • Unit Group - Pick every unit in InsideCar[(Player number of (Player(TempInteger)))] and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) is being transported) Equal to False
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from InsideCar[(Player number of (Player(TempInteger)))]
                • Else - Actions

It's a little confusing but you were on the right track. I removed the PlayerNumber variable from the first trigger because it's setting the number to a fixed value and over-ridding (pun intended) any previous values in the second trigger like you said. Instead I looped through each player with an integer to checked each player's group.

The only thing I didn't understand is why you were turning off the second trigger at the end of the first. Oh and you can use trigger tags to post GUI code, like so: [TRIGGER]Insert trigger text here![/TRIGGER]
 
Last edited:
IIRC, for the second trigger you can also use the event 'an unit enters the playable map', and checking if unit was part of the unit group, since an unit leaving a transport will cause the event to fire. At least I remember this from other thread some time back.
 
Status
Not open for further replies.
Back
Top