It works- but there are some rather glaring issues that I don't understand.
When I push W+D for Up+right, it works. When I let go of D without letting go of W and then push A for up-left, my character stops. Looking in the trigger debugger, it shows that despite releasing the D key, the trigger never thought that I did. I'm not sure why.
did you have the movement trigger on a loop periodic timer event, so it checks whether varaible W=True and A= True every .2 seconds is the sweet spot. Seems like you either dont have a loop function or your movement loop function is not set properly. May need to give ppl a look at ur triggers with a screenshot or sumthing. Too little information to determine the problem.
It's basically just a modified movement update version that I found awhile back from someone... I can't remember who.
UpdateMovementEventsTimer-Every0.002secondsofGameTimeLocalVariablesDistancePerInterval=(Speed*RefreshRate)<Real>MovementDirection=(Currentcamerayawofplayer1)<Real>ConditionsActionsGeneral-If(Conditions)thendomultiple(Actions)IfThenElseGeneral-Elseif(Conditions)thendo(Actions)ElseIfWASDKeys[0] == true
WASD Keys[1] == false
WASD Keys[2] == false
WASD Keys[3] == false
Then
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == false
WASD Keys[1] == false
WASD Keys[2] == true
WASD Keys[3] == false
Then
Variable - Set Movement Direction = (Movement Direction + Backwards)
Variable - Set Distance Per Interval = (Distance Per Interval * Reverse Multiplier)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == false
WASD Keys[1] == true
WASD Keys[2] == false
WASD Keys[3] == false
Then
Variable - Set Movement Direction = (Movement Direction + Left)
Variable - Set Distance Per Interval = (Distance Per Interval * Strafe Multiplier)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == false
WASD Keys[1] == false
WASD Keys[2] == false
WASD Keys[3] == true
Then
Variable - Set Movement Direction = (Movement Direction + Right)
Variable - Set Distance Per Interval = (Distance Per Interval * Strafe Multiplier)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == true
WASD Keys[1] == true
WASD Keys[2] == false
WASD Keys[3] == false
Then
Variable - Set Movement Direction = (Movement Direction + Forward Left)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == true
WASD Keys[1] == false
WASD Keys[2] == false
WASD Keys[3] == true
Then
Variable - Set Movement Direction = (Movement Direction + Forward Right)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == false
WASD Keys[1] == true
WASD Keys[2] == true
WASD Keys[3] == false
Then
Variable - Set Movement Direction = (Movement Direction + Backward Right)
Variable - Set Distance Per Interval = (Distance Per Interval * Strafe Multiplier)
General - Else if (Conditions) then do (Actions)
Else If
WASD Keys[0] == false
WASD Keys[1] == false
WASD Keys[2] == true
WASD Keys[3] == true
Then
Variable - Set Movement Direction = (Movement Direction + Backward Left)
Variable - Set Distance Per Interval = (Distance Per Interval * Strafe Multiplier)
General - Else if (Conditions) then do (Actions)
Else If
Then
Animation - Play Stand animation for (Actor for Hero [43.38,226.05]) as Default, using Play Forever, Model Driven Looping options and Default Time blend time
Trigger - Stop all instances of Update Movement
Trigger - Turn (Current trigger) Off
General - If (Conditions) then do (Actions) else do (Actions)
If
(((Position of Hero [43.38,226.05]) offset by Distance Per Interval towards Movement Direction degrees) is passable) == true
Then
Variable - Set Movement Direction = Movement Direction
Unit - Move Hero [43.38,226.05] instantly to ((Position of Hero [43.38,226.05]) offset by Distance Per Interval towards Movement Direction degrees) (Blend)
Else
Edit: Wow, that turned out really shitty. Uh... I'll do a screenshot tomorrow. xD
ouch thats very disgusting trigger format you got there. Here's a more simpler and cleaner way of doing this.
Have 4 triggers one for each key that is pressed of WASD, fire then event when that certain key is pressed. Have each of these triggers set the variable true when pressed, then make another 4 triggers doing the exact opposite and turn those variables false when pressed up. Example, W=True when pressed down, W=False when pressed up.
Now make a loop trigger for every .05 second timer peroidic. Use 8 if then else actions, dont use if then else multiple, no need. Don't have them chained together, have them separated. If you link them together it actually slows down the trigger cuz it needs to check if then else and reach the last action last which is the slowest one. In other words, leave the else option blank.
Now for each of the if then else. have conditions if W=true, A=false, d=false, s=false, etc, each different for the 8 mover actions, now for each of the 8 mover actions issue an order for the unit to move to a set distance and if you are moving relative to the camera, use offset by polar, and use towards camera yaw of triggering player, like in shooter game camera views. If you are using by the deault RTS camera angle then use might want to use angle facing of triggering unit. now you will need to have an offset of X degrees so that the unit moves in 8 positions relative which ever camera you are using by arthhmetric function.
So just 8 key triggers and 1 movement loop triggers with 8 if then else actions in it.
From looking at your trigger set closer, I still dont see a problem cuz I will need to see what makes the unit move to the top right, top left, bottom right, bottom left. Overall, there are too many actions that are unessary and all can be done with less triggers and variables.
You dont need a turn off/on trigger for the movement trigger, remove that, also would be wise to move the walk animator to the movement trigger so that you dont need 8 of those, just 1. Just follow what I wrote, I think you've made it too complex with too many steps. I still don't see problems yet. You will need to give me the file. Otherwise restart your movement system.
Actually i could see where hes going with the movement triggers.
Press:
Press W
Events
UI - Player 1 presses W key Down with shift Allow, control Allow, alt Allow
UI - Player 2 presses W key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
------- Command your unit to move
Variable - Set W[(Triggering player)] = true
Animation - Clear the Default animation for (Actor for PlayerUnit[(Triggering player)])
Trigger - Run Unzoom (Check Conditions, Don't Wait until it finishes)
Release:
Release W
Events
UI - Player 1 presses W key Up with shift Allow, control Allow, alt Allow
UI - Player 2 presses W key Up with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
------- Command your unit to stop moving
Variable - Set W[(Triggering player)] = false
Actuall Move tigger:
Move Player Unit
Events
Timer - Every 0.04 seconds of Game Time
Local Variables
Player = 0 <Integer>
Conditions
Actions
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
Variable - Set Player = (Picked player)
------- W
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == false
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards (Current camera yaw of player Player) degrees)) (Replace Existing Orders)
Else
------- A
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == true
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 90.0) degrees)) (Replace Existing Orders)
Else
------- S
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == true
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 180.0) degrees)) (Replace Existing Orders)
Else
------- D
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == false
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -90.0) degrees)) (Replace Existing Orders)
Else
------- WA
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == true
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 45.0) degrees)) (Replace Existing Orders)
Else
------- WD
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == false
S[Player] == false
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -45.0) degrees)) (Replace Existing Orders)
Else
------- SA
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == true
S[Player] == true
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 135.0) degrees)) (Replace Existing Orders)
Else
------- SD
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == true
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -135.0) degrees)) (Replace Existing Orders)
Else
It works- but there are some rather glaring issues that I don't understand. When I push W+D for Up+right, it works. When I let go of D without letting go of W and then push A for up-left, my character stops. Looking in the trigger debugger, it shows that despite releasing the D key, the trigger never thought that I did. I'm not sure why.
did you have the movement trigger on a loop periodic timer event, so it checks whether varaible W=True and A= True every .2 seconds is the sweet spot. Seems like you either dont have a loop function or your movement loop function is not set properly. May need to give ppl a look at ur triggers with a screenshot or sumthing. Too little information to determine the problem.
It's basically just a modified movement update version that I found awhile back from someone... I can't remember who.
Edit: Wow, that turned out really shitty. Uh... I'll do a screenshot tomorrow. xD
Edit by Moderator: Fixed for you
ouch thats very disgusting trigger format you got there. Here's a more simpler and cleaner way of doing this.
Have 4 triggers one for each key that is pressed of WASD, fire then event when that certain key is pressed. Have each of these triggers set the variable true when pressed, then make another 4 triggers doing the exact opposite and turn those variables false when pressed up. Example, W=True when pressed down, W=False when pressed up.
Now make a loop trigger for every .05 second timer peroidic. Use 8 if then else actions, dont use if then else multiple, no need. Don't have them chained together, have them separated. If you link them together it actually slows down the trigger cuz it needs to check if then else and reach the last action last which is the slowest one. In other words, leave the else option blank.
Now for each of the if then else. have conditions if W=true, A=false, d=false, s=false, etc, each different for the 8 mover actions, now for each of the 8 mover actions issue an order for the unit to move to a set distance and if you are moving relative to the camera, use offset by polar, and use towards camera yaw of triggering player, like in shooter game camera views. If you are using by the deault RTS camera angle then use might want to use angle facing of triggering unit. now you will need to have an offset of X degrees so that the unit moves in 8 positions relative which ever camera you are using by arthhmetric function.
So just 8 key triggers and 1 movement loop triggers with 8 if then else actions in it.
Hope this helps.
From looking at your trigger set closer, I still dont see a problem cuz I will need to see what makes the unit move to the top right, top left, bottom right, bottom left. Overall, there are too many actions that are unessary and all can be done with less triggers and variables.
They're all like that one, but changed the 1 to the appropriate number. There are 'released' triggers as well that turn off the variable.
@Zetal: Go
You dont need a turn off/on trigger for the movement trigger, remove that, also would be wise to move the walk animator to the movement trigger so that you dont need 8 of those, just 1. Just follow what I wrote, I think you've made it too complex with too many steps. I still don't see problems yet. You will need to give me the file. Otherwise restart your movement system.
You mean the update movement trigger? Wouldn't keeping it on all the time cause lag/framerate drops? The map lags enough already I think.
@gamfvr:
Actually i could see where hes going with the movement triggers.
Press:
Press W
Events
UI - Player 1 presses W key Down with shift Allow, control Allow, alt Allow
UI - Player 2 presses W key Down with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
------- Command your unit to move
Variable - Set W[(Triggering player)] = true
Animation - Clear the Default animation for (Actor for PlayerUnit[(Triggering player)])
Trigger - Run Unzoom (Check Conditions, Don't Wait until it finishes)
Release:
Release W
Events
UI - Player 1 presses W key Up with shift Allow, control Allow, alt Allow
UI - Player 2 presses W key Up with shift Allow, control Allow, alt Allow
Local Variables
Conditions
Actions
------- Command your unit to stop moving
Variable - Set W[(Triggering player)] = false
Actuall Move tigger:
Move Player Unit
Events
Timer - Every 0.04 seconds of Game Time
Local Variables
Player = 0 <Integer>
Conditions
Actions
Player Group - Pick each player in (Active Players) and do (Actions)
Actions
Variable - Set Player = (Picked player)
------- W
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == false
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards (Current camera yaw of player Player) degrees)) (Replace Existing Orders)
Else
------- A
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == true
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 90.0) degrees)) (Replace Existing Orders)
Else
------- S
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == true
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 180.0) degrees)) (Replace Existing Orders)
Else
------- D
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == false
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -90.0) degrees)) (Replace Existing Orders)
Else
------- WA
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == true
S[Player] == false
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 45.0) degrees)) (Replace Existing Orders)
Else
------- WD
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == true
A[Player] == false
S[Player] == false
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -45.0) degrees)) (Replace Existing Orders)
Else
------- SA
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == true
S[Player] == true
D[Player] == false
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + 135.0) degrees)) (Replace Existing Orders)
Else
------- SD
General - If (Conditions) then do (Actions) else do (Actions)
If
And
Conditions
W[Player] == false
A[Player] == false
S[Player] == true
D[Player] == true
Then
Unit - Order PlayerUnit[Player] to ( Move targeting ((Position of PlayerUnit[Player]) offset by 0.5 towards ((Current camera yaw of player Player) + -135.0) degrees)) (Replace Existing Orders)
Else
Theres allwas ways to do stuff simpler..
@doite: Go
instead of using player variable use picked player, and instead of having 2 events for player 1 and player 2, use "any"