• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Bolt Spell deal custom damage on impact

Status
Not open for further replies.
Level 4
Joined
Aug 13, 2009
Messages
57
Hi everyone,
basically ive made a spell based on stormbolt called Gungnir (a spear tossed into the air, falling on a target) where projectile arc is increased to 0.80, and with missile speed on 400.

i want the spell to deal damage ON IMPACT, however in GUI i cant seem to find an event or anything to suit.

i want damage based on hero attributes.

Since the time taken for the spell to hit varies on range, a simple wait dosn't work.

my nearest attempt is a
  • Wait ((Distance between (Position of (Casting unit)) and (Position of (Target unit of ability being cast))) / 200.00) seconds
Any alternatives?
 
Level 8
Joined
Jul 25, 2006
Messages
177
It will work, at least roughly. Save the Caster and Target to unit variables and make 4 real variables: cx, cy, tx, ty. Set cx = Unit - X of Unit with the unit being the caster variable do this for target and repeat with Y of unit now use a custom script action where your wait is and put this in for the custom script.

JASS:
call TriggerSleepAction(SquareRoot(( (udg_tx - udg_cx)  * (udg_tx - udg_cx) ) + ( (udg_ty - udg_cy)  * (udg_ty - udg_cy) ) )) / 400.)

This is not MUI but probably the leakless way to do it without giving you a long lesson.

Your alternative would be to keep what you have just divide by 400 but you will be leaking 2 locations which can get nasty later game if that spell is being cast a lot.

Always divide the distance by projectile speed if you're going to do a very simple impact wait like that.
 
Status
Not open for further replies.
Top