ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
Hello, It's possible in “transfer player” to use designation with variables, and for jump no…

It's possible to do this in javascript? (I don't find a thread in this topic)
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,164
Reaction score
1,647
First Language
Portuguese - Br
Primarily Uses
RMMZ
Hi there!
yeah, it is ^^

You can use the script call:

character.jump( $gameVariables.value(varId), $gameVariables.value(varId) )

Replace character with $gamePlayer or $gameMap.event(eventId)
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
Thank you #Eliaquim for the moment it does not work what does not work?

Capture d’écran 2021-07-28 à 17.27.19.png
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,164
Reaction score
1,647
First Language
Portuguese - Br
Primarily Uses
RMMZ
Thank you #Eliaquim for the moment it does not work what does not work?

View attachment 197129
Hi!
What do you mean by doesn't work? The player did not jump at all? Or does it jumps to a different coordinate?

I just realized that the character.jump(x, y) function does not make the character jump to a specific coordinate. But instead, it adds a plus value for the character to jump.

So if the player is on coordinates (10, 13) and you call the function $gamePlayer.jump(2,2)
The player will not jump to the coordinates (2, 2), but it will jump on (10 + 2, 13 + 2)

So, in your case, I believe you have to set the value of variables 47 and 48, to be a difference between the player distance and the event.
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
hi! Eliaquim,
it jumps to a different coordinate,
in my case 47 = x of this event, 48 = y of this event
47 and 48 are the variables I want to look for for my jump.

I was wondering if we can do this with the jump:
Capture d’écran 2021-07-29 à 08.03.17.png
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,164
Reaction score
1,647
First Language
Portuguese - Br
Primarily Uses
RMMZ
hi! Eliaquim,
it jumps to a different coordinate,
in my case 47 = x of this event, 48 = y of this event
47 and 48 are the variables I want to look for for my jump.

I was wondering if we can do this with the jump:
View attachment 197198
Yeah, with script call you can(Assuming that you want to make the player jump to a specific coordinate). But you have to take into consideration that part of my previous comment:

I just realized that the character.jump(x, y) function does not make the character jump to a specific coordinate. But instead, it adds a plus value for the character to jump.

So if the player is on coordinates (10, 13) and you call the function $gamePlayer.jump(2,2)
The player will not jump to the coordinates (2, 2), but it will jump on (10 + 2, 13 + 2)

So, in your case, I believe you have to set the value of variables 47 and 48, to be a difference between the player distance and the event.
 

JorgeMaker

Veteran
Veteran
Joined
Jan 14, 2020
Messages
40
Reaction score
37
First Language
Português - BR
Primarily Uses
RMMZ
This little snippet I just made might be useful:

nq6wuaa.png


JavaScript:
/*:
 * @command jumpToPos
 * @text Jump To Position
 * @desc Makes the defined character jump to the defined coordinates.
 *
 * @arg ownerId
 * @text Char Id
 * @type number
 * @default 0
 * @desc Set the character that will jump.
 *
 * @arg x
 * @text Position X
 * @type text
 * @default 0
 * @desc Set the X position the character will jump.
 *
 * @arg y
 * @text Position Y
 * @type text
 * @default 0
 * @desc Set the Y position the character will jump.
 *
 * @command jumpToPosByVar
 * @text Jump To Position (By Variables)
 * @desc Makes the defined character jump to the defined coordinates.
 *
 * @arg ownerId
 * @text Char Id
 * @type variable
 * @default 1
 * @desc Set the variable character that will jump.
 *
 * @arg x
 * @text Position X
 * @type variable
 * @default 1
 * @desc Set the variable X position the character will jump.
 *
 * @arg y
 * @text Position Y
 * @type variable
 * @default 1
 * @desc Set the variable Y position the character will jump.
 *
 * @command jumpToEvent
 * @text Jump To The Position Of An Event
 * @desc Makes the defined character jump to the coordinates of the defined event.
 *
 * @arg ownerId
 * @text Char Id
 * @type number
 * @default 0
 * @desc Set the character that will jump.
 *
 * @arg targetId
 * @text Event ID
 * @type number
 * @default 1
 * @desc Set the target Event.
 *
 * @command jumpToEventByVar
 * @text Jump To The Position Of An Event (By Variables)
 * @desc Makes the defined character jump to the coordinates of the defined event.
 *
 * @arg ownerId
 * @text Char Id
 * @type variable
 * @default 1
 * @desc Set the variable character that will jump.
 *
 * @arg targetId
 * @text Event ID
 * @type variable
 * @default 1
 * @desc Set the variable target Event.
 *
 */

(() => {
    //=============================================================================
    // ** Plugin Definitions
    //=============================================================================    
    "use strict";
    const pluginName = "JumpSnippet";

    const getCharById = (id) => {
        if (id < 0) {
            return $gamePlayer;
        } else if (id === 0) {
            return $gameMap.event($gameMap._interpreter._eventId);
        } else if (id > 0) {
            return $gameMap.event(id);
        }
    }

    //=============================================================================
    // ** PluginManager
    //-----------------------------------------------------------------------------
    // The static class that manages the plugins.
    //=============================================================================    

    PluginManager.registerCommand(pluginName, "jumpToPos", (args) => {
        const
        owner  = getCharById(parseInt(args.ownerId)),
        target = [parseInt(args.x), parseInt(args.y)]; 
        owner.jumpToPos(...target);
    });

    PluginManager.registerCommand(pluginName, "jumpToPosByVar", (args) => {
        const
        owner  = getCharById($gameVariables.value(parseInt(args.ownerId))),
        target = [$gameVariables.value(parseInt(args.x)), $gameVariables.value(parseInt(args.y))]; 
        owner.jumpToPos(...target);
    });

    PluginManager.registerCommand(pluginName, "jumpToEvent", (args) => {
        const
        owner  = getCharById(parseInt(args.ownerId)),
        target = getCharById(parseInt(args.targetId));
        owner.jumpToChar(target);
    });

    PluginManager.registerCommand(pluginName, "jumpToEventByVar", (args) => {
        const
        owner  = getCharById($gameVariables.value(parseInt(args.ownerId))),
        target = getCharById($gameVariables.value(parseInt(args.targetId)));
        owner.jumpToChar(target);
    });
    
    //=============================================================================
    // ** Game_CharacterBase
    //-----------------------------------------------------------------------------
    // The superclass of Game_Character. It handles basic information, such as
    // coordinates and images, shared by all characters.
    //=============================================================================

    Object.assign(Game_CharacterBase.prototype, {
        //------------------------------------------------------------------------
        // * jumpToPos
        // - New function
        //------------------------------------------------------------------------
        jumpToPos(x, y) {
            this.jump(x - this.x, y - this.y);
        },
        //------------------------------------------------------------------------
        // * jumpToChar
        // - New function
        //------------------------------------------------------------------------
        jumpToChar(char) {
            this.jumpToPos(char.x, char.y);
        },
        //------------------------------------------------------------------------
        // * jumpToEvent
        // - New function
        //------------------------------------------------------------------------
        jumpToEvent(eventId) {
            this.jumpToChar($gameMap.event(eventId));
        },
    });
})();
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
Eliaquim, JorgeMaker, thank you

I don't know the x, y of my events, I don't know its identifier (spawn event)

I will look for them, they are stored in these two variables (47, 48 in my case)

47, 48 it's not a position, I wanted a formula to get them
 

JorgeMaker

Veteran
Veteran
Joined
Jan 14, 2020
Messages
40
Reaction score
37
First Language
Português - BR
Primarily Uses
RMMZ
I'm sure you can use the plugin I sent you to make any character jump to a position stored in a variable.
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
JorgeMaker, How? can you explain to me?
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,164
Reaction score
1,647
First Language
Portuguese - Br
Primarily Uses
RMMZ
JorgeMaker, How? can you explain to me?
Download the plugin he made and take a look at the plugin commands
He posted a screenshot of it
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
I have already tested it, it is a logic that I do not yet master.
I don't understand what its variables refer to.
 

Eliaquim

Hakuen Studio
Veteran
Joined
May 22, 2018
Messages
2,164
Reaction score
1,647
First Language
Portuguese - Br
Primarily Uses
RMMZ
Install the plugin.
Set the event position on two variables(just like you did before, on variable 47 and 48).
Then call the plugin command: Jump To Position (By Variables)
Fill the plugin command arguments
And then the player should jump on the coordinates stored on the variables.
If you don't manage to do it, post a screenshot of your event here
 

ulosbal

Shamach
Veteran
Joined
Sep 4, 2018
Messages
30
Reaction score
4
First Language
french
Primarily Uses
RMMZ
Here, what do you think?
Char Id = who jump? -1 = player
Capture d’écran 2021-07-31 à 14.58.26.png

for the moment it does not work
 

Latest Threads

Latest Profile Posts

It makes sense that you try to focus on the squishy mages at the back of the party first, right? If the mage can out-DPS the enemy DPS before the latter can kill the tank in front, the fight becomes boring.
finally got footage of my main character running around the main hub world. I've fixed a few things tho even since this video unsurprisingly lol.
 …I think I might need to switch from standard ATK/DEF up/down buffs to parameter altering states. I just had an actor whose usual attack against an enemy does ~25 do a buffed attack against a debuffed enemy for ~600…
just saw that titan quest is free on steam until the 23rd

Forum statistics

Threads
115,228
Messages
1,088,246
Members
149,822
Latest member
ddkovi
Top