What's this degree problem?

R@i_no_Wyrm

New Member
Reaction score
43
I made a locust, and slide it out. Every 0.01 seconds, I check if there's any units around. If yes, pick a random unit (in 50AoE) and I check the angle from 2 points :
1.) Locust point
2.) Picked unit's point.

It worked well if I slide it from 180 - 360 degree, but from 1 - 179 degree it bugs. The angle from the 2 points keeps resulting the opposite of the correct point. Anyone has an idea?

Code:
Arrow Slide n damage
    Events
        Time - Every 0.01 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to 50, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        arrow_dummy[(Integer A)] Not equal to No unit
                    Then - Actions
                        Game - Display to (All players) the text: running
                        Set arrow_last[(Integer A)] = (arrow_last[(Integer A)] - 1)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                arrow_last[(Integer A)] Less than or equal to 0
                            Then - Actions
                                Unit - Remove arrow_dummy[(Integer A)] from the game
                                Set arrow_dummy[(Integer A)] = No unit
                                Game - Display to (All players) the text: The arrow stopped
                                Skip remaining actions
                            Else - Actions
                        Set point1 = (Position of arrow_dummy[(Integer A)])
                        Set point2 = (point1 offset by arrow_speed[(Integer A)] towards arrow_angle[(Integer A)] degrees)
                        Unit - Move arrow_dummy[(Integer A)] instantly to point2
                        Set unit_around[(Integer A)] = (Units within 35.00 of point2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is dead) Equal to False) and ((Owner of (Matching unit)) Not equal to (Owner of arrow_dummy[(Integer A)])))))
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                (unit_around[(Integer A)] is empty) Equal to True
                            Then - Actions
                                Custom script:   call RemoveLocation(udg_point1)
                                Custom script:   call RemoveLocation(udg_point2)
                                Skip remaining actions
                            Else - Actions
                                Game - Display to (All players) the text: the arrow hits some...
                        Set arrow_hit_unit[(Integer A)] = (Random unit from unit_around[(Integer A)])
                        Custom script:   call DestroyGroup(udg_unit_around[GetForLoopIndexA()])
                        Set point3 = (Position of arrow_hit_unit[(Integer A)])
                        Set arrow_accuracy[(Integer A)] = (Angle from point2 to point3)
                        Set arrow_accuracy[(Integer A)] = (arrow_accuracy[(Integer A)] x arrow_accuracy[(Integer A)])
                        Set arrow_accuracy[(Integer A)] = (Square root(arrow_accuracy[(Integer A)]))
                        Set arrow_hitdegree[(Integer A)] = (arrow_accuracy[(Integer A)] - arrow_angle[(Integer A)])
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                arrow_hitdegree[(Integer A)] Less than or equal to 45.00
                                arrow_hitdegree[(Integer A)] Greater than or equal to -45.00
                            Then - Actions
                                Unit - Cause arrow_dummy[(Integer A)] to damage arrow_hit_unit[(Integer A)], dealing (arrow_damage[(Integer A)] x 0.20) damage of attack type Chaos and damage type Normal
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                arrow_hitdegree[(Integer A)] Less than or equal to 30.00
                                arrow_hitdegree[(Integer A)] Greater than or equal to -30.00
                            Then - Actions
                                Unit - Cause arrow_dummy[(Integer A)] to damage arrow_hit_unit[(Integer A)], dealing (arrow_damage[(Integer A)] x 0.30) damage of attack type Chaos and damage type Normal
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                arrow_hitdegree[(Integer A)] Less than or equal to 15.00
                                arrow_hitdegree[(Integer A)] Greater than or equal to -15.00
                            Then - Actions
                                Unit - Cause arrow_dummy[(Integer A)] to damage arrow_hit_unit[(Integer A)], dealing (arrow_damage[(Integer A)] x 0.50) damage of attack type Chaos and damage type Normal
                            Else - Actions
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                arrow_hitdegree[(Integer A)] Less than or equal to 5.00
                                arrow_hitdegree[(Integer A)] Greater than or equal to -5.00
                            Then - Actions
                                Unit - Cause arrow_dummy[(Integer A)] to damage arrow_hit_unit[(Integer A)], dealing (arrow_damage[(Integer A)] x 1.00) damage of attack type Chaos and damage type Normal
                            Else - Actions
                        Game - Display to (All players) the text: ((String(arrow_accuracy[(Integer A)])) + ( -  + ((String(arrow_angle[(Integer A)])) + ( =  + (String(arrow_hitdegree[(Integer A)]))))))
                        Unit - Remove arrow_dummy[(Integer A)] from the game
                        Set arrow_dummy[(Integer A)] = No unit
                        Special Effect - Create a special effect at point3 using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                        Special Effect - Destroy (Last created special effect)
                        Custom script:   call RemoveLocation(udg_point1)
                        Custom script:   call RemoveLocation(udg_point2)
                        Custom script:   call RemoveLocation(udg_point3)
                    Else - Actions
 

R@i_no_Wyrm

New Member
Reaction score
43
*sigh* seems like I can't keep this one from secret.

Edit the 1st trigger a while after this.
Slider to picked. Yes.
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
Of course.
You have a problem, you need to show the problem.

Code:
Set arrow_accuracy[(Integer A)] = (Angle from point2 to point3)
    Set arrow_accuracy[(Integer A)] = (arrow_accuracy[(Integer A)] x arrow_accuracy[(Integer A)])
    Set arrow_accuracy[(Integer A)] = (Square root(arrow_accuracy[(Integer A)]))

Although this probably doesn't have any relations with the problem, I'm just curious about that 3 lines.

So if the angle is 5, you'll get

5
5 x 5 = 25
sqrt25 = 5
(?)

And it's 35.00 AoE, not 50.00
 

darkRae

Ueki Fan (Ueki is watching you)
Reaction score
173
Use Absolute value.
Abs()

It changes negative value to positive value.
Abs(-1337) = 1337
 

R@i_no_Wyrm

New Member
Reaction score
43
the problem is the degree.

Use absolute -->
-5 degree --> 5 degree --> WRONG!

but if not using absolute -->
-5 degree = 355 degree --> but it won't do. you subtract in real!

Fix :
if greater or equal to 360 --> subtract 360
lesser than 0 --> add 360
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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