Hello everyone,
I am trying to learn to script, with my next script I want to change my currency (Amount + name), open a shop and change back to the default currency.
In my game I have a colosseum to earn BP (Battle Points) that got be stored in a variable ID 52.
For my shop to use BP I call a common event with a script:
All code in green works as it needs to be but the red code is "wrong".
As far as I know/understand, the code in red is executed before the shop close.
I wanna know how to execute the "red code" after the shop is closed.
I am trying to learn to script, with my next script I want to change my currency (Amount + name), open a shop and change back to the default currency.
In my game I have a colosseum to earn BP (Battle Points) that got be stored in a variable ID 52.
For my shop to use BP I call a common event with a script:
// Set ID for variable
var currencyID = 52;
var newCurrencyName = 'BP';
// Shop items
var goods = [];
goods.push([0, 7, 1, 500]);
goods.push([0, 10, 1, 2000]);
// Store your default currency
var storeGold = $gameParty.gold();
var storeCurrencyName = $dataSystem.currencyUnit;
$gameParty.loseGold($gameParty.gold());
// Change gold to new currency
$gameParty.gainGold($gameVariables.value(currencyID));
$dataSystem.currencyUnit = newCurrencyName;
// Open shop
SceneManager.push(Scene_Shop);
SceneManager.prepareNextScene(goods, true);
// Store your currency
$gameVariables.setValue(currencyID, $gameParty.gold());
$gameParty.loseGold($gameParty.gold());
// Change back to default currency
$gameParty.gainGold(storeGold);
$dataSystem.currencyUnit = storeCurrencyName;
var currencyID = 52;
var newCurrencyName = 'BP';
// Shop items
var goods = [];
goods.push([0, 7, 1, 500]);
goods.push([0, 10, 1, 2000]);
// Store your default currency
var storeGold = $gameParty.gold();
var storeCurrencyName = $dataSystem.currencyUnit;
$gameParty.loseGold($gameParty.gold());
// Change gold to new currency
$gameParty.gainGold($gameVariables.value(currencyID));
$dataSystem.currencyUnit = newCurrencyName;
// Open shop
SceneManager.push(Scene_Shop);
SceneManager.prepareNextScene(goods, true);
// Store your currency
$gameVariables.setValue(currencyID, $gameParty.gold());
$gameParty.loseGold($gameParty.gold());
// Change back to default currency
$gameParty.gainGold(storeGold);
$dataSystem.currencyUnit = storeCurrencyName;
As far as I know/understand, the code in red is executed before the shop close.
I wanna know how to execute the "red code" after the shop is closed.