Precise Point Targetting

jhnam95

Active Member
Reaction score
12
What should be my base ability for abilities like arrow? I tried using channel and shockwave and those aren't really precise. If I order the unit to fire in a certain direction, it will shoot slightly off.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Welcome to the world of WC3 map-making.
It's never perfect.

And, please, don't ever use GetUnitFacing to tell where you should fire a projectile in a direction.
Use Atan2(ToY - FromY, ToX - FromX)
 

jhnam95

Active Member
Reaction score
12
Yea, I kind of figured that out a while ago x(
I'm going to guess that means angle between unit and casting point?
 

jhnam95

Active Member
Reaction score
12
How do I get the coordinates of the point he's shooting at other than using the point itself?
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Shouldn't it be somewhere along the lines of arithmetic operations?
Try using real variables.

I only know the Jass equivalent =x
JASS:
set Angle = Atan2(ToY - FromY, ToX - FromX) //In radians
set Angle = Atan2(ToY - FromY, ToX - FromX) * bj_RADTODEG //In degrees
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
[lJASS]GetSpellTargetX()[/lJASS] and [lJASS]GetSpellTargetY()[/lJASS] are indeed slightly inaccurate, but it isn't by a hell lot..
(Well, to me it's a lot, but what does it matter?)
 

jhnam95

Active Member
Reaction score
12
Sorry, I'm more of a GUI person ):
As for JASS, I can only do things like using locals :\

I don't know what Atan2 means...
 

jhnam95

Active Member
Reaction score
12
Um, it's actually shooting even more weird now O_O
It shoots from behind the unit and doesn't even go the proper direction.
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
You're using the wrong variables.
JASS:
Atan2(Target'sY - Caster'sY, Target'sX - Caster'sX) //<--Use that.


Not:
JASS:
Atan2(Caster'sY - Target'sY, Caster'sX - Target'sX) //<--Don't use that.
 

jhnam95

Active Member
Reaction score
12
Lol, it works now.
It's SLIGHTLY off still, but for the most part it works pretty well. Thank you.

EDIT: Actually, slight is quite annoying D: The projectile path seems to be slightly toward the upward direction than where it should
EDIT2: Never mind. It was just the flying height of the projectile.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top