Saving Clones : Save and Load User-Created Clones

You must understand the Game Editor concepts, before post here.

Saving Clones : Save and Load User-Created Clones

Postby DST » Fri May 16, 2008 10:45 pm

I have found a method for saving an array of user created clones.

First, you create three integer variables...For this post i'm using 'myx', 'myy', 'clonetotal'.
For myx and myy variable, assign the following properties; Array - yes. size - up to you. save (set savegroup); For clonetotal, assign save: (set savegroup);

Now create two actors, one called load and one called save;

On save>mousebuttondown, Create a short timer for the savebutton, and a shorter timer for the clones.
mousebuttondown:
clonetotal=ActorCount("clonename");

On the clone timer, do this:
myx[cloneindex]=x;
myy[cloneindex]=y;

and on the timer for the save button

saveVars("filename", "savegroup");

Now on the Load button > createactor
loadVars("filename", savegroup);

and on Load button > mousebutton down create two timers; short one for loadbutton, and longer one for clones;
Loadbutton > timer
if (clonetotal > 1){Createactor("clonename etc. etc.); clonetotal-=1;}
You'd probably want to use a LOOP here instead of if, but this is just a basic version. Figure out the loop thing on your own!

and on the clonetimer
x=myx[cloneindex];
y=myy[cloneindex];

That's It! Note that you can save ANY clone variable this way...health, poweruplevel...anything, just remember to create a new integer array for each value to be stored.

Here's a Demo to further explain:
Attachments
clonesave.zip
(112.4 KiB) Downloaded 156 times
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Saving Clones : Save and Load User-Created Clones

Postby Bee-Ant » Sat May 17, 2008 7:06 am

This is very helpfull for making enemys health...
Thanks :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest