Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Events

Unit - A unit is trained

Conditions

Actions


If/ then/else, multiple functions



If - Conditions




(Unit-type of (Trained Unit)) is Equal to Footman



Then - Actions




Your actions here



Else - Actions




Do Nothing
If it's based off of a unit being trained, try using:
Events
Unit - A unit is trained
Conditions
Actions
If/ then/else, multiple functions
If - Conditions
(Unit-type of (Trained Unit)) is Equal to Footman
Then - Actions
Your actions here
Else - Actions
Do Nothing
Ancient Worker

Events


Unit - A unit Begins training a unit

Conditions


(Unit-type of (Trained unit)) Equal to Ancient Worker

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




Player_Resources_Food[(Player number of (Owner of (Researching unit)))] Less than or equal to 49



Then - Actions




Custom script: call IssueImmediateOrderById( GetTriggerUnit( ), 0xD0008 )




Set PG = (Player group((Owner of (Researching unit))))




Cinematic - Clear the screen of text messages for PG




Game - Display to PG for 5.00 seconds the text: ...




Custom script: call DestroyForce (udg_PG)



Else - Actions




Set Player_Resources_Food[(Player number of (Owner of (Researching unit)))] = (Player_Resources_Food[(Player number of (Owner of (Researching unit)))] - 50)
Melee Initialization

Events


Map initialization

Conditions

Actions


Hashtable - Create a hashtable


Set Hash = (Last created hashtable)
Untitled Trigger 018

Events


Unit - A unit Is issued an order with no target

Conditions


(Issued order) Equal to (Order(footman))

Actions


Custom script: set udg_i1 = GetHandleId(GetTriggerUnit() )


Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds


Unit Group - Add (Triggering unit) to StopGroup


Custom script: call SaveInteger( udg_Hash , udg_i1, StringHash("units") , LoadInteger( udg_Hash , udg_i1 , StringHash("units") ) + 1 )
Cancel

Events


Time - Timer expires

Conditions

Actions


Unit Group - Pick every unit in StopGroup and do (Actions)



Loop - Actions




Set u1 = (Picked unit)




Custom script: set udg_i1 = GetHandleId( udg_u1 )




Custom script: set udg_i2 = LoadInteger( udg_Hash , udg_i1 , StringHash("units") )




For each (Integer loopA) from 1 to i2, do (Actions)





Loop - Actions






Custom script: call IssueImmediateOrderById( udg_u1 , 0xD0008 )




Unit Group - Remove u1 from StopGroup




Custom script: call FlushChildHashtable( udg_Hash, udg_i1 )
Orders Copy 2

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 BJDebugMsg("["+GetUnitName(GetTriggerUnit())+"] issued order [|cffFFFF00"+I2S(GetIssuedOrderId())+"|r] (|cffFF8040"+OrderId2String(GetIssuedOrderId())+"|r)")


Game - Display to (All players) the text: (String((Issued order)))
Melee Initialization

Events


Unit - A unit Is issued an order with no target

Conditions


(Issued order) Equal to (Order(Footman))

Actions


Unit - Pause (Triggering unit)


Unit - Unpause (Triggering unit)
Ancient Worker

Events


Unit - A unit Finishes training a unit

Conditions


(Unit-type of (Trained unit)) Equal to Ancient Worker

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




Player_Resources_Food[(Player number of (Owner of (Trained unit)))] Less than or equal to 49



Then - Actions




Unit - Remove (Trained unit) from the game




Set PG = (Player group((Owner of (Trained unit))))




Cinematic - Clear the screen of text messages for PG




Game - Display to PG for 5.00 seconds the text: ...




Custom script: call DestroyForce (udg_PG)



Else - Actions




Set Player_Resources_Food[(Player number of (Owner of (Trained unit)))] = (Player_Resources_Food[(Player number of (Owner of (Trained unit)))] - 50)
Yes, but the unit will have to finish training, before the error message appears on the screen, which is way too awkward.
Anyway, nothing leaky![]()
Either do what Maker suggested, or use the Jass version:
