In a conditional branch, what do we write in the script box to check if the player is moving or idle?
Is there a help file on scripting where I can read more about conditions I can use via scripting?
Thank you in advance
$gamePlayer.isMoving() returns true or false
No help file on RM scripting - just got to look through the .js files themselves. rpg_objects.js is the one that I find most useful for script calls in the Script, Conditional Branch, Change Variable, etc commands.
How do you check if the state in the script is false?
Conditional Branch: Script: $gamePlayer.isMoving()
... this gets executed if it's true (player is moving)
Else
... this gets executed if it's false (player is not moving)
Branch End
Or if you only want to do something if the player is idle, and don't want to do anything if they're moving,
Conditional Branch: Script: !$gamePlayer.isMoving()
... this gets executed if the player is not moving
Branch End
(no Else branch required)
Ok lets say I want to set a paralel process common event where a picture is shown while the player is moving and another is shown when the player is idle.
Using that script as a condition in a conditional branch results in the walking picture flashing to the idle picture as the player is moving. What I get out of this is that the gamePlayer.isMoving() is not constantly true while you move the player, but rather is switches on and off constantly for some reason.
How do I get a condition that doesnt do that and stays true while the player is moving?
Yeah, I think the player is moving as they go from one tile to the next, and then they pause waiting for the next input.
You might want to add a delay or something after the conditional branch - a Wait 5 Frames or something. It'll reduce the flickering, but it won't eliminate it altogether.
Other things you can look at are $gameTemp.isDestinationValid() which will return true if the mouse button has been clicked for pathfinding, or Input.dir4 (which will be 0 if no keys have been pressed). I will let you spend some time trying to figure out how to combine them.
If you use $gameTemp.isDestinationValid() in place of gamePlayer.isMoving() it works perfectly. I know this is a dead thread just wanted to solve the issue for anyone else looking for this like I was. If you take a conditional searching for $gameTemp.isDestinationValid() and place a conditional for gamePlayer.isDashing() inside of it, you can toggle dashing charsets without needing a plugin. You just have to put an event in Else for $gameTemp.isDestinationValid() that resets your sprites to walking. Hope this helps someone poking around for this like I was.