Just follow the trigger, but since you're request is for 5 units, do this...
If/endif is not needed since if we stick to GUI there is already function for that :S
-
Set tempp = (Position of (Triggering unit))
-
Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Random 5 Units from (Units in 300 range of tempp matching (<here conditions, choose what you like, don't forgot that it's buff for alliances>)))
-
Loop - Actions
-
Set tempp2 = (Position of (Picked unit))
-
Unit - Create 1 dummy at tempp2 for (Triggering player) facing Default building facing degrees
-
Unit - Add 0.50 seconds Generic expiration timer to (Last created unit)
-
Unit - Add Blood Lust to (Last created unit)
-
Unit - Order (Last created unit) to Orc: Shaman - Blood Lust (Picked unit)
-
Custom script: call RemoveLocation(udg_tempp2)
-
Custom script: call RemoveLocation(udg_tempp)
@Feralon Explanation step by step:
What we going to create is AoE blood lust yes? So practicaly it means that we are going to create 1 dummy shaman with blood lust for each unit in AoE and order him to cast given spell on selected target.
At first we need to 'find' those units - let's say we found 5. So, our spell will summon 5 'shamans' who will instantly cast blood lust and.. disappear. Yes, disappear since we do not want them to do anything else.
-
Set tempp2 = (Position of (Picked unit))
-
Unit - Create 1 dummy at tempp2 for (Triggering player) facing Default building facing degrees
-
Unit - Add 0.50 seconds Generic expiration timer to (Last created unit)
This part show what I have mentioned: Creating dummy unit (dummy is just temporary unit that is unplayable for player) and adds to each summon timed life in form of expiration timer - like any normaly summoned (kind of elemental) has. We set position where we want each shaman to be created at for later leak removal.
-
Unit - Add Blood Lust to (Last created unit)
-
Unit - Order (Last created unit) to Orc: Shaman - Blood Lust (Picked unit)
^Speaks about adding our given ability and ordering every created 'shaman' to cast it on it's target.
It's target. What does it mean here? Let's go to the begining.
-
Set tempp = (Position of (Triggering unit))
-
Custom script: set bj_wantDestroyGroup = true
-
Unit Group - Pick every unit in (Units in 300 range of tempp matching (<here conditions, choose what you like, don't forgot that it's buff for alliances>)) Loop - Actions
Custom script is a freehand. It's kind of action (found at the top of action list) that allow user to write custom jass code. Warcraft3 spells/system are written in jass - you can right-click any trigger you got in your map and select 'Convert to custom text'. It's jass, but now thats too early for you to learn it.
However, about script I have written (just to inform you what is does): this script removes group leak and works somewhat like: 'immidiately remove next created group' - thus we do not need any group unit variable and further more you do not have to destroy it manualy afterwards, it's great, isn't it?
Action - Pick every unit (...) - pick - as said - every unit is created group and do portion of action written below 'Loop - Actions'. That means that fucntion repeats those X times where X is the number of units in given group.
Variable 'tempp' is here - again like in previous part - to set position for later leaks clearing.
Last thing you have to know from this part is that you can refer to each 'picked unit' via (Picked unit) reference.
-
Custom script: call RemoveLocation(udg_tempp2)
-
Custom script: call RemoveLocation(udg_tempp2)
Ha! At last I will show how to remove leaks and why I had been writting about
setting point to variable for later removal. Unfortunately you are forced you write custom script - that is writing the part of code by yourself . I do remove those location to free up memory making your spell lagless and bugfree. Group custom script is here for the same purpose.
Note: It would be great to add condition that checks if created unit group is empty or not. If it is empty, prevent the actions since it's pointless.
Your next lecture.