MV (Solved) VE_DiagonalMovement won't toggle click-based diagonal movement

Solved! @Mac15001900 provided a fix.



Hello, everyone!
Thanks in advance for any help provided!

I currently use the Victor Engine's Diagonal Movement plugin in my game.

The problem is that I want to temporarily turn off the diagonal movement at a certain part of the game, but mouse input can still trigger it. In other words, I can toggle diagonal movement for keyboard input but can't for mouse/touch input.

It also doesn't seem to be a compatibility issue, as I've just tried deactivating all but the necessary plugins (in my case, OrangeGreenworks, SRD_TranslationEngine, VE_BasicModule, and VE_DiagonalMovement) and it still happens.

My javascript knowledge is rather limited, but I've looked into the code and tried using the plugin command DiagonalMovement off player and the following script call:
JavaScript:
$gamePlayer.setDiagonalOff();

ChatGPT also suggested using the following script call:
JavaScript:
Input.virtualDiagonalEnabled = false;

None of them disables diagonal movement through mouse input, only through keyboard input (and probably gamepad input, I haven't tested it).

I'd rather find a fix than use another plugin in the current state of my game.
An alternative fix would be to find a way to prevent diagonal movement when clicking on specific events or walking towards them, but I think that would be even more complicated.

I'd appreciate any help since I couldn't fix it by myself and Victor Sant hasn't posted or commented anything here or on his website since 2018.
I can provide any other information and Steam keys if necessary.

Thank you!
Looks like for whatever reason pathfinding is not affected by this toggle, and thus any pathfinding-based movement won't be affected. You should be able to modify it fairly easily: below line 340 (var direction = list[i]) insert this:
if (!this.isDiagonalEnabled() && direction % 2 !== 0) continue;

It should stop pathfinding from considering diagonal options when diagonal movement is disabled.
Then you should be able to disable it normally, with the plugin command or the scriptcall.
Looks like for whatever reason pathfinding is not affected by this toggle, and thus any pathfinding-based movement won't be affected. You should be able to modify it fairly easily: below line 340 (var direction = list[i]) insert this:
if (!this.isDiagonalEnabled() && direction % 2 !== 0) continue;

It should stop pathfinding from considering diagonal options when diagonal movement is disabled.
Then you should be able to disable it normally, with the plugin command or the scriptcall.
Thank you very muuuuuch! Both work now, the plugin command (DiagonalMovement off player) and the plugin's script call ($gamePlayer.setDiagonalOff();). They make a difference in both mouse and keyboard input movements when turning on and off.

ChatGPT's solution (Input.virtualDiagonalEnabled = false;), on the other hand, seems useless, as it doesn't make a difference if true or false.

And this is one more time that @Mac15001900 helps me fix something. Thanks a lot! :LZYcheeze::LZYcat:
This thread is being closed due to being reported as solved. If you need it reopened, let us know. Thank you!

Original thread: https://forums.rpgmakerweb.com/threads/solved-ve_diagonalmovement-wont-toggle-click-based-diagonal-movement.167941/