Full Version : Despawn on empty group
xmlspawner >>Q&A >>Despawn on empty group
<< Prev | Next >>
afonso- 04-19-2006
I made a small invasion spawn. It spawns a bunh of orcs that follow waypoints up to the town, and at the same time spawns a guide inside the town that yells "Orcs are invading". I set the duration for 2 hours, because I don't want the orcs to just stay there if no one wants to kill them, but I wanted to make it so the guide would disapear immediatly after all the orcs had been killed (so it doesn't stay there for 2 hours in case someone does attack them).
I'm pretty sure it has something to do with assigning a 2nd subgroup, but I'm not sure how.
Thanks for the help
afonso
ArteGordon- 04-19-2006

QUOTE (afonso @ April 19, 2006 08:06 am)
I made a small invasion spawn. It spawns a bunh of orcs that follow waypoints up to the town, and at the same time spawns a guide inside the town that yells "Orcs are invading". I set the duration for 2 hours, because I don't want the orcs to just stay there if no one wants to kill them, but I wanted to make it so the guide would disapear immediatly after all the orcs had been killed (so it doesn't stay there for 2 hours in case someone does attack them).
I'm pretty sure it has something to do with assigning a 2nd subgroup, but I'm not sure how.
Thanks for the help
afonso

yeah, I can think of a couple of ways of doing that.
METHOD 1:
One way would be to set up your invasion spawner as a sequential spawn, with the invading orcs on subgroup 1, and a spawn entry that despawns your town guide on subgroup 2.
Like this
GuideSpawner
subgroup 1: townguide
just set the GuideSpawner to spawn however you want. The subgroup assignment lets to refer to it with the SETONSPAWN keyword in the InvasionSpawner
InvasionSpawner
subgroup 1: orcs
subgroup 2: SETONSPAWN,GuideSpawner,1/DELETE
turn on sequential spawning and set the Kills field for the orc entry to whatever number of kills you want them to make before advancing. You may also want to set the KillReset property on the spawner which is the maximum number of spawner ticks players have to make a kill before the kill count is reset back to zero (it sets the rate at which players must kill spawns to keep adding to the kill count). If you make it big then players can take a long time between kills and still have the count increase.
When they kill the required number of orcs, the sequence will advance to subgroup 2, which will despawn the townguide on your GuideSpawner.
METHOD 2:
That solution is not exactly what you described since it will despawn after a certain number of kills rather than when the count for the orc subgroup reaches zero.
To do that you could use 3 spawners, one for the guide, one for the orcs, one to despawn when the orc count reaches zero.
GuideSpawner
subgroup 1: townguide
just set the GuideSpawner to spawn however you want. The subgroup assignment lets you refer to it with the SETONSPAWN keyword in the DespawnSpawner.
InvasionSpawner
subgroup 1: orcs
just set the InvasionSpawner to spawn however you want. The subgroup assignment lets you refer to it with the GETONSPAWN keyword in the DespawnSpawner.
One handy tip is that if you set the Group property of the invasion spawner to true, then it will not respawn any orcs until all the spawns have been eliminated.
DespawnSpawner
subgroup 1: IF/GETONSPAWN,InvasionSpawner,1,COUNT=0/33
subgroup 2: GOTO/1
subgroup 33: SETONSPAWN,GuideSpawner,1/DELETE
turn on sequential spawning and this will test the spawn count for subgroup 1 on your InvasionSpawner and will spawn subgroup 33 when that count reaches 0.
METHOD 3:
You could also set it up as in method 2 but make your DespawnSpawner a triggered spawner with the single entry
SETONSPAWN,GuideSpawner,1/DELETE
and set the TriggerObjectProp to the string
GETONSPAWN,InvasionSpawner,1,COUNT=0
and have the TriggerObject point to the Invasion spawner (it doesnt really matter since you will be referring to the invasion spawner by name with the GETONSPAWN keyword in the TriggerObjectProp string).
The spawner will then be triggered when the orc count on the invasion spawner goes to zero and when triggered it will spawn the entry to delete the guide.
There are other ways as well, but these should give you some ideas.