| 02-05-2004, 02:36 AM | #1 |
Code:
Actions
Set CurrentTarget = (Target unit of ability being cast)
For each (Integer A) from 1 to 3, do (Actions)
Loop - Actions
Unit Group - Add CurrentTarget to StruckAlready
Set RealDistance = 50000.00
Set i = 1
Unit Group - Add all units of (Units within 500.00 of (Position of CurrentTarget) matching (((Matching unit) is in StruckAlready) Equal to False)) to PotentialTargets
Unit Group - Pick every unit in PotentialTargets and do (Actions)
Loop - Actions
If ((Distance between (Position of CurrentTarget) and (Position of ArPotentialTarget[i])) Less than RealDistance) then do (Set TheNextTarget = ArPotentialTarget[i]) else do (Do nothing)
Set i = (i + 1)
Special Effect - Create a special effect attached to the overhead of TheNextTarget using Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
Set CurrentTarget = TheNextTarget
No edit button for first post? ok.. Well anyway i forgot to tell u my problem.. I tried putting Game - Display Text message in front of each loop and I found out the trigger initialized properly.. Now there still is no special effect attached to the targets.. help if you can O.o |
| 02-05-2004, 04:56 AM | #2 |
Ummmmm..... ya. There is a reason it doens't work, unless I am missing important information. Unit arrays, and Unit Groups are as different as a sound variable is from an SFX. What you need to do is a conversion. After you find out what units are in your unit group, you need to loop from 1 to (units in the unit group) and do Set ArPotentialTarget[For loop] = Random unit from (PotentialTargets) Remove ArPotentialTarget[for loop] from Potential targets Doing this should fix your problem. I hope that you are using integer B for the loops inside of the first loop or else it won't work. If you are using JASS make sure that the loop variables are different. You can't loop inside of a loop using the same parameters for the loop. |
