Detect if unit it loaded

Dwarvenfrog

New Member
Reaction score
2
I need a way to detect if a transport is loaded with a unit.

Basically...

Event: Periodic Timer
Condition: Detect if loaded
Action: Some Action

I can't figure this out in GUI for the life of me so I'll even take Jass on this one too. Any suggestions are welcome, thanks.


For example: A goblin zeppelin could not move unless loaded with at least one unit.
 

Tru_Power22

You can change this now in User CP.
Reaction score
144
Trigger:
  • Lol?
    • Events
      • Unit - A unit Is loaded into a transport


How about that?
 

Dwarvenfrog

New Member
Reaction score
2
...

Trigger:
  • Lol?
    • Events
      • Unit - A unit Is loaded into a transport


How about that?

I'll be more specific. That checks on the event that a unit is loaded, I need it to check if it is loaded as a condition.

For example: A goblin zeppelin could not move unless loaded with at least one unit.
 

Tru_Power22

You can change this now in User CP.
Reaction score
144
Set the units custom value to a specific number which you can then use for a integer comparison. Or even use the value as a bool.

EG:

Trigger:
  • Events
    • Unit - A unit Is loaded into a transport
    • Actions
      • Unit - Set the custom value of (Transporting unit) to 1


Use the custom value as the condition. Simple.
 

Dwarvenfrog

New Member
Reaction score
2
Set the units custom value to a specific number which you can then use for a integer comparison. Or even use the value as a bool.

EG:

Trigger:
  • Events
    • Unit - A unit Is loaded into a transport
    • Actions
      • Unit - Set the custom value of (Transporting unit) to 1


Use the custom value as the condition. Simple.

True. But if someone unloaded the zeppelin by clicking on the unit icon rather than the unload ability icon, then how can it check that? I suppose that's the real problem I'm having.
 

Moridin

Snow Leopard
Reaction score
144
I don't know the order strings for that myself, but you could easily test and see.

Basically make a quick periodic trigger that gives you the current order string of the unit. Then test and play around with loading and unloading until you have the basic strings down. Then all you have to do is check for that order string periodically and you should have it.

My ten cents.
 

Dwarvenfrog

New Member
Reaction score
2
Huh...

I don't know the order strings for that myself, but you could easily test and see.

Basically make a quick periodic trigger that gives you the current order string of the unit. Then test and play around with loading and unloading until you have the basic strings down. Then all you have to do is check for that order string periodically and you should have it.

My ten cents.

Good idea. It almost worked except when I unload the unit from the zeppelin as mentioned in the above post, it gives me a blank command...

Trigger:
  • unload
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Game - Display to (All players) the text: ((Name of (Ordered unit)) + <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite1" alt=":)" title="Smile :)" loading="lazy" data-shortname=":)" /> + (String((Current order of (Ordered unit))))))


Unless I missed something that should give me the correct command, but all I get is a blank. Any ideas as to what it could be?
 

N Segick

New Member
Reaction score
0
I had the same problem of needing to know when a unit was unloaded. I ended up making basically the same trigger you did, but using 'issued order' rather than 'current order'. I found out that when a unit is unloaded by any means, the transport is given the order 'unload' and the target is the unit that is unloaded. The unloaded unit is then given the order 'stop'. So you need the trigger to be something like:

Events: Unit - A unit Is issued an order targeting an object

Conditions: (Issued order) equal to (Order(unload))

Actions: Set the custom value of (Target unit of issued order) to 0
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top