How to change the controls by script call?

Hello!

I want to change controls by script call. In some particular moment left is right, right is left... ect. I know that there is some way to do this by event but I would prefer do this through script call.

Thank you in advance.
a script call cannot do this, you'll need either a full script or a plugin depending on which maker you're using.
a script call cannot do this, you'll need either a full script or a plugin depending on which maker you're using.
I use RPG Maker MV. Which plugin should I use?
it may be done by scriptcall, but it isn't saved when doing, as saving
and loading will reversed it back to the original form.

to make it work (maybe by switch ID) to reverse it, it can be saved
if done correctly.

so it would be recommended for a plugin for best compability.
I dont know if there is one available, although I saw a few post requested
this as well.
it may be done by scriptcall, but it isn't saved when doing, as saving
and loading will reversed it back to the original form.

to make it work (maybe by switch ID) to reverse it, it can be saved
if done correctly.

so it would be recommended for a plugin for best compability.
I dont know if there is one available, although I saw a few post requested
this as well.
What does this script look like? Where to find this?
The keys are stored in Input.keyMapper, in rpg_core.js.

To change a value during play, use the index of the keyboard button and set it equal to the function you want. For example:
Code:
Input.keyMapper[37]="right";

will make the left arrow move right.

However, as previously mentioned, I believe those changes don't save if the player saves in that area and reloads, and you have to make sure every key that could go that direction is done.

I think it would be way easier for you to go to the function that executes player movement and add a line that goes the opposite direction if you have a game switch turned on.
you need to set a keyCode check like this one to press any key,
and use that to check, than you need to tell what you want to do,
so it would be reversed or not. (this isn't saved on saved files.
You can use this plugin. Just put the ID of the switch that you want to use in the plugin parameters, and then any time that switch is on, movement will be reversed.
nicely done Arthran =)
you might set it to new thread for it, as people would need it.
You can use this plugin. Just put the ID of the switch that you want to use in the plugin parameters, and then any time that switch is on, movement will be reversed.
Thank you for doing it for me but this does't seem to work with wasd movement. Also is there any chance to make not only reversed movement but when up is left, down is right, left is down, right is up, up is right, down is left, left is up, right is down?
it require more checks, maybe more switches, depends on what
switch is ON, it take that action, WASD probably need a slightly
modification or a tiny patch if you use a WASD plugin.
Thank you for doing it for me but this does't seem to work with wasd movement. Also is there any chance to make not only reversed movement but when up is left, down is right, left is down, right is up, up is right, down is left, left is up, right is down?
Are you certain that you tried it properly? It should work fine with WASD movement, as I did not tie it to any specific keys.

It's possible to implement the additional feature that you're requesting, but I'm not going to mess with it until we get to the bottom of why it's supposedly not working for you.

What plugin are you using to implement WASD movement?
Are you certain that you tried it properly? It should work fine with WASD movement, as I did not tie it to any specific keys.

It's possible to implement the additional feature that you're requesting, but I'm not going to mess with it until we get to the bottom of why it's supposedly not working for you.

What plugin are you using to implement WASD movement?
I am using mv3d. There is an option to change it to wasd.
Are you certain that you tried it properly? It should work fine with WASD movement, as I did not tie it to any specific keys.

It's possible to implement the additional feature that you're requesting, but I'm not going to mess with it until we get to the bottom of why it's supposedly not working for you.

What plugin are you using to implement WASD movement?
In this plugin it looks like this:

Spoiler: code
input_mv3d.setupInput = function () {
if (!input_mv3d.WASD) {return;}
Object.assign(Input.keyMapper, {
81: 'rotleft', // Q
69: 'rotright', // E
87: 'up', // W
65: 'left', // A
83: 'down', // S
68: 'right' // D
});

Maybe there is a chance to write additional code lines with condition: if certain switch is on then the controls change, diffrent keys are bind to input?
In this plugin it looks like this:

Spoiler: code
input_mv3d.setupInput = function () {
if (!input_mv3d.WASD) {return;}
Object.assign(Input.keyMapper, {
81: 'rotleft', // Q
69: 'rotright', // E
87: 'up', // W
65: 'left', // A
83: 'down', // S
68: 'right' // D
});

Maybe there is a chance to write additional code lines with condition: if certain switch is on then the controls change, diffrent keys are bind to input?
That snippet should have no bearing on my plugin. My plugin doesn't depend on key bindings at all. It overwrites the actual movement function, and changes the directions internally, so the keys used to produce those directions should be entirely irrelevant.

It's possible that mv3d is also overwriting the movement function, or that it uses a new movement function altogether, and that that is causing some kind of conflict, but I've never used mv3d, so I don't know. To be honest with you, I'm not really wanting to go read up mv3d right now to learn how to set it up and stuff in order to get to the bottom of this. But if you're willing to PM me a link to your project, or a new project that demonstrates the issue, then I don't mind trying to make this work for you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-the-controls-by-script-call.150768/