Killing AiSpawnpoints
by KevinG · in Torque Game Engine · 12/20/2005 (12:13 pm) · 3 replies
Basically we have a master(boss) bot(s) that has with him a hoard of smaller minion bots.
We have the spawnpoints attached to the master bot so it will continualy replentish any
minions that you kill.
We cant stop the minions from spawning after the master bot is destroyed, and we reallly
need to.
Can we/ How do we drop in a few lines of code that will simply stop spawning minions
once the related master bot is destroyed?
Any help, pointer, clues, tricks, tips, advice, bright alternative ideas to help us along?
Cheers,
KevinG
We have the spawnpoints attached to the master bot so it will continualy replentish any
minions that you kill.
We cant stop the minions from spawning after the master bot is destroyed, and we reallly
need to.
Can we/ How do we drop in a few lines of code that will simply stop spawning minions
once the related master bot is destroyed?
Any help, pointer, clues, tricks, tips, advice, bright alternative ideas to help us along?
Cheers,
KevinG
About the author
#2
That info was pivotal. We ended up crafting something a bit better for our specific situation,
but our little bots now spawn from our big bots---when big bot is killed: no more spawning!!
Cheers,
KevinG
01/17/2006 (3:33 pm)
Thanks Frank!That info was pivotal. We ended up crafting something a bit better for our specific situation,
but our little bots now spawn from our big bots---when big bot is killed: no more spawning!!
Cheers,
KevinG
#3
This helps to not run a method call on an object which doesn't exist. Better to check for existance of a non permanant and then check its state if available.
Also, the half a second think rate is pretty heavy in regards to a constant running schedule and would be a worse resource hog if you encountered several "objects" that were running schedules. It will certainly work, but the time should definately be optimized to be as long as possible while achieving the desired effect.
Just a few cents for ya.
:)
01/17/2006 (3:51 pm)
Just for the record, your approach is subject slight problems for better handling I would use...if(!isObject(%obj) || "Dead" $= %obj.getState()){ return; }This helps to not run a method call on an object which doesn't exist. Better to check for existance of a non permanant and then check its state if available.
Also, the half a second think rate is pretty heavy in regards to a constant running schedule and would be a worse resource hog if you encountered several "objects" that were running schedules. It will certainly work, but the time should definately be optimized to be as long as possible while achieving the desired effect.
Just a few cents for ya.
:)
Torque Owner Demolishun
DemolishunConsulting Rocks!
For instance in the function that creates your master bot:
Now the think routine:
function BotDataBlockName::think(%obj) { // check for bot death if (%obj.getState() $= "Dead") return; %this.schedule(500,"think",%obj); // process bot spawning and whatever else // get spawn points from %obj.spawnGroup using SImGroup methods to get each item in group and spawn a bot }Using the method above makes all spawn spheres relative to each bot. Also if your player dies then you can squash the SimGroup if needed. Notice that the bot will stop thinking if you do not recal schedule on it. Hence it really died.