Getting the Id of "before upgrade unit"?

Status
Not open for further replies.
Level 4
Joined
Feb 12, 2007
Messages
99
Hello again, another problem, this time I'm trying to find the Id of a an unit before it started upgrading.

I use this library : http://www.hiveworkshop.com/forums/jass-functions-413/getunitcost-142145/
To calculate the cost of unit, it also can calculate the total cost of unit including precedent upgrades but I don't understand how he does it.

Here though I 'just' need the Id of the unit before it upgrading (or in the actual case, when it's currently upgrading).

Does someone know how to do it?
 
Level 4
Joined
Feb 12, 2007
Messages
99
Seem like I got misunderstand, I don't need the event (already have it...)

What I need is the function that can get the Id of the unit before it started upgrading while the even of the function is "EVENT_PLAYER_UNIT_UPGRADE_START"

As I said before, GetTriggerUnit() give only the Id of the unit it's being upgrading in. (upgrade have started but not finished)
 
How about using "unit is issued an order" event?

this would work if buildings could not get other orders than upgrades
the following code will exclude all order ids which are no units but it will still fire on "train unit orders"
and "trained unit" only refers to "a unit finished training a unit" (not even begins) so I can't exclude it this way either
the ids are like 'hpea' for peon and so on so if you only want to exclude a few units it might be possible
and while I am writing this I just got the idea to exclude non-building-units which will probably work


edit:
UnitId2String(GetIssuedOrderId()) != null excludes all non-unit-orders
IsUnitIdType(GetIssuedOrderId(), UNIT_TYPE_STRUCTURE) excludes all train orders (usually buildings don't train buildings so this should work in most cases)

  • UpgradeEvent
    • Events
      • Unit - A unit Is issued an order with no target
    • Conditions
    • Actions
      • Custom script: if UnitId2String(GetIssuedOrderId()) != null and IsUnitIdType(GetIssuedOrderId(), UNIT_TYPE_STRUCTURE) then
      • Game - Display to (All players) for 0.00 seconds the text: (Name of upgrading unit: + (Name of (Ordered unit)))
      • Custom script: endif
 
Status
Not open for further replies.
Top