HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Reliable Special Effects on missle attacks!

06-03-2004, 12:42 AM#1
YellowSubmarine
I was making a hero who throws Ensnare nets, but when the nets hit, they just sorta disappeared. I wanted to make a special effect on each attack that spawned the Ensnare buff, but I wasn't sure how to make the effect consistantly appear at the time the net missle hit its target. Then, I remember some arithmatic:

distance: rate X time

And came up with this trigger:
Code:
attackfix
    Events
        Unit - A unit Is attacked
    Conditions
        (Level of Ensnaring Nets (Smuggler) for (Attacking unit)) Greater than 0
    Actions
        Custom script:   local effect udg_snareeffect
        Wait ((Distance between (Position of (Attacked unit)) and (Position of (Attacking unit))) / 900.00) seconds
        Special Effect - Create a special effect attached to the origin of (Attacked unit) using Abilities\Spells\Orc\Ensnare\ensnareTarget.mdl
        Set snareeffect = (Last created special effect)
        Wait (0.50 x ((Distance between (Position of (Attacked unit)) and (Position of (Attacking unit))) / 900.00)) seconds
        Special Effect - Destroy snareeffect

In this, 900 is the missle speed. This will consistantly create the effect on the target on a missle attack, no matter how far away the attacker is; then, it destroys the special effect in half of that time, giving the next attack time to respawn the effect so it doesn't just stay on there looking stupid.
Hope this helps someone!
06-03-2004, 12:56 AM#2
sc_freek
Woah, thanks :D
06-03-2004, 01:54 AM#3
Shimrra
I used something a lot like this for a spell I made a while ago called Hoarfrost. I used a unit instead of a missile an took the distance between the two points divided by the movement speed of the unit to find how long it would take. However, I never thought about using it for missiles. Good idea!

Post scriptum: Did you create the udg_snareeffect in the variable editor, or was it only in the text?
06-03-2004, 03:52 PM#4
YellowSubmarine
In the variable editor. I'm no good with JASS, though I wish I was :P
06-03-2004, 11:03 PM#5
Vexorian
And I used this a lot in the past too, see my caster system if you are able to check at JASS things, and it works well
06-05-2004, 05:57 PM#6
xGT4x
Good to know^^I didn't know what the missile and unit speed exactly is, now I know it'S the distance the unit/missile moves in a second :D
06-06-2004, 11:07 AM#7
Anitarf
I'm not absolutely certain, but I believe I remember from my test maps that the "unit is attacked" event happens at the time when the attacking unit begins the attack, so in the wait function, you should also consider the "combat - attack 1 - damage point" of the unit besides the distance and the speed of the projectile.

Another thing this means is that the attack can be interrupted, but the effect will still be there. As long as it is only cosmetic, that isn't much of a problem, but if you mean to inflict some serious effects with this the be careful. Giving the unit a 0 "damage point" can solve this, but may look wierd on some models (like archer, for example; rifleman, on the other hand, looks OK, because he has a low "damage point" by default).
06-06-2004, 11:12 AM#8
Pheonix-IV
you dont need to do this anyway ^_^ there are 2 ways.

A: Give the unit a changed slow poison ability with the target art as the ensnare net
B: Give the unit a changed Item Orb of Lightning (New) that has ensnare are its spell, 100% chance to hit ect.