counting dead enemy soldiers

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
LtNeil
Sergeant
Posts: 54
Joined: Sun Nov 14, 2004 8:46 pm
Location: southend on sea
Contact:

counting dead enemy soldiers

Post by LtNeil »

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..
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.
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

second mission complete, you're making #1 complete. (1, 3)

isn't there a key/value something like

deaththread/value

???

i don't know, but i'm sure i saw something like it somewhere. it'd make it easier indeed.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

in the global/ai.scr level.totalbaddies are set when ever a spawner is created
if (level.totalbaddies == NIL)
level.totalbaddies = 1
else
level.totalbaddies++
and when an spawner dies
deathcheck:

self waittill death
level.totalbaddies--
end

$first_trigger waittill trigger
You can also use a trigger with the name enemyspawnertrigger

Give it the same #set value as whichever spawners you want it to set off
thread global/ai.scr::spawnset 1 spawn 1
There is no spawnset thread in the global/ai.scr there is however a spawn thread

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
Image
Post Reply