Hello,
I'm implementing a fast travel mechanic in my game. Basically, the player has an item that allows him to store locations. He can then use the item to call up a menu to return to these locations instantly.
The item stores the Map ID, as well as the X and Y coordinates of the player in the moment he stores the location.
Now, the original idea was to use a script to store this information in an array. However, I discovered that variables created in a script are not persistant, meaning as soon as I quit the game, they're gone. So next time the player starts the game, all stored locations are lost.
So I tried to store the data in a game variable. However, while game variables apparently can be arrays, they're weird. None of the array functions seemed to work with them.
For example:
$gameVariables.value(100).forEach(function(element){
arrayMapIndexes.push(element);
});
retuns an "undefined is not a function" error. However, if I do
var testArray = [1,2,3];
testArray.forEach(function(element){
arrayMapIndexes.push(element);
});
this works.
Does anyone have an idea how this can be done? Is there any way to store an array persistently in RPG Maker?
I'm implementing a fast travel mechanic in my game. Basically, the player has an item that allows him to store locations. He can then use the item to call up a menu to return to these locations instantly.
The item stores the Map ID, as well as the X and Y coordinates of the player in the moment he stores the location.
Now, the original idea was to use a script to store this information in an array. However, I discovered that variables created in a script are not persistant, meaning as soon as I quit the game, they're gone. So next time the player starts the game, all stored locations are lost.
So I tried to store the data in a game variable. However, while game variables apparently can be arrays, they're weird. None of the array functions seemed to work with them.
For example:
$gameVariables.value(100).forEach(function(element){
arrayMapIndexes.push(element);
});
retuns an "undefined is not a function" error. However, if I do
var testArray = [1,2,3];
testArray.forEach(function(element){
arrayMapIndexes.push(element);
});
this works.
Does anyone have an idea how this can be done? Is there any way to store an array persistently in RPG Maker?