Game Development Community

Testing if area clear of enemies

by Justin Grant · in Technical Issues · 09/24/2007 (9:06 pm) · 6 replies

I'm trying to add a dungeon to a game I'm making and it's working really well, except I can't figure out for the life of me how you would test if all the enemies have been cleared from a certain area. I assume you use a trigger and some combination of the OnTickTrigger() function but I don't know how to check for specific objects. Anybody got any ideas?

#1
09/24/2007 (10:37 pm)
You could try doing a container search based on a radius, this will give you a list of objects within that radius and you can limit the search to specific types and also do class checking. However doing such a spherical search will have its limitations.

A better solution would be to add all the enemies for each area to a specific simgroup or simset, then simply test the object count within that group/set. If the group or set is empty, the enemies must all have been destroyed/cleared.

Gabriel
#2
09/24/2007 (10:56 pm)
I was thinking I could I something with the sim groups! I'm not sure how to access them though. I haven't done any checking of them before or seem any examples so I don't really know. Is there a tutorial or something I could look at? :)

EDIT: ok nevermind I found it :)

I do have another question though. is there some documentation or something somewhere that lists what functions and variables are attached to what datablocks? Cus it is EXTREMELY annoying trying to do something when you have no idea what functions you could possibly have to use.
#3
09/25/2007 (8:50 am)
There is a function which does just that, however seeing as this is a public forum, I can't really list it here.
If you repost this query in a TGE private forum, I can help you then.

Gabriel
#4
09/25/2007 (10:10 am)
Oh =/ well I don't have the money to afford a license just yet so I'm working off of the demo...I will within a month or so though.
#5
09/25/2007 (10:28 am)
Jumping in late here, but
you could mark up the area with triggers,
and each time a player (or aiplayer) enters a trigger, increment a counter,
and each time a player leaves a trigger, decrement it.

For folks w/ an SDK license i recently made a resource which can help with this sort of thing,
in that it allows many triggers to act as one. - search for "SimSpace".
#6
09/25/2007 (10:40 am)
Alright thanks a lot both of you. I got it working beautifully now.