Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

RPG Maker MV- JS Script calls

Injury

Awesome Bro

Hey!

I'm messing with MV. I need some help. What would I do to call up the continue menu, not the save menu, with a script?

Also still looking for a way to skip the title entirely. Thank you so much! I'll be snooping around the folders.

Thank you!
 

Injury

Awesome Bro

Hey again...

What would i use to teleport the player to a specific place using js?

I looked up the transfer functions and whatnot...


Code:
Scene_Map.prototype.create = function() {

    Scene_Base.prototype.create.call(this);

    this._transfer = $gamePlayer.isTransferring();

    var mapId = this._transfer ? $gamePlayer.newMapId() : $gameMap.mapId();

    DataManager.loadMapData(mapId);

};

 

Scene_Map.prototype.isReady = function() {

    if (!this._mapLoaded && DataManager.isMapLoaded()) {

        this.onMapLoaded();

        this._mapLoaded = true;

    }

    return this._mapLoaded && Scene_Base.prototype.isReady.call(this);

};

 

Scene_Map.prototype.onMapLoaded = function() {

    if (this._transfer) {

        $gamePlayer.performTransfer();

    }

    this.createDisplayObjects();

};

 

Scene_Map.prototype.start = function() {

    Scene_Base.prototype.start.call(this);

    SceneManager.clearStack();

    if (this._transfer) {

        this.fadeInForTransfer();

        this._mapNameWindow.open();

        $gameMap.autoplay();

    } else if (this.needsFadeIn()) {

        this.startFadeIn(this.fadeSpeed(), false);

    }

    this.menuCalling = false;
 
This should do it for teleporting the player;
Code:
$gamePlayer.reserveTransfer( $gameMap.mapId(), $gamePlayer.x, $gamePlayer.y );
You've got MapId, X location and Y location there. There are an optional two more params for facing direction and if it fades or not or something like that.

This is exactly the method that is called with the Transfer player event.

Implementation: Game_Player.prototype.reserveTransfer
Line 7417 of rag_objects.js

Event reference; Game_Interpreter.prototype.command201
Line 9662 of rpg_objects.js

EDIT: In the performTransfer method of Game_Player you can find these methods which you can use to directly transfer the player without waiting for anything else to happen. This will disable events overriding the transfer destination if that's a concern (but the transfer events will still be called if they are awaiting on this script, just that they won't override this transfer).
Code:
$gamePlayer.setDirection( _newDirection ); // SET PLAYER DIRECTION

$gamePlayer.locate( _newX, _newY ); // SET PLAYER LOCATION
 

Injury

Awesome Bro

OK. Speaking of events getting interrupted...

I'm trying to experiment with this transfer command because after my title screen, it will transfer to the new map, but the events on the map won't continue, or allow for progression.

Character can't move like there is a loop or an autorun event, but all loops have clean breaks when called and waits on them.

so...

1. Test game, goes straight to Title (a map, just like I set up)
2. Title is controlled by Common Events running off a switch
3. Player can choose, New, Continue, Quit
--Continue pulls up Scene_Load
--Quit calls the command window.close();
4. Player hits new,screen fade, clears all pictures, sets variables involved to 0s etc etc
5. Teleports to the next map, adds player, fade screen in
6. Displays nothing.

I tried to have it break event processing, but it doesn't really do anything. Kinda stuck.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top