Disable mouse click movement

Status
Not open for further replies.

Sums

Musician and Writer
Member
Joined
Mar 23, 2015
Messages
17
Reaction score
16
First Language
Spanish
Primarily Uses
Hello, I would like to know if there's a way to disable movement when you click somewhere on the map. However, certain events can still be activated from far. To be more precise, I'm trying to make a system where your mouse is your gun and it's possible to shoot everywhere, certain events interact with this shooting (for example you can kill a zombie, break a jar, etc), while shooting at walls doesn't do anything.


I would appreacite it if someone could help!


Thanks for your time  :)
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Do you want to disable it permanently or only at certain times, and for a set period?
 

Sums

Musician and Writer
Member
Joined
Mar 23, 2015
Messages
17
Reaction score
16
First Language
Spanish
Primarily Uses
Permanently
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Changing this bit of code should stop player movement by mouse ... rpg_objects.js line 41:

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


And how are you activating events from afar?
 
Last edited by a moderator:

Sums

Musician and Writer
Member
Joined
Mar 23, 2015
Messages
17
Reaction score
16
First Language
Spanish
Primarily Uses
Perfect! I'm using the Mouse System Ex. It works now  :) Thank you
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Do you want to disable it permanently or only at certain times, and for a set period?


How would you disable it at certain times?

I'm trying to set up a system where you switch between modes A and B:

A: You can interact with special events by either pressing directional buttons (keyboard) or clicking on-screen buttons (mobile). Player cannot move.


B: Interact-able objects as defined above cannot be started in this mode. In this mode the player can move and explore the area.


In mode A, I cannot move the character via directional input (because it triggers one of the events available), but I can still move via mouse click. I would like to disable movement via mouse click (but still maintain mouse clicking) when I enter mode A.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Allocate a switch that will disable the mouse movement when you turn the switch on.  In the example below I'll use 15, so just change that to whatever switch id you want to use.


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


Turn the switch on when you want to disable mouse-click movement, and off when you want to enable it again.


If there are updates to the engine and you replace your scripts, you'll need to redo the change.
 

Rink27

Veteran
Veteran
Joined
Jul 18, 2014
Messages
222
Reaction score
13
First Language
English
Primarily Uses
RMMV
Allocate a switch that will disable the mouse movement when you turn the switch on.  In the example below I'll use 15, so just change that to whatever switch id you want to use.
 Omg, thank you so much <3
It was a fast reply too!

I need to learn to program for RPG Maker MV. That was so simple.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
lol - it was simple because I knew that method existed, and that's what triggers the player to move.  I had a terrible time going through that logic the first time I needed to look at the pathfinding process :D  - because it's something new in MV, and Ace didn't have it at all, without external scripts.
 

Nacura

Veteran
Veteran
Joined
Feb 4, 2018
Messages
125
Reaction score
14
First Language
Español
Primarily Uses
RMMV
Changing this bit of code should stop player movement by mouse ... rpg_objects.js line 41:

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


And how are you activating events from afar?
Yanfly add plugin for activation events afar
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
7,842
Reaction score
5,225
First Language
Dutch
Primarily Uses
RMXP

@Nacura , please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.

 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,070
Members
137,577
Latest member
SadaSoda
Top