Conditionnal Branch for facing diagonal

Hi everyone,


i am trying to conditional branch when player facing diagonal movement in an event.


The idea behind this is  if player is facing UPPER_R  then do an action


i have try a lot of thing more than the following but without success :


if: Script $gamePlayer.Input.dir8 == 9


If :Script Game_Character.ROUTE_MOVE_UPPER_R


If: Script this.moveDiagonally(6, 8);


I have a little experience at javascript. I am turning around on that now for a few day and i am running out of idea.. any tips would be appreciated.


Edit : I have found a solution see image attachement.

playerisfacingdiagonal.jpg
If I am right you are trying to check the direction the player is facing? You can do that in the 3rd tab of Conditional Branch under character then you can check which direction any event on that map is facing.
Yes Exactly. The only thing is in the 3rd tab of Conditional Branch under character choice:


Down = 2 // on the numeric keypad


Left =   4 // on the numeric keypad


Right = 6 // on the numeric keypad


Up =     8 // on the numeric keypad


What about 1, 3, 7, 9 that correspond to diagonal movement


LOWER_Left     =  1 // on the numeric keypad
LOWER_Right      =  3 // on the numeric keypad
UPPER_Left       =    7 // on the numeric keypad
UPPER_Right      =  9 // on the numeric keypad


It work now with an event condition =  if button Up and button Right are pressed set varposition to 9, i can then call varposition to instruct an action


But : button keyboard must be triggered ( key on the numeric pad)


What about if the character is facing a diagonal direction like north-east  without an key press triggered ?


How to instruct the engine that a character is facing north-east or south-west ?
Are you using a plugin to move with the numpad? If so I would ask the developer of the plugin.
Are you using a plugin to move with the numpad? If so I would ask the developer of the plugin.
As I typed in the original post, I use MV3D and turn with mouse and walk with wasd so not using num keys.
This is a six year old thread written by someone else (despite you making a comment about you writing the original post).
Even if you have a similar question, you should start your own thread about it as neither of the other posters involved in this thread have been here for years.
This is a six year old thread written by someone else (despite you making a comment about you writing the original post).
Even if you have a similar question, you should start your own thread about it as neither of the other posters involved in this thread have been here for years.
Yeah I'm sorry I made a similar thread and I thought this reply was on my thread I getting too old for forums. Sorry for the mixup ❤️

Original thread: https://forums.rpgmakerweb.com/threads/conditionnal-branch-for-facing-diagonal.57567/