Game Development Community

Deleting in Game Objects

by Bill Koons · in Technical Issues · 10/21/2004 (7:03 am) · 4 replies

Does anyone know of a good way to remove game objects once the game has started. I have a AI player I want to remove from the game once a trigger has been fired. The setHidden seems to crash my game. Is there a better way to do this?

#1
10/21/2004 (7:20 am)
You might be able to .delete() the bot

or .kill("suicide"); the bot, should remove it as long as you do not have code in ::onDeath() to respawn a killed bot

-Ron
#2
10/21/2004 (8:56 am)
You can also use

%bot.done();
#3
10/21/2004 (9:38 am)
What is the %bot, is that the datablock name of my AI I am trying to remove?
#4
10/21/2004 (12:41 pm)
Function AiPlayer::done(%bot)
{

}


Is the function it will call. If you make the call on the right object.


%bot refers to the AIPlayer you are trying to delete. So if you are using the DemoPlayers from the example or demo, when the AIManager spawns it's player, '%bot == AIManager.player'.


When you use %this from the "AIPlayer::onDoSomething(%this)", %this == AiManager.player == %bot.

When you use the "DemoPlayer::onDoSomething(%this, %obj)" %this = DemoPlayer datablockID#(or "DemoPlayer") and %obj == AiManager.player == %bot