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

[Trigger] Can't get northeast angle?

Status
Not open for further replies.
Level 7
Joined
Mar 16, 2014
Messages
152
I have a spell that fires a few carrion swarm abilities in a cone in the chosen direction while the hero channels. The issue with this ability is that when the hero fires the ability to the northeast, the carrion swarms won't be fired where the hero is facing. Instead, they will be fired to the north, or sometimes the east. All other angles work correctly.

m3m9Cjv.png
YGCHayS.png
 
Level 8
Joined
May 21, 2019
Messages
435
First off, you need to check this out: How To Post Your Trigger

Your screenshots are fine, but I can't text search them, and posting it like this is really easy anyway.
Anyway, I wanted to text search them, because I am quite puzzled by BulletHellPoint[3]. It kind of seems like it's your point of reference for the entire ability, yet I can't see it being used at all. I may have missed it though.

Anyway, if I were to venture a guess, I'd look into what happens when you hit the upper and lower bounds of the facing angle (0 and 360). IIRC east = 0, so northeast ending up at East or North could be the result of your angle ending up below 0. In order to fix this, you'd have to check the value of the angle after setting the variable, and if it is outside the bounds, you should convert it. For example, 380 degrees is 20 degrees beyond a 360 degree roation, so you'd want to convert that to 20 degrees. Similarly, a -30 degree rotation should be set to a 330 degree rotation, as that is the angle 30 degrees below 0.

That's my guess on why this is going haywire at that exact point, but I am not certain how the game reacts when given an angle that is below 0 or above 360.
 
Level 8
Joined
May 21, 2019
Messages
435
Anyway, if I were to venture a guess, I'd look into what happens when you hit the upper and lower bounds of the facing angle (0 and 360).
Tested this, and it isn't the case:
  • rotate
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit - Make Paladin 0000 <gen> face ((Facing of Paladin 0000 <gen>) + 10.00) over 0.00 seconds
This (hilarious) trigger successfully rotates the Paladin around. I tried it with -10 as well, and that rotated the other way just fine. So... it's not that...
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
Use the display message action to show the values in real variables.
IIRC the "angle between points" gives a result ranging from -180 to +180 degrees, while "facing of unit" ranges from 0 to 360 degrees.

If that is the case then the problem may be that the math just doesn't add up correctly all the time, but when the spell is aimed north-east, its most noticeable
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
The bug is with how BulletHellPoint[2] is generated. The "offset by" argument is meant to be a constant, e.g. 100 or any other reasonably large value less than cast range and greater than 0, and not an angle.

The bug observed is that casting occurs offset by 180 degrees near the 0 angle. This is because the "offset by" argument becomes negative.
 
Status
Not open for further replies.
Top