00:00
00:00
Newgrounds Background Image Theme

xrusteater0 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

AS2 Saving and Loading``

416 Views | 0 Replies
New Topic Respond to this Topic

//save button
//savefile.data.strength=_root.strength;- change strength to your own variable.
//savefile.flush();- This syncs everything to your save.

on (press){
savefile.data.strength=_root.strength;
savefile.data.intelligence=_root.intelligence;
savefile.data.magic=_root.magic;
savefile.data.charm=_root.charm;
savefile.data.hp=_root.hp;
savefile.data.day=_root.day;
savefile.data.money=_root.money;
savefile.data.condoms=_root.condoms;
savefile.data.weed=_root.weed;
savefile.data.flowers=_root.flowers;
savefile.data.dildo=_root.dildo;
savefile.data.beer=_root.beer;
savefile.data.vodka=_root.vodka;
savefile.data.eliseexp=_root.eliseexp;
savefile.data.tijorexp=_root.markexp;
savefile.data.tammyexp=_root.tammyexp;
savefile.data.tijorexp=_root.tijorexp;
savefile.flush();
}

//load button
//if(savefile.data.exp==undefined){ - This means if a variable such as exp (example) is undefined meaning you never saved your game set variables such as this to zero (or a number of your choosing)_root.strength=0;

on (press){
var savefile = SharedObject.getLocal("yourgamename");
if(savefile.data.score==undefined){
_root.strength=0;
_root.intelligence=0;
_root.magic=0;
_root.charm=0;
_root.hp=0;
_root.day=0;
_root.money=0;
_root.condoms=0;
_root.weed=0;
_root.flowers=0;
_root.dildo=0;
_root.beer=0;
_root.vodka=0;
_root.eliseexp=0;
_root.markexp=0;
_root.tammyexp=0;
_root.tijorexp=0;
}else{
_root.strength=savefile.data.strength;
_root.intelligence=savefile.data.intelligence;
_root.magic=savefile.data.magic;
_root.charm=savefile.data.charm;
_root.hp=savefile.data.hp;
_root.day=savefile.data.day;
_root.money=savefile.data.money;
_root.condoms=savefile.data.condoms;
_root.weed=savefile.data.weed;
_root.flowers=savefile.data.flowers;
_root.dildo=savefile.data.dildo;
_root.beer=savefile.data.beer;
_root.vodka=savefile.data.vodka;
_root.eliseexp=savefile.data.eliseexp;
_root.markexp=savefile.data.markexp;
_root.tammyexp=savefile.data.tammyexp;
_root.tijorexp=savefile.data.tijorexp;
}
}

add this to the actions of your first frame

var savefile = SharedObject.getLocal("the name of your game here");

This is very convenient for dating sims. Took me days to find this, this is for the people who don't like looking for old tutorials from 2005 like I had to do.