Button that when hold only lets you move diagonally (Edit to any diagonal movement script)

Like in most mystery dungeon games, whenever the player holds down a specific button, the player can only move diagonally.


I'm not asking anyone to create a diagonal movement script from scratch, this could just be an add-on or edit to any diagonal movement script of your choice. At the movement, I'm using Victor Diagonal Movement.
As there are 4 diagonal movements, presumably you are asking for something which uses 4 different buttons.  Is that correct?


I am unfamiliar with Victor's Diagonal Movement script.  How many buttons do you hold down in that one?  The reason that I ask is that the script I use requires 2 - If you want to move northwest, you press the up and left arrow key; if you want to move south west you press the down and left key, and so on.  I suspect it might be difficult to have less than 2.  It might be easier on the player to use 2 keys they are familiar with, rather than introducing 4 others.
As there are 4 diagonal movements, presumably you are asking for something which uses 4 different buttons.  Is that correct?


I am unfamiliar with Victor's Diagonal Movement script.  How many buttons do you hold down in that one?  The reason that I ask is that the script I use requires 2 - If you want to move northwest, you press the up and left arrow key; if you want to move south west you press the down and left key, and so on.  I suspect it might be difficult to have less than 2.  It might be easier on the player to use 2 keys they are familiar with, rather than introducing 4 others.

Not what I'm asking for at all.


I don't want to change the buttons that allows the player to move diagonally, that will still be executed by pressing two arrow keys adjacent to each other.


A better way to ask what I'm looking for is a single button, say the 'S' key, that when held down DISALLOWS the player to move in the traditional 4 direction and the player can only move in the diagonal directions. Naturally, when the button is not pressed, the player can move in all 8 directions normally.


I'm asking for this because I'm making a game where precision is key, and to move diagonal on the fly is a bit tricky with buttons.
Oh, I see.  Yes, that makes more sense now.
You can try to use this:

Spoiler
class Game_Player < Game_Character

alias fix_smove7726 move_by_input
def move_by_input
return if Input.press?🙂CTRL)
fix_smove7726
end

end



You should probably change the button for it though.


I used CTRL because I was too lazy to check for other button names. 😛


Ohh, and this must be placed above Victor's Diagonal movement!
@Sixth Tried it and it works great! Thank you!


I'll see about closing this thread now.
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/button-that-when-hold-only-lets-you-move-diagonally-edit-to-any-diagonal-movement-script.73170/