How is the script being triggered? Are you using it as a map autorun script, or calling it from a map autorun script?
The bitset for "Recreate map layers when changing maps" didn't exist in the Zenziznenzic release, it is only available in nightly wip builds.
The "remove caravan" script is to prevent the caravan from appearing in the same spot on the next map you visit. I think the easiest way to run it would be in the map autorun for each map that you can get to directly from the map that has the caravan on it.
I really need to add a "default map autorun" script that can run on every map. that will make things like this easier to script without needing to set an autorun for each connected map.
Here is an example of a map autorun that could be used for all maps
Code:
plotscript, universal map autorun, begin
if(current map == 3) then( # replace 3 with the actual map number that has the caravan
load caravan
)else(
remove caravan
)
end
Of course if you already have some map autorun scripts on some of your maps, then this gets a little more complicated