• 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.

[Trigger] Checking units loaded in transport

Status
Not open for further replies.
Level 4
Joined
Sep 8, 2008
Messages
73
I need some help with a driving system i'm making for my map.
The map contains lots of cars which should only be drivable if they have at least one unit in their cargo hold.
So far i have fixed a trigger that makes it so that every unit in the map classed as mechanical obtains the movement speed of 0 unless they have an ability called "operational".
But i dont know how to check when a unit is actually loaded, i can only find loading unit, and things that references from the unit being loaded.
Any help would be apriciated.

(sorry for eventual spelling errors, my eyes are getting kind of blurry now that it's like 02.30)
 
Level 5
Joined
Oct 17, 2006
Messages
151
Ok we would need three triggers for this one!

The first one is to set the MS for all non operational vehicles.
  • Set Transport Speed
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is Mechanical) Equal to True
              • ((Picked unit) is in Operational_Vehicles) Equal to False
            • Then - Actions
              • Unit - Set (Picked unit) movement speed to 0.00
            • Else - Actions
The second trigger is to make the cars operational if they have someone loaded into it.

  • Target Transport
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
      • ((Transporting unit) is in Operational_Vehicles) Equal to False
    • Actions
      • Unit Group - Add (Transporting unit) to Operational_Vehicles
      • Unit - Set (Transporting unit) movement speed to (Default movement speed of (Transporting unit))
And the third trigger is for making the cars un-operational if they have 0 units loaded inside of them.

  • Check Transport
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Issued order) Equal to (Order(unload))
      • (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is loaded into (Ordered unit)) Equal to True))) Equal to 0
    • Actions
      • Unit Group - Remove (Ordered unit) from Operational_Vehicles
      • Unit - Set (Transporting unit) movement speed to 0.00
Good luck with your map!
 
Status
Not open for further replies.
Top