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

How many units in transport?

Status
Not open for further replies.
Level 3
Joined
Dec 6, 2005
Messages
67
Basically i have a transport and when units are loaded it makes a tiny version of them, locust scale .1 so that units in the transport can seeming shoot out. However i'm trying to put in a little attention to detail and the model i'm using has little windows, well i'm placing the dummy units in the windows so the shots really look like they come from inside so i can determine which window to place the new unit at. My only problem is that i need each unit to be created at a different window, therefore i need to know how many units are inside. Also there will be lots of these transports so any long term variables won't work.

Also how do i detect units exiting the transport?
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
  • Unit - A unit Is loaded into a transport
This event for firing the trigger when the unit gets into a transport.

But you can't detect when the unit unloades or more specific when a certain unit is unloaded as it has no event or Issue command but you can detect if the transport will unload or not by

  • Transport Get off
    • Events
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • (Issued order) Equal to (Order(unloadall))
    • Actions
      • Game - Display to (All players) the text: Will Unload
      • Wait until ((Current order of (Triggering unit)) Not equal to (Order(unloadall))), checking every 0.10 seconds
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Current order of (Triggering unit)) Not equal to (Order(unloadall))
        • Then - Actions
          • Game - Display to (All players) the text: Unloading Cancelled
        • Else - Actions
 
Level 6
Joined
Jun 15, 2008
Messages
175
I woulden't know about the modelling stuff, but if you simply set a variable to itself + 1. You'd know how many units in the bunker/etc.
Here's what I am suggestion:
  • Transport
    • Events
      • Unit - A unit Is loaded into a transport
    • Conditions
    • Actions
      • Set Units_In_Transport = (Units_In_Transport + 1)
      • Game - Display to (All players) the text: (There are currently this many units in the transport + (String(Units_In_Transport)))
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
thanks, but that won't work if you click the image of the unit in the cargo will it?

Yes, I know thats why I told you it can't be done for a CERTAIN unit (which means you can't click on their icon and detect the unloading event for this unit) but there is something else that may prove useful, which is the condition:
  • ((Triggering unit) is loaded into Transport) Equal to True
where Transport is a unit variable for the transporting unit, you could replace (Triggering unit) with a unit variable, normal or array, but if array; I think you will need Foopad trigger and make the integer variable he mentioned as the array index.
 
Level 3
Joined
Dec 6, 2005
Messages
67
@foodpad, appreciate the idea. But i already thought of doing a variable increment,
Also there will be lots of these transports so any long term variables won't work.
the problem is that there will be an unknown number of the transports, so a single variable won't work, however i think hash tables might be my solution. As for the modeling, i don't know anything bout modeling either, i'm just placing my dummy units at points with polar offsets so that they appear at the right spots on top of the model

@starquizer yeah i was looking through the triggers last night and saw that as well, thanks for the find, i think some combo of that and hash tables just might get this working

had to bust out the JASS lol
for anyone having 'order' issues use this trigger
  • show order ids
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: call DisplayTextToForce( GetPlayersAll(), ( ( "Order: " + OrderId2StringBJ(GetIssuedOrderIdBJ()) ) + ( " ID: " + I2S(GetIssuedOrderIdBJ()) ) ) )
basically all it does is outputs the issued order as string (can be done in GUI), however it also displays the orderID, some orders don't have a string comparison, 'cancel' comes to mind

seems that 'unload' is an order targetting an object :) so i CAN tell which unit was unloaded :) :) :)
 
Last edited:
Status
Not open for further replies.
Top