One with comments:
Whipcrack
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to WhipcrackAbility
Actions
Set Whip_Cast = (Triggering unit)
Set Whip_Level = (Level of WhipcrackAbility for Whip_Cast)
Set Whip_FinalDmg = (Const_Dmg + (Const_Dmg_Add x Real(Whip_Level)))
Set Whip_FinalRadius = (Const_Whip_Range + (Const_Whip_Range_Add x Real(Whip_Level)))
-------- Point should also be configurable. --------
Set Whip_Point = (Target point of ability being cast)
-------- OR Point could be --------
Set Whip_Point = (Position of Whip_Cast)
-------- Group should also be configurable --------
-------- much better if you add the conditions here instead of in the pick loop. --------
Set Whip_Group = (Units within Whip_FinalRadius of Whip_Point matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is Mechanical) Equal to False)) and ((((Matching unit) is An Ancient) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (
Unit - Create 1 Dummy_Unit for (Owner of Whip_Cast) at point facing Default building facing degrees
Set dummy = (Last created unit)
Unit - Add WhipcrackDUMMYAbility to dummy
Unit - Set level of WhipcrackDUMMYAbility for dummy to level
Unit - Add a 2.00 second Generic expiration timer to dummy
Unit Group - Pick every unit in Whip_Group and do (Actions)
Loop - Actions
Set picked = (Picked unit)
Unit - Cause Whip_Cast to damage picked, dealing dmg damage of attack type Spells and damage type Normal
Unit - Order dummy to Orc Shaman - Bloodlust picked
Custom script: call RemoveLocation(udg_Whip_Point)
Custom script: call DestroyGroup(udg_Whip_Group)
One with No comments:
Whipcrack
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to WhipcrackAbility
Actions
Set Whip_Cast = (Triggering unit)
Set Whip_Level = (Level of WhipcrackAbility for Whip_Cast)
Set Whip_FinalDmg = (Const_Dmg + (Const_Dmg_Add x Real(Whip_Level)))
Set Whip_FinalRadius = (Const_Whip_Range + (Const_Whip_Range_Add x Real(Whip_Level)))
Set Whip_Point = (Position of Whip_Cast)
Set Whip_Group = (Units within Whip_FinalRadius of Whip_Point matching (((((Matching unit) is A structure) Equal to False) and (((Matching unit) is Mechanical) Equal to False)) and ((((Matching unit) is An Ancient) Equal to False) and ((((Matching unit) is Magic Immune) Equal to False) and (
Unit - Create 1 Dummy_Unit for (Owner of Whip_Cast) at point facing Default building facing degrees
Set dummy = (Last created unit)
Unit - Add WhipcrackDUMMYAbility to dummy
Unit - Set level of WhipcrackDUMMYAbility for dummy to level
Unit - Add a 2.00 second Generic expiration timer to dummy
Unit Group - Pick every unit in Whip_Group and do (Actions)
Loop - Actions
Set picked = (Picked unit)
Unit - Cause Whip_Cast to damage picked, dealing dmg damage of attack type Spells and damage type Normal
Unit - Order dummy to Orc Shaman - Bloodlust picked
Custom script: call RemoveLocation(udg_Whip_Point)
Custom script: call DestroyGroup(udg_Whip_Group)
See? I only used one dummy to cast the bloodlust for all units in range that matched the conditon when they were picked (they weren't sorted IN the loop so enemy units counted in the pick where not looped). Also used just one location and somehow a couple less variables.