I have some enemy soldiers that spawn on my map and the objective is to kill them all before moving onto the next obhective.
In the map my soldiers are set to #set1 and have the $targetname of enemyspawner and i have this script...
obj2:
waitthread global/objectives.scr::add_objectives 1 1 "Kill any german soldiers" $obj2.origin
// Turn on objective #2 and set it as current objective.
waitthread global/objectives.scr::add_objectives 1 2
waitthread global/objectives.scr::current_objectives 1
thread spawnset1
end
spawnset1:
$first_trigger waittill trigger
thread global/ai.scr::spawnset 1 spawn 1
level.bad_guys_left = 0
$spawn1 thread BadGuyCheck
end
BadGuyCheck:
level.bad_guys_left++
self waittill death
level.bad_guys_left--
if ( level.bad_guys_left==0 )
{
// second mission complete check it off...
waitthread global/objectives.scr::add_objectives 1 3
waitthread global/objectives.scr::current_objectives 0
thread obj3
}
end
The problem is when i have killed all the soldiers it will not move onto the next obj,am i missing something here?
Oh yeah $first_trigger is to trigger the spawners and i clear the objectives after each mission so they are al objective 1 3 etc..
counting dead enemy soldiers
Moderator: Moderators
counting dead enemy soldiers
My candle burns at both ends it will not last the night but oh my foes and oh my friends it gives a lovely light.
in the global/ai.scr level.totalbaddies are set when ever a spawner is created
Give it the same #set value as whichever spawners you want it to set off
thread global/ai.scr:: spawn 1
but that can be done with a enemyspawnertrigger
Most of what you did was not nessesary as it is already done in the global/ai.scr you do need to do the objective things though
A suggestion on how you might do this:
make a enemyspawnertrigger with set number 1 . Set the setthread key on the trigger to run a thread that sets up the objetives , turns off the trigger if you only want them to spawn once and waits for level.totalbaddies to = 0 before doing the next objective
and when an spawner diesif (level.totalbaddies == NIL)
level.totalbaddies = 1
else
level.totalbaddies++
deathcheck:
self waittill death
level.totalbaddies--
end
You can also use a trigger with the name enemyspawnertrigger$first_trigger waittill trigger
Give it the same #set value as whichever spawners you want it to set off
There is no spawnset thread in the global/ai.scr there is however a spawn threadthread global/ai.scr::spawnset 1 spawn 1
thread global/ai.scr:: spawn 1
but that can be done with a enemyspawnertrigger
Most of what you did was not nessesary as it is already done in the global/ai.scr you do need to do the objective things though
A suggestion on how you might do this:
make a enemyspawnertrigger with set number 1 . Set the setthread key on the trigger to run a thread that sets up the objetives , turns off the trigger if you only want them to spawn once and waits for level.totalbaddies to = 0 before doing the next objective
