1. Is there a way via triggers I can check cliff levels at certain points? I would like to store cliff levels into a variable integer.
2. I want to know if its possible to create coordinates at a distance from where a unit is facing. Imagine (Point A aka unit facing) is an arrow pointing a certain direction and at a certain distance is (Point B). How do I get the X and Y position for Point B assuming I know the distance between the two points?
If your wondering if these two questions are related then the answer is yes. My goal is to check cliff height certain distances from where the unit is facing.
Edit: Hmm, I guess the second question is sort of like trying to find the coordinates of the edge of a circle on a big grid at an angle from the center of the circle. The distance between Point A and Point B represent the radius of the circle.
I'm assuming it has something to do with plugging in the position of the center of the circle, the size of each unit of the grid, the angle, and the circumference into some sort of equation.
WOW, I can not freaking believe I solved the answer to my second question without knowing anything about what I was doing.
This is the Action.
Point - Move Point B To ((Position of Player 1 Hero) offset by 10.0 towards (Facing of Player 1 Hero) degrees)
Point B is a point variable and Player 1 Hero is a unit variable which also represents Point A in my above post. Obviously the offset can be set to whatever the desired distance is between the unit and Point B.
Anyway, apparently what I was looking for was called a Polar offset which is the distance from something at an angle.
All I need to do now is figure out how to determine cliff levels at Point B.
Edit: I actually tested some stuff out and there seems to be a few issues. I created the action and condition I described.
When a player presses a key the Point B variable is set via action from the above post. Right after the set variable action there is a "if, then, else" statement.
If the player units cliff level is not equal to Point B it will tell me via text message and if it is equal then it will tell me that as well via text message.
Here is the trigger.
EventsUI-PlayerAnyPlayerpressesTabkeyDownwithshiftAllow,controlAllow,altAllowLocalVariablesPointB=NoPoint<Point>ConditionsActionsPoint-MovePointBTo((PositionofPlayer1Hero)offsetby50.0towards(FacingofPlayer1Hero)degrees)General-If(Conditions)thendo(Actions)elsedo(Actions)If(Clifflevelof(PositionofPlayer1Hero))!=(ClifflevelofPointB)ThenUI-Display"Cliff Detected at 50."for(Allplayers)toSubtitleareaElseUI-Display"Cliff Not Detected At 50."for(Allplayers)toSubtitlearea
Player 1 Hero is actually a Global Variable if your wondering why its not set in this trigger.
I get this error message in game.
'PointSet' (value:0)
Trigger Error in gt_Polaroffset_Func: Could not get 'point' from Parameter in 'PointPathingCliffLevel' (value:0)
If anyone knows what this means then any info would be much appreciated.
Variable - Set Point B = ((Position of Player 1 Hero) offset by 50.0 towards (Facing of Player 1 Hero) degrees)
So I need to make that?(Can't test atm)
Edit: It works perfectly!!!
I'm going to try to implement this into a WASD movement system via triggers.
The idea being that the trigger can check various distances in front of the unit then order them to move based on the distance to the nearest cliff, unit, doodad that blocks path, etc etc.
This will prevent people from having to constantly run a trigger over and over again using a periodic event. I'm hoping that maybe this will result in significantly less lag using this type of movement via triggers.
Anyway with that said this was the first step I felt I needed to take.
1. Is there a way via triggers I can check cliff levels at certain points? I would like to store cliff levels into a variable integer.
2. I want to know if its possible to create coordinates at a distance from where a unit is facing. Imagine (Point A aka unit facing) is an arrow pointing a certain direction and at a certain distance is (Point B). How do I get the X and Y position for Point B assuming I know the distance between the two points?
If your wondering if these two questions are related then the answer is yes. My goal is to check cliff height certain distances from where the unit is facing.
Edit: Hmm, I guess the second question is sort of like trying to find the coordinates of the edge of a circle on a big grid at an angle from the center of the circle. The distance between Point A and Point B represent the radius of the circle.
I'm assuming it has something to do with plugging in the position of the center of the circle, the size of each unit of the grid, the angle, and the circumference into some sort of equation.
@Writhes: Go
WOW, I can not freaking believe I solved the answer to my second question without knowing anything about what I was doing.
This is the Action.
Point - Move Point B To ((Position of Player 1 Hero) offset by 10.0 towards (Facing of Player 1 Hero) degrees)
Point B is a point variable and Player 1 Hero is a unit variable which also represents Point A in my above post. Obviously the offset can be set to whatever the desired distance is between the unit and Point B.
Anyway, apparently what I was looking for was called a Polar offset which is the distance from something at an angle.
All I need to do now is figure out how to determine cliff levels at Point B.
Edit: I actually tested some stuff out and there seems to be a few issues. I created the action and condition I described.
When a player presses a key the Point B variable is set via action from the above post. Right after the set variable action there is a "if, then, else" statement.
If the player units cliff level is not equal to Point B it will tell me via text message and if it is equal then it will tell me that as well via text message.
Here is the trigger.
Player 1 Hero is actually a Global Variable if your wondering why its not set in this trigger.
I get this error message in game.
'PointSet' (value:0) Trigger Error in gt_Polaroffset_Func: Could not get 'point' from Parameter in 'PointPathingCliffLevel' (value:0)
If anyone knows what this means then any info would be much appreciated.
@Writhes: Go
you need to set the variable first right now it is just equal to No Point, trying using Set variable instead of Move Point
@Usernameisntworkingright: Go
Variable - Set Point B = ((Position of Player 1 Hero) offset by 50.0 towards (Facing of Player 1 Hero) degrees)
So I need to make that?(Can't test atm)
Edit: It works perfectly!!!
I'm going to try to implement this into a WASD movement system via triggers.
The idea being that the trigger can check various distances in front of the unit then order them to move based on the distance to the nearest cliff, unit, doodad that blocks path, etc etc.
This will prevent people from having to constantly run a trigger over and over again using a periodic event. I'm hoping that maybe this will result in significantly less lag using this type of movement via triggers.
Anyway with that said this was the first step I felt I needed to take.