HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

the unit thats being casted on

09-28-2003, 12:46 AM#1
saus
I remember seeing this many many times, but I kind of forgot what people said...
I know there isn't a Casted Unit event response, but isn't there another way to detect it? It would probably be impossible to detect all of the units that a chain lightning spell is being cast on right?
09-28-2003, 01:55 AM#2
Oinkerwinkle
Here is an example of a method that works for as many as you want. I wrote this for someone else a while ago.
Quote:
You'll need two variables. Type: Unit. Yes to array. Set the size to whatever you think the max number of these spells being cast at a time is. Name is target. The other variable is of type integer, not an array. Name it counter and set the initial value to 0.

Events:
A unit is issued an order target an object
Conditions:
(Unit-type of (Ordered unit)) Equal to (Elemental Mage)
(Issued order) Equal to Undead Lich - Frost Nova
Actions:
Set counter = counter + 1
If counter > TheLengthOfTheCasterArray then set counter = 1 else do nothing
Set custom value of triggering unit = counter
Set target[counter] = target of issued order

Events:
A unit finishes casting an ability
Conditions:
(Ability comparison) Ability being cast is equal to Undead Lich - Frost Nova
(Unit-type of (Triggering unit)) Equal to (Elemental Mage )
Actions:
A) Set Ice_Spiral = target[custom value of triggering unit)
A) Unit - Create 1 IceSpirals for (Owner of Triggering Unit ) at ((Position of Ice_Spiral) offset by (100.00, 20.00)) facing (Position of (Triggering unit))
A) Unit - Create 1 IceSpirals for (Owner of Elemental Mage 0072 <gen> ) at ((Position of Ice_Spiral) offset by (-100.00, -20.00)) facing (Position of (Triggering unit))
The last part there is where you can put anything you want. It can be scaling units, hiding replacing, or anything else accomplishable by a trigger, meaning just about anything imaginable. In this example, it seems to create 'Ice spirals' at the unit this was cast upon.

Here is what it's doing, in English. Two triggers are required because you can't directly reference the target of an ability. Instead, you save that target when the order is issued, in this case in the 'target' array. To save which index of the array it is in, a custom value is set to the caster. You can retrueve the custom value and therefore the refernced unit when he actually casts.
09-28-2003, 02:29 AM#3
saus
So this works with a spell that attacks multiple units?
Thank you very much..
09-28-2003, 05:21 AM#4
saus
(Issued order) Equal to Undead Lich - Frost Nova

Is this for Oder Comparison? How do I put a skill in there, there's no list for selecting an ability.


If counter > TheLengthOfTheCasterArray then set counter = 1 else do nothing

What is TheLengthOfTheCasterArray!?
09-28-2003, 03:03 PM#5
Oinkerwinkle
This doesn't pertain to spells that can hit multiple targets. You can just add that in by doing a pcik every unit in range type thing. The reason it has an array is so variables aren't overwritten.

Sorry, that part was unclear. It's a order comparison. On one side, put "Issued order." For the other side, find what the order is for your ability. It is possible to find that in the object editor, near the bottom. Put order( YourOrderString )

For TheLengthOfCasterArray, I meant whatever value you decided on for the length of that array. If you didn't decide on a value, just put in the max number of these spells at a time that someone will be trying to cast. 100 should be plently for something like slow, something more like 10 if it's an ultimate.