Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Problem with save/load map state?

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Fri Nov 16, 2007 12:23 pm    Post subject: Problem with save/load map state? Reply with quote

I'm working on a game that involves pretty extensive map manipulation upon entering a certain map. There is also a custom script for selecting battles that is set as the map's instead of battle script.

Naturally, I want the map to retain its tweaking between battles, so I simply included a save map script/load map script pair of commands at the beginng and end of my custom battle script. The problem is, this seems to work for retaining the npc positions, but it loses the dynamically generated tile map and wall map. Have I hit a bug, or is this outside the scope of these commands? (Or am I just an idiot missing something obvious?)

Here's the code:

Code:
#fight a random formation, based on dungeon level
plotscript, fight dungeon formation, begin
   
   save map state
   
   switch(level) do(
      case(1) do(
         switch(random(1, 3)) do(
            case(1) do(
               fight formation(0)
            )
            case(2) do(
               fight formation(1)
            )
            case(3) do(
               fight formation(2)
            )
         )
      )
      case(2) do(
         switch(random(1, 3)) do(
            case(1) do(
               fight formation(1)
            )
            case(2) do(
               fight formation(2)
            )
            case(3) do(
               fight formation(3)
            )
         )
      )
                #etc...
   )
   
   load map state
end
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Nov 16, 2007 12:29 pm    Post subject: Reply with quote

Is the map itself configured to retain tilemap/wallmap changes? (You can toggle this under map options.)
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Fri Nov 16, 2007 1:29 pm    Post subject: Reply with quote

The map isn't configured to retain tilemap/wallmap changed. When I toggle this, the problem appears to be solved at first, but unfortunately when I reconfigure the map again the tilemap changes, since the code explicitly writes over each tile with new data, but the old wallmap basically combines with the new once since wallmap data is ORed on, rather than overwritten.

So basically, I actually don't want the map to retain state in some situations (going up or down a level in the dungeon), but I do want it to retain state between battles. Am I unable to use load map state to explicitly do that when the toggles aren't set correctly?
Back to top
View user's profile Send private message
Moogle1
Scourge of the Seas
Halloween 2006 Creativity Winner
Halloween 2006 Creativity Winner



Joined: 15 Jul 2004
Posts: 3377
Location: Seattle, WA

PostPosted: Fri Nov 16, 2007 1:53 pm    Post subject: Reply with quote

Not completely. If that's the case (and that really sounds like a bug), then you could just blank the wallmap before loading.
_________________
Back to top
View user's profile Send private message Visit poster's website AIM Address
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Fri Nov 16, 2007 8:28 pm    Post subject: Reply with quote

Camdog wrote:
The map isn't configured to retain tilemap/wallmap changed. When I toggle this, the problem appears to be solved at first, but unfortunately when I reconfigure the map again the tilemap changes, since the code explicitly writes over each tile with new data, but the old wallmap basically combines with the new once since wallmap data is ORed on, rather than overwritten.

So basically, I actually don't want the map to retain state in some situations (going up or down a level in the dungeon), but I do want it to retain state between battles. Am I unable to use load map state to explicitly do that when the toggles aren't set correctly?


I didn't really understand any of this. What do you mean by "reconfigure"? "toggles"? "correctly"? However, the options in the General Map Data menu should not affect those commands (they should always work).

It is meant to save the entire state of the map. I'll try and remember to check whether it's working.
_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Mon Nov 19, 2007 6:14 am    Post subject: Reply with quote

The Mad Cacti wrote:
I didn't really understand any of this. What do you mean by "reconfigure"? "toggles"? "correctly"? However, the options in the General Map Data menu should not affect those commands (they should always work).


By configure, I just meant what the map was set to in custom. At first, the map was set to not save state. This was good because whenever I teleported the player to the map, I wanted it blank so I could basically write an entirely new map to it. This was bad because when I fought a battle, all this data was lost after the battle. When I wrapped a "load map state" and a "save map state" around the plotscript which called battles, state for tilemaps and wallmaps was not retained, though npcs were. This is what I meant by "correctly". Does the map have to be set to "save map state" or "always load from rpg" (I don't understand the difference between these two, by the way) in order for the save/load map state commands to work? (I see you answered this, just clarifying what I was asking).

For the record, I did get this to work. I simply set the map to always retain data, and then blanked the wallmap and npc data at the beginning of the plotscript that creates a new map. No need for save/load map data at all. It does seem to me that I was encountering a bug with those commands before.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group