Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

checking monsters are dead in ACS

Recommended Posts

If I have two monsters in a room (imps lets say) how can I check that both are dead before spawning a shotgun for example.

If both the imps had TID 2 and a mapspot had TID 1, would be something like:

if(ThingCount(T_IMP,2) == 0)
Thing_spawn(1, T_SHOTGUN, 0,0);

Share this post

Link to post

Try this:

While(ThingCount(0, 1))
Thing_spawn(2, T_SHOTGUN, 0,0);

This will check every 1 tic, if there are things with tag 1 in play.
If not, it will spawn the shotgun at a mapspot with tag 2!

Share this post

Link to post

I do it that way:

I have 4 barons in some sort of small arena.
All 4 get a thing tag of 2 (for the second argument in ThingCount).
Then just cnp my code and it should work. It works here so....

script 4 (void)
	if (ThingCount(T_BARON, 2) == 0)
Just insert your Thing_spawn(2, T_SHOTGUN, 0,0); inside and delete my stuff.
Dont forget to change T_BARON to T_IMP.
This way you only check for Imps with id 2 and nothing else, so you can reuse id 2 for other monster groups of the same type.
If you want to check for a group of different monsters just leave the T_* and insert a 0 (zero). NULL should do the same job and is better to read.
And one last thing, alway comment ;)
Or you need to backtrack what a function should do......

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now