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?
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