I have created (read found here and copied) a trigger to find the nearest building, move my unit there, kill it, pay its price and train a different unit. It works when a single unit uses the spell, but when I make a group use it, the killing part is skipped - it takes the gold for training, trains a unit for each unit in the group, but kills only one of the units. Why?
I have Czech edition of Warcraft with the localized version of the Editor, so some commands in the trigger might have been wrongly translated, so just assume they are what you think they are.
-
Equip
-
Events
-
Unit - A unit Started using ability
-
-
Conditions
-
(Ability being cast) Equals Equip (Runaway)
-
(Unit-type of (Casting unit)) Equals Runaway
-
-
Actions
-
Set TempLocA = (Position of (Casting unit))
-
Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) matching ((((Matching unit) is alive) Equals TRUE) and ((Unit-type of (Matching unit)) Equals Runaway Hideout))) and do (Actions)
-
Loop - actions
-
Set TempLocB = (Position of (Picked unit))
-
Set TempRealA = (Distance between TempLocA and TempLocB)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - conditions
-
TempRealA Less than TempRealB
-
-
Then - actions
-
Custom script: set udg_TempUnitA = null
-
Set TempUnitA = (Picked unit)
-
Set TempRealB = TempRealA
-
-
Else - actions
-
-
Custom script: call RemoveLocation(udg_TempLocB)
-
-
-
Custom script: call RemoveLocation(udg_TempLocA)
-
Unit - Order (Casting unit) to Move to (Position of TempUnitA)
-
Wait until ((Distance between (Position of (Casting unit)) and (Position of TempUnitA)) Less or equal to 256.00), checking every 0.15 seconds
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - conditions
-
(((Owner of TempUnitA) Gold) More or equal to 125) and (((Owner of TempUnitA) Lumber More or equal to 30)
-
-
Then - actions
-
Unit - Hide (Casting unit)
-
Unit - Add Equip (Charge for) to TempUnitA
-
Unit - Kill (Casting unit)
-
Unit - Order TempUnitA to Far Seer - Spirit Wolf
-
Unit - Remove Equip (Charge for) from TempUnitA
-
Player - Make Wildling available for training/construction by (Owner of (Casting unit))
-
Unit - Order TempUnitA to train/upgrade to a Wildling
-
Player - Make Wildling unavailable for training/construction by (Owner of (Casting unit))
-
-
Else - actions
-
-
-