Author Topic: try again option  (Read 4670 times)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
try again option
« on: 2008-03-11, 11:34:39 AM »
here are the facts:
if the player wins on map1, it switches to you-win-map. there's an option "try again". choosing this, the game will load a savegame which was made right after starting the game. before making this savegame, one counter was excluded from save unit. i assumed, when entering map1 again, this counter would stay on its old value. it doesn't work, so i was maybe wrong. right?

(the only thing i am trying to do, is providing a try again option after the end of the game. it would work well with the savegame. but sadly i fade from the start screen (overlay map) over to map1. But that fade-in shouldn't be there if the player starts again. i could maybe save when the fading is done. but in the meantime the player could have moved and would therefore start at another place as at game start. and this is the reason for that one counter i would like to exclude. with it i could manage this all.)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: try again option
« Reply #1 on: 2008-03-11, 02:51:28 PM »
Maybe you neglected to include all counters before excluding a counter.  If you don't specify something to include before saving then everything will be included by default (and nothing is excluded no matter what).  If you do specify something to include, only the things that you include will be saved, so remember to include everything, then exclude the counter you want to exclude.  Exclude only works on things that have been included first.  (I think the documentation hints at this if you read the info about ExcludeCounterFromSaveUnit.)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: try again option
« Reply #2 on: 2008-03-11, 03:01:36 PM »
so would you say it would work like i thought? if switching back from another map, an excluded counter would remain the same? but i don't switch back, just load a savegame...
 i have nothing specified to include before. only exclude and later save game.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: try again option
« Reply #3 on: 2008-03-11, 05:34:48 PM »
Yes, I think it would work the way you describe if you include everything first.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: try again option
« Reply #4 on: 2008-03-12, 04:19:21 AM »
it is so strange, i get hung up about it. every time one tells me script things, it doesn't work here. is that because of me?
right before the rule "exclude special counter", i have inserted the rule "include all counters". and now, if i want to load the savegame, it doesn't work.

edit:
that is really strange. i made a few tests now. i debug the two counters Health and Win. when i hit "try again", they become their initial value, what would mean the savegame is loaded. but why doesn't the normal map appear and the end screen disappear? (btw. if i suspend the "include all counters" rule, it works.)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: try again option
« Reply #5 on: 2008-03-12, 05:07:38 AM »
it is so strange, i get hung up about it. every time one tells me script things, it doesn't work here. is that because of me?

No, you're dealing with a complex project so there are lots of opportunities for things to go wrong, especially since it's not clear how your project works to everyone.  This is what programming is like.  Nothing ever works on the first try (except a week ago Wednesday when I added some code to my software at work, and it magically worked on the first try... but that happens very very rarely).

right before the rule "exclude special counter", i have inserted the rule "include all counters". and now, if i want to load the savegame, it doesn't work.

You need to include everything else too, otherwise only the counters are saved.

edit:
that is really strange. i made a few tests now. i debug the two counters Health and Win. when i hit "try again", they become their initial value, what would mean the savegame is loaded. but why doesn't the normal map appear and the end screen disappear? (btw. if i suspend the "include all counters" rule, it works.)

If you only include the counters, then nothing else is included.  Have you read all the help for the IncludeInSaveUnit function?  Only the things that you include are saved, unless you include nothing; then everything is saved by default.  The reason the map didn't change is probably because you didn't include "WhichMapIsCurrent" in your save unit.