• 🏆 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!

[Trigger] A unit UNload a another unit?

Status
Not open for further replies.
Level 25
Joined
Sep 26, 2009
Messages
2,387
the way I went around it was that when a unit fired the "unit is loaded ..." event, I saved that unit into unit group.
When unit leaves a transport, it fires the "unit enters region" event, so I used that. But the event fires for any unit (created, summoned, ...), hence I check if the triggering unit is in the "loaded" unit group. If yes, it was unloaded and I remove the unit from the unit group.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
Alternatively, you can use Bribe's GUI Unit Event.
Bribe said:
Use the event "Game - CargoEvent becomes Equal to 1.00" to detect when a unit is loaded into a transport. Use the event "Game - CargoEvent becomes Equal to 2.00" to detect when it is unloaded.

You also have "CargoTransportUnit[(Custom value of Unit)]" to get the unit who is carrying the unit, and "CargoTransportGroup[(Custom value of Transport)]" to pick all units that the transport is carrying.
 
the way I went around it was that when a unit fired the "unit is loaded ..." event, I saved that unit into unit group.
When unit leaves a transport, it fires the "unit enters region" event, so I used that. But the event fires for any unit (created, summoned, ...), hence I check if the triggering unit is in the "loaded" unit group. If yes, it was unloaded and I remove the unit from the unit group.

It doesn't fire the enters-region event unless you moved the unit outside the region after it was loaded. And yes, as KILLCIDE stated, use Unit Event. It does all that cool stuff without bugs.
 
Status
Not open for further replies.
Top