I'm not sure if there's already a method to do this, but I couldn't find it. As far as I could find, there's currently no way to create a thing in ZScript without putting it onto the map, later adding said thing to the map, or removing them from the map without deleting them from memory. A lot of "object" based frameworks I've worked with typically work this way, where creating and removing a new class would go as so:
(Pseudo code)
Code: Select all
//Creates the actor in memory only
//Usder can assign needed properties here
Shells shelly = new Shells();
//Puts thing on map. User can set it's position afterwards.
map.addChild(shelly);
//Takes it out of the map but does not remove from memory.
//Properties of this actor remain persistent until deleted or whatever
map.removeChild(shelly);
The exact wording of it isn't important, but I imagine it would be a lot easier for thing manipulation if on adding/removal, you wouldn't have to dedicate a separate class/struct to track it's info and have to rely on thing.destroy() and then spawning a whole new actor when the user needs to re-summon it, or rely on hacky tricks like teleporting the actor way outside the map to hide it.