• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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
 
Level 8
Joined
Jan 28, 2016
Messages
486
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:
Level 6
Joined
May 20, 2014
Messages
228
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.
Top