Greetings,
Thank you for taking a look at my post. I have a question about how to do something. I am trying to make a plugin that will work as a lives/respawn system. Basically I want when the game over scene starts to happen I want it to check a variable and if the variable is 1 or more then I want it to send you to a predefined location on that current map you are on, but if it is at zero I want it to do the normal game over. From my understanding of JavaScript is should go something along the lines of:
Game over Scene get aliased, after the party.isAllDead check is made check variable then the if else
But I cannot seem to make it work. I do not understand what I am doing wrong, I had a friend give me a template on overwriting/aliasing things and I followed it, but again I think I did it wrong. All I have managed is to make the check for the variable go in a loop and it constantly sends me to the cords I set. I can change the cords in the plugin manager and it sends me to the new cords, but I can’t get it to fire off when it calls the game over scene. I have tried every way I can think of , I will link the two ways that actually got results , I am asking if anyone can look at it and give me pointers as to where I went wrong and maybe point me to some reading materials or really good tuts so I can figure it out.
Here is a gif of what it is currently doing it is the only result that actually does anything:
https://gyazo.com/a86769c8651897bd6e1214d47b3bc87e
Code Version 1
Code Version 2
Thank you for taking a look at my post. I have a question about how to do something. I am trying to make a plugin that will work as a lives/respawn system. Basically I want when the game over scene starts to happen I want it to check a variable and if the variable is 1 or more then I want it to send you to a predefined location on that current map you are on, but if it is at zero I want it to do the normal game over. From my understanding of JavaScript is should go something along the lines of:
Game over Scene get aliased, after the party.isAllDead check is made check variable then the if else
But I cannot seem to make it work. I do not understand what I am doing wrong, I had a friend give me a template on overwriting/aliasing things and I followed it, but again I think I did it wrong. All I have managed is to make the check for the variable go in a loop and it constantly sends me to the cords I set. I can change the cords in the plugin manager and it sends me to the new cords, but I can’t get it to fire off when it calls the game over scene. I have tried every way I can think of , I will link the two ways that actually got results , I am asking if anyone can look at it and give me pointers as to where I went wrong and maybe point me to some reading materials or really good tuts so I can figure it out.
Here is a gif of what it is currently doing it is the only result that actually does anything:
https://gyazo.com/a86769c8651897bd6e1214d47b3bc87e
Code Version 1
JavaScript:
var parameters = PluginManager.parameters('BF_LivesRespawn');
var xcoord = Number(parameters['Xcoord'] || 1);
var ycoord = Number(parameters['Ycoord'] || 1);
var lives = Number(parameters['Lives'] || 20);
var _rewriteGameover = Scene_Base.prototype.checkGameover;
Scene_Base.prototype.checkGameover = function(args) {
_rewriteGameover.call(this, args);
if(lives >= 1)) {
$gamePlayer.reserveTransfer($gameMap.mapId(), xcoord, ycoord, 6, 0);
}
else
{
SceneManager.goto(Scene_Gameover);
}
};
};
Code Version 2
JavaScript:
var parameters = PluginManager.parameters('BF_LivesRespawn');
var xcoord = Number(parameters['Xcoord'] || 1);
var ycoord = Number(parameters['Ycoord'] || 1);
var lives = Number(parameters['Lives'] || 20);
Scene_Base.prototype.checkGameover = function(args)
{
myRespawn();
};
function myRespawn()
{
if(lives >= 1)
{
$gamePlayer.reserveTransfer($gameMap.mapId(), xcoord, ycoord, 6, 0);
}
else
{
SceneManager.goto(Scene_Gameover);
};
}