Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

[SugarCube 1] Pre-existing array that, if updated, doesn't change if an old "Save" is loaded

$
0
0
Greetings

Situation I'm considering is this. I have an array of 100 items, which holds all the details - ID of an item, name, and whatever details I require. This is, say, in 1.0 version of the game. Somebody plays, and saves the game while playing that version.
Now, I upload a version 1.1. In that version I add new content, which brings the preexisting array up to 110 items.
But, of course, with how I just create the array in the opening screen or the character creation screen, once somebody loads the old save file the 110 item array is instead replaced with the old 100 item array.

While I know one can create arrays in "setup" object, does that get overwritten as per situation above?

The reason I want a preexisting array is to have static IDs and a functional reference to all the items without pushing new items onto the array whenever the story leads to a point which requires that. I.e. player 'has' all the items but their amount is 0 until a player picks it up, thus bringing the amount up to 1 or more and therefore showing it in the inventory.

The way I currently do it is to have the openingscreen/character creation screen have a javascript create an array that is used in the game, and in an event where I would update the version with more content, i have a buildversion check inside Inventory tab, which holds the same code so that an old savefile can still be updated with a new array of the ingame items.

Is there a way to do it more simply? I.e. defining a pre existing array inside the "setup" object that isn't rewritten if an old save file is loaded?

Best Regards

Viewing all articles
Browse latest Browse all 1844

Trending Articles