- Joined
- Nov 20, 2016
- Messages
- 75
Hey, I'd like to ask for a little help with a spell I'm trying to make. Basically, when a unit kills another unit, I want to give friendly units near the killing unit an ability. I want to do this with local variables because I want to use a "wait" function later and using locals is the only way I know to do this. Problem is, I'm not able to filter out units from the unit group, and I don't know why is not working:
P.S.: I know there are leaks, I'll fix them later, when I get the trigger to work.
EDIT: Removed one deactivated function that was in the middle of the code.
-
Inspire
-
Acontecimientos
-
Unidad - A unit Dies
-
-
Condiciones
-
(Level of Inspire for (Killing unit)) Mayor que 0
-
(Unit-type of (Killing unit)) Igual a Lord of Reins
-
-
Acciones
-
Custom script: local unit uh = GetKillingUnit()
-
Custom script: local unit g
-
Custom script: local location p = GetUnitLoc(uh)
-
Custom script: local group G = GetUnitsInRangeOfLocAll(500, p)
-
Custom script: local group G1
-
Custom script: set udg_Inspiring_Unit = uh
-
Custom script: set udg_Inspire_Loc = p
-
Custom script: loop
-
Custom script: set g = FirstOfGroup(G)
-
Custom script: exitwhen g==null
-
Custom script: if IsUnitEnemy(g, GetOwningPlayer(uh))==true or IsUnitType(g, UNIT_TYPE_MECHANICAL) == true or IsUnitType(g, UNIT_TYPE_FLYING) == true or IsUnitType(g, UNIT_TYPE_MAGIC_IMMUNE) == true then
-
Custom script: call GroupRemoveUnit(G,g)
-
Custom script: else
-
Custom script: call GroupAddUnit(G1,g)
-
Custom script: call GroupRemoveUnit(G,g)
-
Custom script: endif
-
Custom script: endloop
-
Custom script: set g = null
-
Custom script: set udg_Inspire_Group = G1
-
Grupo de unidad - Pick every unit in Inspire_Group and do (Actions)
-
Bucle: Acciones
-
Unidad - Add Damage Bonus (Inspire) to (Picked unit)
-
Unidad - Set level of Damage Bonus (Inspire) for (Picked unit) to (Level of Inspire for Inspiring_Unit)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Si: Condiciones
-
Or - Any (Conditions) are true
-
Condiciones
-
((Picked unit) is Mechanical) Igual a True
-
((Picked unit) is Flying Unit) Igual a True
-
((Picked unit) is Magic Inmune) Igual a True
-
-
-
-
Entonces: Acciones
-
Grupo de unidad - Remove (Picked unit) from Inspire_Group
-
-
Otros: Acciones
-
-
-
-
Partida - Display to (All players) the text: (String((Number of units in Inspire_Group)))
-
-
P.S.: I know there are leaks, I'll fix them later, when I get the trigger to work.
EDIT: Removed one deactivated function that was in the middle of the code.
Last edited: