HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How To Detect Sold Units (For Custom Abilities) :

10-01-2002, 10:02 PM#1
Extrarius
Most people don't seem to know how to test for a unit being bought, so I decided to make this post to explain it:

To detect a unit being bought,
Event:
Unit - A unit owned by Player Is issued an order with no target
Condition:
(String((Issued Order))) Equal To String(Unit-Type)
Action
(Whatever the ability should do)

The condition is a string comparison, and the first half is obtained by using "Conversion - Convert Order to String" and the second half by using "Conversion - Convert Unit-Type to String".

In the Action, you can use Triggering Unit to refer to the unit that did the selling.

Note that you need a seperate trigger to remove the bought unit, because stopping the order will not prevent the unit from being created. The event for this one could be "Unit - A unit enters (Entire Map)", with a condition checking the unit type and the action being to remove the unit.

Also, the unit 'built' sound is played, so base it on a unit with an acceptable 'built' sound (maybe replace the sound for a unit you dont use and base the unit on that one).
10-02-2002, 01:26 AM#2
Guest
naw, just make a custom unit from the War Golem. Then you've got no sounds to worry about :)

Thanks Ex! you saved my map!