MV Mouse click on event but only if the player character is standing next to the event.

So I have recently moved from VX Ace to MV and in a game I had created in VX Ace I had disabled mouse click for movement and only allowed WASD for movement. However, you could left click an event to activate it (e.g. a door or chest) but only if you were standing next to it.

I am trying to replicate this in MV - I have used AS_InputSettings.js to disable mouse click movement and allow WASD movement.

I have TDDP_MouseSystemEx.js to allow mouse click to activate an event but the problem is that the character can be on one side of a map and open a chest on the other side of the map without moving to it. Does anyone know how I can put some sort of check in to make sure the player is standing next to the event before they can click on it?

I know yanfly has heaps of scripts including a touch input disabler but I wasn't sure if any of them did what I was after before I bought the bundle.

This is the last thing I need working before I can call my basic game template done.

Thanks in advance
Moved to: Plugin Requests

You area already using two mouse plugins, I'm not sure you want to add a third one.

Are you using those plugins for anything else? If not, I'd get rid of both of them, and just have a single plugin that disables movement by mouse click.

try this:
Sorry about posting in the wrong location.

I was also going to use TDDP_MouseSystemEx.js to change icons when I hovering over events as well.

I had tried using this which was in that same thread you linked to above;

Game_Temp.prototype.setDestination = function(x, y) {
return; // <---- add this line here
this._destinationX = x;
this._destinationY = y;
};

It disables the click movement which is great, but still doesn't allow click to activate unless I use
TDDP_MouseSystemEx.js - but this then allows the character to be anywhere on the map to click the event.

I did mess around using a self switch that was activated by player touch which then went to the second page which had the comment click_activate!. and this then turns self switch A off. This sort of works except if the player clicks on it and closes out of the event they then have to take a step away and then a step back into the event to trigger the player touch to allow them to click on it again.

Not a major issue but might be annoying for some players.

1609640480327.png


1609640514375.png
Click to active when you're standing next to the event is default behaviour, so you have something that turns it off. Try disabling the other two plugins and see if it works just with what I gave you.

Also, it's better to copy that bit of code I gave you and place it into a plugin rather than editing the core files. That means whenever you take an update, you won't have to go and redo that.
Thanks for the tip I have made it a plugin rather than editing the source code.
I have removed all plugins except the one I just created and TDDP_MouseSystemEx.js,
it seems that TDDP_MouseSystemEx.js just has no restrictions once it is turned on your Character can be on one side of the map and you can still click on an event and activate it on the other side of the map.

There just doesn't seem to be something that checks first to see if the Character is standing next to the event. And that's what I want, a player can only click on a door or treasure chest if they are standing next to it. At the moment they could be next to it or they could be 10 tiles away there is no check.
alternatively you could also do some conditional check at the top of your 'clickable event' for player and event position (x and y) and see does the event is standing next to it... if not jump to label to skip the event command and do nothing.
Is there another plugin you can use for changing icons when the mouse hovers?
@estriole - yeah I was wondering if that would be a viable option or if it should be a plugin. I would assume I could set part of it up as a common even so I don't have to add multiple lines each time to an event.

@Shaz I'm happy to use whatever plugin is available, I'm not fixed on using any certain one as long as I can get it working happily together.

Original thread: https://forums.rpgmakerweb.com/threads/mouse-click-on-event-but-only-if-the-player-character-is-standing-next-to-the-event.131723/