MV Help with JumpTo()

I'm having a bit of trouble trying to make a common event that can do the following...

When a cutscene ends, I use a variable to hide an event (which looks like a character) and turn on player-followers, of which this same character is a follower. This is so that during this cutscene, I can have the character act, emote, etc., but then I want them to follow the player when the cutscene is over.

When the cutscene ends, I want to do the following:
  1. Save the event number of the character in a variable so this can be used in different maps (OK!)
  2. Get the x/y location of the follower sprite and save it in 2 variables (OK!)
  3. Command an event, whose number is contained in that variable, to "Jump" to that location (PROBLEM!)
  4. Hide the event and Show Followers (OK!)
But I'm having a problem getting the event to jump to the correct position.

I use Yanfly's MoveRouteCore, which has a command called JumpToPoint(x,y). However, I can only seem to get this to work from within a movement command (it doesn't want to work with a normal script call), and that's a problem because a normal Move command doesn't let you specify the chosen event via variable.

Can someone suggest how I can command an event, via script, to do this? It needs to look like (pseudocode...)

gameMap.event(variable(37)).JumpToPoint(variable(23), variable(24));

It's the dynamic-ness of everything that's causing the issue. I need this to work like this so in my cutscenes, I can supply the event number of the actor and it'll always work.
Can someone suggest how I can command an event, via script, to do this? It needs to look like (pseudocode...)

gameMap.event(variable(37)).JumpToPoint(variable(23), variable(24));
Try

$gameMap.event(($gameVariables.value(37)).JumpToPoint($gameVariables.value(23), $gameVariables.value(24));
or
this.character($gameVariables.value(37)).JumpToPoint($gameVariables.value(23), $gameVariables.value(24));
My suggestion would be: if you look in the pinned Script Call List or Google "rpg maker mv script call jump" you would find, simply, the jump() method.

All you have to do from there is subtract the event's current X and Y from the stored X and Y.

So let's say your event ID is in variable 12, and the X and Y are in variables 41 and 42.
Code:
$gameMap.event($gameVariables.value(12)).jump($gameVariables.value(41), $gameVariables.value(42))
Thanks! Unfortunately though these won't work.
Try

$gameMap.event(($gameVariables.value(37)).JumpToPoint($gameVariables.value(23), $gameVariables.value(24));

I tried this; but for some reason JumpToPoint will only work within a movement command. I don't quite understand why (Yanfly's documentation doesn't suggest it's limited like this).

or
this.character($gameVariables.value(37)).JumpToPoint($gameVariables.value(23), $gameVariables.value(24));

Also this won't work either, because "this." presumably isn't right; it's in a common event.
My suggestion would be: if you look in the pinned Script Call List or Google "rpg maker mv script call jump" you would find, simply, the jump() method.

So let's say your event ID is in variable 12, and the X and Y are in variables 41 and 42.
Code:
$gameMap.event($gameVariables.value(12)).jump($gameVariables.value(41), $gameVariables.value(42))
That'll make it jump to the wrong place, though, right? Doesn't the Jump() method just make it jump a specified distance? (I'm trying to jump to a specific coordinate)

I guess I could manually work out the jump distances. I was just hoping to figure out why the JumpToPoint() wasn't working as I use it elsewhere and it's pretty handy.
That'll make it jump to the wrong place, though, right? Doesn't the Jump() method just make it jump a specified distance? (I'm trying to jump to a specific coordinate)
Yeah, I added an edit while you were typing that you need to calculate the distance. Just subtract the event's current X and Y from the stored ones.

e.g. $gameVariables.setValue(41, $gameVariables.value(41)-$gameMap.event($gameVariables.value(12)).x)

I tried this; but for some reason JumpToPoint will only work within a movement command. I don't quite understand why (Yanfly's documentation doesn't suggest it's limited like this).
I mean...the initial description of the plugin says:
This plugin will provide additional methods to construct move routes for your events and
allow you to streamline the move route creation process.

So I think it would be a fair assumption that everything in it applies only to move routes.
Thanks! Unfortunately though these won't work.


I tried this; but for some reason JumpToPoint will only work within a movement command. I don't quite understand why (Yanfly's documentation doesn't suggest it's limited like this).



Also this won't work either, because "this." presumably isn't right; it's in a common event.
Did you try it or just immediately dismiss it? I use this.character(id) all the time in common events. It's a game interpreter function and will return the event id on the game map.
Did you try it or just immediately dismiss it? I use this.character(id) all the time in common events. It's a game interpreter function and will return the event id on the game map.
I think his point is that he's not calling this code from the character event...he's calling it to control another event, the ID of which is stored in a variable.
Plugin link for convenience:
Code is case-sensitive. As noted in the documentation for YEP Move Route Core, it should be jumpToPoint, i.e. lower-case j.

Like Turan said, I see no reason not to use the core jump method here. You already have the target in variables so you can, for example, just do Subtract -> Game Data -> Character X/Y to get the differences.

(this.character(id) will work in a standalone Script command, because that's a Game_Interpreter context. In that case, it functions equivalently to $gameMap.event(id) when id > 0. It won't work if you try to use it in a move route, because that's processed in a Game_Character context.)
Plugin link for convenience:
Code is case-sensitive. As noted in the documentation for YEP Move Route Core, it should be jumpToPoint, i.e. lower-case j.

Like Turan said, I see no reason not to use the core jump method here. You already have the target in variables so you can, for example, just do Subtract -> Game Data -> Character X/Y to get the differences.

(this.character(id) will work in a standalone Script command, because that's a Game_Interpreter context. In that case, it functions equivalently to $gameMap.event(id) when id > 0. It won't work if you try to use it in a move route, because that's processed in a Game_Character context.)

Are you sure it's case-sensitive? Because I copy-pasted that from somewhere I use it, and it works fine.
Yes, I'm sure.
Spoiler: Here's why
  1. It is documented with a lower-case j in the plugin help.
  2. It is defined with a lower-case j in the code of the plugin v1.04.
  3. Like many programming languages, JavaScript itself is case-sensitive.
  4. JS code is usually written in camelCase for method identifiers, not PascalCase.
In fact, reason 4 is why I thought to check in the first place: it's strange to see a method name with an upper-case first character.
You may be confusing it with Yanfly's move route "command" JUMP TO, which is entered as a Script command due to UI limitations.
Spoiler: technical
The plugin manually intercepts the script call, does a case-insensitive match of its "code" against each of the plugin's new "move route commands". If it finds a match then it processes the corresponding outcome, e.g. Jump To: x, y -> this.jumpToPoint(x, y), instead of the usual JS eval.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-jumpto.158995/