The Daily Click ::. Forums ::. Klik Coding Help ::. Saving question
 

Post Reply  Post Oekaki 
 

Posted By Message

Poobical

Has some jaffa cakes in his coat pocket 3

Registered
  27/11/2008
Points
  54

360 OwnerVIP MemberLOL SignSnow
31st August, 2010 at 18:32:03 -

Right I'm just a wee puzzled with this saving merlark on TGF1. I know how basic Ini stuff works and what not, but what I'm trying to get my head around is some sort of system on Spyro with its gem saving stuff. I wan't some type of system where you can collect coins/gemes/cogs, it goes into a level/world total and then when you come back to play the stage the things you've collected are gone and cannot be recollected. I want to be able to program this on TGF because of my wee task of making the bulk of Planet of Oddballs on TGF1. Only way I can think of doing this on TGF1 is making all the coins/gems/cogs different active objects but I'm sure there is a easier way.

Thanks in advance

-Joel

 
Image

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
31st August, 2010 at 18:34:08 -

You could spread a value in each collectible on the start of the frame. When a collectible is collected, add its ID to a list. Then save the list at the end of the level.

Then, if you come back to the level later, run through the list. Destroy any object whose ID shows up.

 

  		
  		

Poobical

Has some jaffa cakes in his coat pocket 3

Registered
  27/11/2008
Points
  54

360 OwnerVIP MemberLOL SignSnow
31st August, 2010 at 18:39:56 -

So your saying (I'm really confuzzled with this saving stuff, I only recently understood static engines and what-not) is that beginning of the frame I make all the coins have a value of 0 and then you pick one up it changes it to 1. And then once the stage ends, save the coin objects value in an ini file? I've never been so baffled. I miss password systems

 
Image

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
31st August, 2010 at 19:17:03 -

I would pretty much do it the way OMC said - spread zero throughout all your coin objects at the start of the frame (so Alterable A of the first coin will be 0, the next coin will have 1 all the way up to n-1, where n is the number of coins).

When a player collects a coin, destroy it and store it's value A in your INI file or save game file. I would prefer to create my own save-game files rather than use INI, so I would maybe store the deleted coins as such in a text file:

delete-coin0, delete-coin3, delete-coin4 etc.

Then when you load the game loop through the text file (or INI file if you choose) and whenever you come up to a delete-coinX, you destroy the coin with the value of X. I'd create an example file but I only have MMF2.

There are better ways of doing it, but the above is probably the simplest and it should work fine if done correctly.

 
This is a signature. Have this one on me.

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
31st August, 2010 at 19:23:06 -

Also it seems as though you don't know how "spread" works, so I'll explain.

Say I create 3 Coin objects, and I want to be able to uniquely identify them all - so we can effectively treat them all as different objects (even though they're all coins).

+ Start of frame
- Coin: Spread value 0 in Alterable Value A

This will put the values 0, 1 and 2 into the three different coin objects. This way no one coin object will have the same Alterable Value A. As far as I know TGF/MMF assigns the values based on which object you placed in the frame first.

If you used "Spread value 1", then the values 1 to 3 would be placed in the objects.
If you used "Spread value 5", then the values 5 to 7 would be placed in the objects.

The value you specify when using the "Spread value" action is the first value that will be placed in an object. The last value that will be placed in an object will always be (n-1)+X (where n is the number of objects and X is the value you spread).

I think it took me about 5 years to learn about the Spread value action, and I wish I'd learnt it sooner because it can be very useful

Edited by Flava

 
This is a signature. Have this one on me.

Poobical

Has some jaffa cakes in his coat pocket 3

Registered
  27/11/2008
Points
  54

360 OwnerVIP MemberLOL SignSnow
31st August, 2010 at 19:39:24 -

Yes yes, I think I've got this now, cheers both of ya so much help! I shall be sending trophies your way soon as I have enough points . Been a god-send ^^

 
Image

Poobical

Has some jaffa cakes in his coat pocket 3

Registered
  27/11/2008
Points
  54

360 OwnerVIP MemberLOL SignSnow
31st August, 2010 at 21:32:31 -

Actually now I'm confused again, how do you get the ini file to load said deleted coin?

 
Image

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
31st August, 2010 at 22:33:25 -

Augh, I forgot how limiting TGF1's expression editor was. Every time you try something a limitation gets in the way.

I tried to make an example for you. But failed miserably.

 

  		
  		

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
1st September, 2010 at 02:41:42 -

There is an INI+ object for TGF that is slightly more advanced than TGF's standard INI. If i recall the INI object in MMF2 is the same as the INI+ for TGF.

 
.

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
1st September, 2010 at 03:16:13 -

Theres also ini++, but maybe you cant use that for TGF

 
n/a

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
1st September, 2010 at 13:12:25 -

You will also need the Fastloop object to do loops in TGF1

 
This space is for rent
   

Post Reply



 



Advertisement

Worth A Click