Script call to make an event jump to player's possition?

I have an event in my game (ID:8) and I want it to jump to player's possition. I've tried this:
$gameMap.event(8).jump($gamePlayer.x, $gamePlayer.y)
Wich makes it jump off the screen... I don't really know how these scripts work and I'm trying combinatins of the script calls excel file on this forum
How do I make this correctly?
Try:
$gameMap.event(8).jump(1, 1)
And see where the event jumps to.
Maybe it can't jump to a space already occupied by another event (the player)?
I'm wondering if jump() is looking for a number of tiles as opposed to exact coordinates.
I suspect the problem is that jump() works with offsets. That’s why the event jumped off screen

If this is in the CUSTOM MOVE ROUTE:
JavaScript:
const DivX = $gamePlayer.x - this.x;
const DivY = $gamePlayer.y - this.y;
this.jump(DivX,DivY)

If it's in the event commands, replace "this" with the whole riddle like $gameMap.events(this.eventID) or something.
To elaborate on this solution, the jump command expects to receive two values, the number of tiles to jump, both along the x and y axes.

So this solution is calculating the distance between the two events by subtracting the target event's location from the jumping event's location. It then passes those calculations into the jump command.
To elaborate on this solution, the jump command expects to receive two values, the number of tiles to jump, both along the x and y axes.

So this solution is calculating the distance between the two events by subtracting the target event's location from the jumping event's location. It then passes those calculations into the jump command.
Can't I use player coordinates instead? They are stored in two variables
I suspect the problem is that jump() works with offsets. That’s why the event jumped off screen

If this is in the CUSTOM MOVE ROUTE:
JavaScript:
const DivX = $gamePlayer.x - this.x;
const DivY = $gamePlayer.y - this.y;
this.jump(DivX,DivY)

If it's in the event commands, replace "this" with the whole riddle like $gameMap.events(this.eventID) or something.
I think you can't use more than one line in a movement route script call, shall they be separate or something?
Edit: I tried
Code:
this.jump($gamePlayer.x - this.x,$gamePlayer.y - this.y;)
But all it does is lag the game when the code runs
Maybe it can't jump to a space already occupied by another event (the player)?
It's marked as Through and you can literally walk to be in the same position as other event (at least in game)
I think you can't use more than one line in a movement route script call, shall they be separate or something?
No, you just put them on one line. Linefeeds in javascript are just there for easy reading, you can throw them out of the window most of the time.
But all it does is lag the game when the code runs
Okay. You really need to help us help you. A screenshot of how it's set up at the minimum. The more information the merrier. If you are afraid of soiling the forum with long posts, you can always enclose screenshots in spoiler tags, like below.

In any case, an example of a pig that jumps a player every five seconds no matter where on the screen he or she happens to be:
Spoiler: Event page 1
1690618149001.png

The script would be as follows:
JavaScript:
$gameMap.event(this.eventId()).jump($gamePlayer.x - $gameMap.event(this.eventId()).x, $gamePlayer.y - $gameMap.event(this.eventId()).y);
Or a little tidier:
JavaScript:
const jumpyPig = $gameMap.event(this.eventId());
jumpyPig.jump($gamePlayer.x - jumpyPig.x, $gamePlayer.y - jumpyPig.y);

Spoiler: Event page 2
1690618177817.png
No, you just put them on one line. Linefeeds in javascript are just there for easy reading, you can throw them out of the window most of the time.

Okay. You really need to help us help you. A screenshot of how it's set up at the minimum. The more information the merrier. If you are afraid of soiling the forum with long posts, you can always enclose screenshots in spoiler tags, like below.

In any case, an example of a pig that jumps a player every five seconds no matter where on the screen he or she happens to be:
Spoiler: Event page 1

The script would be as follows:
JavaScript:
$gameMap.event(this.eventId()).jump($gamePlayer.x - $gameMap.event(this.eventId()).x, $gamePlayer.y - $gameMap.event(this.eventId()).y);
Or a little tidier:
JavaScript:
const jumpyPig = $gameMap.event(this.eventId());
jumpyPig.jump($gamePlayer.x - jumpyPig.x, $gamePlayer.y - jumpyPig.y);

Spoiler: Event page 2
It works now, thank you!

Original thread: https://forums.rpgmakerweb.com/threads/script-call-to-make-an-event-jump-to-players-possition.159811/