Hello! Im working on a wc3 map but i got some problem. I want to make so when you take damage, you gets knockbacked and if you hit a wall you will bounce. I've googled it and search here to try find a easy way to detect if the wall is vertical or horizontal.
Here on thehelper i found one but of some reason it doesn't work on my map on the horizontalwalls. It works perfect on the vertical.
Heres the walldetection i use now created by MoonSlinger. I made some few changes like changing so it detecting the height of a cliff and increased the detectionrange infront of the unit from 30 to 180. I dont understand why it wont work?!
My question to you is, do you know another way?
Here on thehelper i found one but of some reason it doesn't work on my map on the horizontalwalls. It works perfect on the vertical.
Heres the walldetection i use now created by MoonSlinger. I made some few changes like changing so it detecting the height of a cliff and increased the detectionrange infront of the unit from 30 to 180. I dont understand why it wont work?!
Code:
Slide
Events
Time - Every 0.05 seconds of game time
Conditions
Actions
Unit Group - Pick every unit in MovingUnits and do (Actions)
Loop - Actions
Set UnitPoint = (Position of (Picked unit))
Set MovePoint = (UnitPoint offset by 30.00 towards UnitMoveDirection[(Custom value of (Picked unit))] degrees)
Unit - Move (Picked unit) instantly to MovePoint
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at MovePoint) Equal to Lordaeron Summer - Dark Grass
Then - Actions
Game - Display to (All players) the text: Collision Detected
For each (Integer A) from 1 to 4, do (Actions)
Loop - Actions
Set TestPoint = (UnitPoint offset by 30.00 towards (90.00 x (Real((Integer A)))) degrees)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Terrain type at TestPoint) Equal to Lordaeron Summer - Dark Grass
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Integer A) mod 2) Equal to 1
Then - Actions
Set UnitMoveDirection[(Custom value of (Picked unit))] = (0.00 - UnitMoveDirection[(Custom value of (Picked unit))])
Unit - Make (Picked unit) face UnitMoveDirection[(Custom value of (Picked unit))] over 0.00 seconds
Else - Actions
Set UnitMoveDirection[(Custom value of (Picked unit))] = (180.00 - UnitMoveDirection[(Custom value of (Picked unit))])
Unit - Make (Picked unit) face UnitMoveDirection[(Custom value of (Picked unit))] over 0.00 seconds
Else - Actions
Else - Actions
My question to you is, do you know another way?