| 03-10-2007, 02:59 AM | #1 |
I seem to be having trouble getting a created unit to take an action. JASS:function Trig_Twist_Allegiance_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A006' endfunction function Twist_Enemy_Filter takes nothing returns boolean return IsUnitEnemy(GetFilterUnit(), GetOwningPlayer(udg_Twist_Caster)) endfunction function Trig_Twist_Allegiance_Actions takes nothing returns nothing local group g = CreateGroup() local real x = 0 local real y = 0 local boolexpr p = Condition(function Twist_Enemy_Filter) local unit u local unit c local player a = GetTriggerPlayer() local location loc = GetSpellTargetLoc() call GroupEnumUnitsInRangeOfLoc(g, loc, 250.00, p) loop set u = FirstOfGroup(g) set x = GetUnitX(u) set y = GetUnitY(u) exitwhen u == null call CreateUnit(a,'h000',x,y,0) set c = GetLastCreatedUnit() call IssueTargetOrderById(c,'A007',u) call GroupRemoveUnit(g,u) call RemoveUnit(c) set c = null endloop endfunction The ability A007 works properly on its own. The dummy unit is being created but not following its issued order. What am I missing? Should I run another custom function that issues the order? -Fluxx |
| 03-10-2007, 03:11 AM | #2 |
CreateUnit does not set the GetLastCreatedUnit to the unit it just created. Instead of.. call CreateUnit(a,'h000',x,y,0) set c = GetLastCreatedUnit() do set c = CreateUnit(a,'h000',x,y,0) |
| 03-10-2007, 03:14 AM | #3 |
edit: nvm grim beat me to it. |
