Game Development Community

Destroying Objects on the fly

by Kiraya2 · in General Discussion · 08/22/2003 (12:03 am) · 2 replies

I'm trying to destroy ad object (or a Datablock)
on the fly.

Thinking about some DevEnv I've tryied to do

function DatablockData::destroy(%block)
{
  %block = nothing;
}

but it doesn't work.

Any suggestions ?

#1
08/27/2003 (12:34 am)
Adding and removing datablocks on the fly is not recommended since at mission load time the dataBlocks are cached to the client. A way to do this however is to add/remove an object built by a dataBlock.

You can setup a global object.
$Flag4 = new Item() {
dataBlock = "Flag4";
};

If you have an Item dataBlock called Flag4 this creates the object, other-wise you can an error.

$Flag4.delete();

This deletes the object if the object exists.
#2
08/27/2003 (5:31 am)
Ok tahks a lot
so I will do :

new databloc ("pippo")
{
...
params
...
}

$pippo = new Ietm(){
dataBlock = "pippo";
};

$pippo.delete();

or something like that.

I would like to generate object and destroy them to obtain
a zoned mission.