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.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
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.
 

Zurtrogx

Active Member
Reaction score
24
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.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
Why don't you learn Jass? It seems you are familiar with leaking and stuff. Why not try the next step?
 

Zurtrogx

Active Member
Reaction score
24
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.
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
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?
 

Grymlax

Probably not around
Reaction score
138
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
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top