Need help with Yanfly's Move Route Core & Self Switches and Variables

JDevain

Veteran
Veteran
Joined
Oct 21, 2018
Messages
121
Reaction score
46
First Language
English
Primarily Uses
RMMV
PLUGINS:
Move Route Core
Self Switches and Variables

I have an event that I want to move to another event on the map. Normally, with Move Route Core, you just use the javascript command "MOVE TO: EVENT 5". However, I'm also using the Self Switches and Variables plugin, which you can control from within the Move Route Core plugin with a javascript command "SELF VARIABLE 1: 5". So I first tried this:

Code:
Script: SELF VARIABLE 1: 5
Script: MOVE TO: EVENT $gameVariables.value(1)
but that didn't work, so I went into Lunatic Mode and tried:

Code:
Script: SELF VARIABLE 1: 5
Script: this.moveToEvent($gameVariables.value(1))
but that doesn't work either. The event just moves to the player, which means Self Variable 1 = 0.

After some digging around, I tried:
Code:
Script: SELF VARIABLE 1: 5
Script: this.moveToEvent(this._interpreter.getSelfVariableValue(1));
but still the exact same behavior.

By the way, I tried this in both Autonomous Movement and Set Movement Route, same behavior. (I'm shooting for Autonomous Movement.)

I've tested it after turning off all other plugins, no dice. Anyone understand why this isn't working?

Thanks!
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Plugin calls and script calls are different. You cannot do plugin calls in a move route's script command.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
1,695
Reaction score
1,113
First Language
Portuguese - Br
Primarily Uses
RMMZ
It's always best that you send screenshots of your events instead of describing it.

You are trying to access a self variable value inside the move route? Or it's a normal variable?

Because there is a specific script call for access selfVariables that is different from normal variables.

Also, try to use Move To: instead of MOVE TO:
I know that the help file says it in upper case, but it also says it in lower case, so give it a try...
 

JDevain

Veteran
Veteran
Joined
Oct 21, 2018
Messages
121
Reaction score
46
First Language
English
Primarily Uses
RMMV
@Shaz
But I'm not using any plugin calls, only script calls. In Yanfly's Move Route Core there is the following script call:

SELF VARIABLE x: y

where "x" is the ID of the Self Variable and "y" is the value. This only works in Move Route Core if you also have the Self Switches and Variables plugin installed.

Here's a bit of the documentation from the Move Route Core plugin's description:


SELF VARIABLE x: y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Requires YEP_SelfSwVar.js. This will set the self variable x for the
designated event (unless it's the player) to y.
Replace x with an integar value.
Replace y with an integar value or code.


EDIT:
@Eliaquim
You responded while I was responding to Shaz, gimme a few minutes, thanks...
 

JDevain

Veteran
Veteran
Joined
Oct 21, 2018
Messages
121
Reaction score
46
First Language
English
Primarily Uses
RMMV
I've messed with it for a while, and ALLCAPS vs UpperCase doesn't seem to make a difference.
 

glaphen

Veteran
Veteran
Joined
Jan 13, 2019
Messages
326
Reaction score
120
First Language
English
Primarily Uses
RMMV
You are using the plugin commands in script calls
Code:
For those who'd rather deal altering self switches and/or self variables
inside of the script call event instead, you can use these script calls:

Script Call:

  this.getSelfSwitchValue(mapId, eventId, switchId)
  - Replace mapId with the map ID the event exists on. Replace eventId with
  the ID of the event. And replace the switchId with the ID of the switch.
  This will get the true/false value of that event's self switch.

  this.getSelfVariableValue(mapId, eventId, varId)
  - Replace mapId with the map ID the event exists on. Replace eventId with
  the ID of the event. And replace the varId with the ID of the variable.
  This will get the value of that event's self variable.

  this.setSelfSwitchValue(mapId, eventId, switchId, true)
  this.setSelfSwitchValue(mapId, eventId, switchId, false)
  - Replace mapId with the map ID the event exists on. Replace eventId with
  the ID of the event. And replace the switchId with the ID of the switch.
  This will set that self switch to true or false.

  this.setSelfVariableValue(mapId, eventId, varId, value)
  - Replace mapId with the map ID the event exists on. Replace eventId with
  the ID of the event. And replace the varId with the ID of the variable.
  This will set that self variable to the value inserted.
These are scripts calls.

Actually looking at movement route I guess there are script calls for it.

Code:
SELF SWITCH x: ON
SELF SWITCH x: OFF
SELF SWITCH x: TOGGLE
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This will turn the self switch designed event (unless it's the player) to
either On, Off, or Toggle it On/Off.
Replace x with A, B, C, or D.
Those using YEP_SelfSwVar.js can use numbers, too.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Example: Self Switch A: On
         Self Switch B: Off
         Self Switch 123: Toggle
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
SELF VARIABLE x: y
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Requires YEP_SelfSwVar.js. This will set the self variable x for the
designated event (unless it's the player) to y.
Replace x with an integar value.
Replace y with an integar value or code.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Example: Self Variable A: On
         Self Variable B: Off
         Self Variable 123: Toggle
But the variables shows same as switches.

Here's code of the plugin.
Code:
Game_Character.prototype.processMoveRouteSelfVariable = function(str, code) {
  if (!Imported.YEP_SelfSwVar) return;
  if (this === $gamePlayer) return;
  if (str.match(/(\d+)/i)) {
    var keyName = 'SELF VARIABLE ' + parseInt(RegExp.$1);
  } else {
    var keyName = str.toUpperCase();
  }
  var key = [$gameMap.mapId(), this.eventId(), keyName];
  try {
    var value = eval(code);
  } catch (e) {
    var value = 0;
    Yanfly.Util.displayError(e, code, 'MOVE ROUTE SELF VARIABLE SCRIPT ERROR');
  }
  $gameSelfSwitches.setValue(key, value);
};
Maybe try
Code:
this.processMoveRouteSelfVariable('1', 5);
or maybe
Code:
this.processMoveRouteSelfVariable('self variable 1', 5);
if not maybe
Code:
$gameSelfSwitches.setValue([$gameMap.mapId(), this.eventId(), 1], 5);
or maybe
Code:
$gameSelfSwitches.setValue([$gameMap.mapId(), this.eventId(), 'SELF VARIABLE ' + 1], 5);
EDIT: I just realized your problem is the movetoevent maybe?
Try
Code:
$gameSelfSwitches.value([$gameMap.mapId(), this.eventId(), 'SELF VARIABLE ' + 1])
or
Code:
$gameSelfSwitches.value([$gameMap.mapId(), this.eventId(), 1]);
or maybe even
Code:
$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 1]);
/
Code:
$gameSelfSwitches.value([$gameMap._mapId, this._eventId, 'SELF VARIABLE ' + 1]);
 
Last edited:

JDevain

Veteran
Veteran
Joined
Oct 21, 2018
Messages
121
Reaction score
46
First Language
English
Primarily Uses
RMMV
@glaphen

Working! What I ended up with is (inside Autonomous Movement)

Script: SELF VARIABLE 1: 5
Script: this.moveToEvent($gameSelfSwitches.value([$gameMap.mapId(), this.eventId(), 'SELF VARIABLE ' + 1]))
Script: SELF VARIABLE 1: 3
Script: this.moveToEvent($gameSelfSwitches.value([$gameMap.mapId(), this.eventId(), 'SELF VARIABLE ' + 1]))
etc.

Thanks so much! That was a lot of suggestions, you really went beyond the call of duty there, and I appreciate it.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,849
Messages
1,016,975
Members
137,563
Latest member
cexojow
Top