GFreak45
I didnt slap you, i high 5'd your face.
- Reaction score
- 130
Emulating Pick Every Functions
This is a brief introduction on picking every player/unit/w.e u want to pick without using the actual functions
Essentially what the pick every unit function does, is it goes down a list of the units in a group doing a set of actions for each one. What we will do here is emulate this effect through the use of integer loops and variables, here is an example of a very basic one:
Trigger:
- Emulated Pick Every unit
- Events
- A Unit casts an ability
- Conditions
- Ability being cast is equal to Stomp (a triggered spell that deals damage in an aoe)
- Actions
- Set Damaged_Units (our unit group) = Units within 300 range of casting unit matching conditions (Owner of matching unit is an enemy of Owner of casting unit)
- For each Integer A from 1 to (number of units in Damaged_Units) do actions.
- Loop Actions
- Set Picked_Unit = Random Unit from Damaged_Units
- Unit Group - Remove Picked_Unit from Damaged_Units
- Unit - Cause Casting Unit to damage Picked_Unit for X damage
- Loop Actions
- Custom Script: Calldestroygroup(UDG_Damaged_Units)
- Events
This is best for use with picking every unit inside a picked unit function IE: a spell that deals damage to the enemies around your nearby allies, a spell like earthshaker's ult (a seismic wave that hits enemies in an aoe hit then hits nearby enemies for a lesser ammount)
Here is an example of this:
Trigger:
- Echo-Slam
- Events
- A unit finishes casting an ability
- Conditions
- Ability being cast is equal to Echo-Slam
- Actions
- Set Temp_GRP[1] = Units within 300 range of casting unit matching conditions (owner of matching unit is an enemy of owner of casting unit)
- Unit Group - Pick every unit in Temp_GRP[1] and do actions
- Loop Actions
- Unit - Cause Casting unit to damage Picked unit for 150 damage
- Set Temp_GRP[2] = Units within 300 range of picked unit matching conditions (Owner of matching unit is an enemy of owner of casting unit)
- For Each Integer A from 1 to (Number of units in Temp_GRP[2]) do actions
- Loop Actions
- Set Picked_Unit = Random unit in Temp_GRP[2]
- Unit Group - Remove Picked_Unit from temp_GRP[2]
- Unit - Cause Casting Unit to damage Picked_Unit for 75 Damage
- Loop Actions
- Custom Script: Calldestroygroup(UDG_Temp_GRP[2])
- Loop Actions
- Custom Script: Calldestroygroup(UDG_Temp_GRP[1]
- Events
Any questions/comments you can pm or post here