• 🏆 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!

One small problem with a spell

Status
Not open for further replies.
Level 19
Joined
Feb 25, 2009
Messages
2,004
Okay, so here's the deal:

I got a spell which moves a unit forward to a specific point until reaching it.

My problem is that I need to check the distance everytime I move the unit, but, when doing so I somehow bug the whole loop, ruining all instances.

The problem comes when I check the distance like this:

  • Set Distance[MUI_3] = (Distance[MUI_3] + Speed[MUI_3])
Speed is a configurated in the cast trigger where it is determined by the level of the ability x 15

When I do check it in this way:

  • Set Distance[MUI_3] = (Distance between mPoint[MUI_3] and cPoint[MUI_3])
Everything works fine for all instances no matter what, but in this way I cannot make the unit unable to leave map boundary (playable area)

-- The whole problem is, when I do check the distance in the first way, if theres an 2 running instances of the spell, when the second one ends, it also stops the 1st one, leaving the unit invulnerable and invisible (Which shouldn't happen). So my questions is, why is this happening even tho they are 2 separated instances and why the last one overrites the previous one?

Both triggers can be seen here.
 
Your second way would work better (Distance between points). The reason why it doesn't check whether there is a walkable terrain is that you remove the locations before the if/then/else statement, so mPoint[MUI_3] returns null in the comparison, making the trigger unable to perform the actions you want. Move your RemoveLocation scripts to the bottom of the trigger. ;]
 
Status
Not open for further replies.
Top