Facing Angle and Angle Between Points

Zurtrogx

Active Member
Reaction score
24
When using "Facing Angle" it gives you a value between 0 and 360.
When using "Angle Between Points" it gives you a value between -180 and 180.

Is there a simple way to make "Angle Between Points" return a value between 0 to 360?
(Simple, as in not using If/Then/Else to check if it is between -180 and 0, then converting it to the appropriate value between 180 to 360)

EDIT: Preferably in GUI since I don't use JASS
EDIT: Actually, only GUI solutions. I've done a search and found a few JASS solutions, so no need to post them here.
 
I think you want a IsUnitBehindUnit checker?
I quick Jass-->Gui convertion I made:

Trigger:
  • Actions:
    • Set TempReal1 = (Facing of UnitA)
    • Custom script: set udg_TempReal2 = bj_RADTODEG*Atan2(GetUnitY(udg_UnitB)-GetUnitY(udg_UnitA),GetUnitX(udg_UnitB)-GetUnitX(udg_UnitA))
    • Custom script: set udg_IsUnitBehindUnit = not (RAbsBJ(udg_TempReal1-udg_TempReal2) < 90 or RAbsBJ(udg_TempReal1-udg_TempReal2-360) < 90)

This sets the variable IsUnitBehindUnit to true or false, depending on the outcome.

You also need the real variables called TempReal1 and TempReal2, such as two unit variables UnitA and UnitB. The code checks wether UnitB is behind UnitA.

I recommend not to rebuild this with GUI directly and use this Custom Script variant, because it doesn't leak locations.
 
Thanks, but that isn't what I was looking for.

Anyway, I managed to do it myself:
Trigger:
  • SPELL Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SPELL
    • Actions
      • Set caster_point = (Position of (Triggering unit))
      • Set caster_point_offset = (caster_point offset by 1.00 towards (Facing of (Triggering unit)) degrees)
      • Set caster_angle = (Angle from caster_point to caster_point_offset)
      • Set targeted_units = (Units within 500.00 of caster_point matching ...
      • Unit Group - Pick every unit in targeted_units and do (Actions)
        • Loop - Actions
          • Set target_point = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Angle from caster_point to target_point) - caster_angle) Less than or equal to (0.00 + angle_variation)
              • ((Angle from caster_point to target_point) - caster_angle) Greater than or equal to (0.00 - angle_variation)
            • Then - Actions
              • Unit - Create 1 dummy for (Owner of (Triggering unit)) at caster_point facing (Facing of (Triggering unit)) degrees
              • Unit - Add SPELL (Unit) to (Last created unit)
              • Unit - Set level of SPELL (Unit) for (Last created unit) to (Level of SPELL for (Triggering unit))
              • Unit - Add a 1.50 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to USE AN APPROPRIATE ACTION (Picked unit)
            • Else - Actions
          • Custom script: call RemoveLocation (udg_target_point)
      • Custom script: call RemoveLocation (udg_caster_point)
      • Custom script: call RemoveLocation (udg_caster_point_offset)
      • Custom script: call DestroyGroup (udg_targeted_units)


angle_variation has a default value of 40.
 
Why don't you learn Jass? It seems you are familiar with leaking and stuff. Why not try the next step?
 
Why don't I learn JASS?
-I am in Year 12 at the moment, and will be having my end-of-year exams in about 3 weeks
-It takes too long
-Starcraft II is going to be released soon and it may (although I don't know for sure) take away lots of people from Warcraft 3, which may mean there won't be much point making Warcraft 3 maps

However, I did consider it, but never went through with it.
 
Why don't I learn JASS?
-I am in Year 12 at the moment, and will be having my end-of-year exams in about 3 weeks
And still you got the time to map ...:D

-It takes too long
This is simply not true. Jass is not that much different from GUI, if you have Jasshelper. Just browse the function list and you can get everything you need.
GUI is just JASS in disguise.

-Starcraft II is going to be released soon and it may (although I don't know for sure) take away lots of people from Warcraft 3, which may mean there won't be much point making Warcraft 3 maps
Hmm, but you will map when SC2 releases? Isn't it practical to get experience with coding before SC2 comes out so you don't have to stick to SC2's GUI?
 
When using "Facing Angle" it gives you a value between 0 and 360.
When using "Angle Between Points" it gives you a value between -180 and 180.

Is there a simple way to make "Angle Between Points" return a value between 0 to 360?

just do ((Angle from point1 to point2) + 180.00) that should do the trick.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top