Knuckle Cracker

Creeper World 3 => The Coder's Corner => Topic started by: Grauniad on December 18, 2012, 08:56:33 PM

Title: Tricky question
Post by: Grauniad on December 18, 2012, 08:56:33 PM
If I set some "Once" commands for a CRPLTower, do I then have to save the map before I run it to ensure that the Once is executed for the player and not for me alone?


IOW. How do I set/preserve initial state on a map?

Also. I don't want my CRPL script to run before a CN hasn't touched down.
Title: Re: Tricky question
Post by: knucracker on December 18, 2012, 09:04:56 PM
Hmmmmm.....  Good question.  Good one...
I need a separate save, or a button to "reset to initial state" before you save.

Normally, a save game needs to serialize the internal once map since you don't want once clauses executing again upon each game load (don't ask.... that would be an extra evil way to penalize players who load a lot....).

But you are correct, when you save the map for consumption you want things reset to first positions, so to speak.  You want the time zeroed as well (which you can do with a key press currently).  You want the internal update count zeroed, etc.  I'll write this one down on my pad for a 'first thing in the morning' job.

As for checking the number of CN's on the map.... sounds like maybe I need a new API for that "GetCommandNodeCount", or such.
Title: Re: Tricky question
Post by: lurkily on December 18, 2012, 09:22:35 PM
I presume you could just recompile each script before saving, as a stopgap measure?
Title: Re: Tricky question
Post by: knucracker on December 18, 2012, 11:07:29 PM
Yeah, that will reset all script related data, including the once map.