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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,231
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,231
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,231
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,451
Reaction score
15,231
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
129
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
8,954
Reaction score
5,862
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.

Latest Threads

Latest Profile Posts

Who's a fan of firearms? The 5 on the bottom row (not including the green laser ones) I made pretty recently. I plan for most of these to be in my project.

Screenshot 2021-09-28 165924.png
Doing RPG Maker News for 28th September 2021

RMMV - Skip script errors:

For game developer testing purposes.
You know, I really get to farm likes since I post all of @Avery and @hiddenone 's blog tutorials on the forums...
Back from a very long hiatus with a new project woo
This is my battler placeholder image trying out art styles too I want to fake a backview battle system
I think I will want portraits and battle sprites to be 2D and stick to pixel art for overworld not 100%sure but pretty sure its easier to make pixel art for overworld sprites, events and maps and stuff.
Placeholder.png

Forum statistics

Threads
115,441
Messages
1,089,951
Members
150,229
Latest member
Mythphnx
Top