Is CRPL script state saved when finalizing a map?

Started by stewbasic, June 28, 2014, 05:39:10 PM

Previous topic - Next topic

stewbasic

I'd assumed that creating a finalized map is the same as saving the current game state. However when I start playing the finalized map it seems like all script variables are reset and the "once" blocks run again. If I play in the editor after finalizing it works as expected. I'm guessing none of the CRPL state is stored with the finalized map, is that correct?

It seems I can get around this by saving to a slot in the editor, and then copying WorldEditor/MapName/save-n.cw3 to Finalized/MapName/MapName.cw3. Is this a bad idea?

Flabort

That's running as it's meant to. A finalized map is supposed to be the "beginning" state, so that scripts that only run at the start of a map can run.

If it runs a script that it's not supposed to after you finalize, then go back to the editor and remove the script from any cores it's on; for example, the make-circular-terrain script, after you run it you're supposed to remove it, reset the time, remove creeper, etc. If you leave it in place but have edited terrain over the circle, then when the finalized map starts the nice looking terrain will be covered back up with the circle.

Yes. It's a bad idea to "faux-finalize" a map like that.
My maps: Top scores: Sugarplum, Cryz Dal, Cryz Torri, Cryz Bohz (Click fetch scores, page courtesy of kwinse)

stewbasic

Quote from: Flabort on June 28, 2014, 06:39:14 PM
That's running as it's meant to. A finalized map is supposed to be the "beginning" state, so that scripts that only run at the start of a map can run.

If it runs a script that it's not supposed to after you finalize, then go back to the editor and remove the script from any cores it's on; for example, the make-circular-terrain script, after you run it you're supposed to remove it, reset the time, remove creeper, etc. If you leave it in place but have edited terrain over the circle, then when the finalized map starts the nice looking terrain will be covered back up with the circle.
In this case it's not that I don't want the script to run; I want to set up some state (eg fill out a list of unit IDs, destroy some units after recording their position) before the player starts the map. One solution is to do this the first time I hit :Awake, but that means the finalized map is actually not in the "beginning" state that the player is meant to first see. In this case I'd replace the thumbnail with what the player should see.

Quote from: Flabort on June 28, 2014, 06:39:14 PM
Yes. It's a bad idea to "faux-finalize" a map like that.
Why? Other than the scripts, does finalizing trigger any initialization that normal save slots don't? I was worried about the opening conversation but this seems to work fine.