Check if an actor exists? [split]

Tue Dec 14, 2021 6:52 pm

to determine if projectile/actor still exists

Code:
GetActorProperty(tid, APROP_Health); // 0=removed


if projectile goes into the sky, it's removed without entering "Death" state, user_* variables start to return zeros, APROP_Health is also zero

Re: Check if an actor exists?

Tue Dec 14, 2021 8:59 pm

determin1st wrote:to determine if projectile/actor still exists

Code:
GetActorProperty(tid, APROP_Health); // 0=removed


if projectile goes into the sky, it's removed without entering "Death" state, user_* variables start to return zeros, APROP_Health is also zero

For one - the original question in this thread was already answered.

For two - this doesn't even answer the original question.

Re: Check if an actor exists?

Wed Dec 15, 2021 2:54 am

Rachael wrote:For one - the original question in this thread was already answered.

For two - this doesn't even answer the original question.


why not answer.. actor (actor's class) may be defined (and even created/spawned), but not exists at the map, one of the meaning of existence word, right? i was searching the "zdoom check actor exists" and got to this post. getting the health property is better, because GetActorClass() results in "None" in this case

Re: Check if an actor exists?

Wed Dec 15, 2021 7:25 am

You would have been better off making a new thread in that case, and straight up asking. There are better ways of checking for existence of actors than checking their health - you can actually just count them, instead.

You shouldn't rely on health for obvious reasons - first and foremost it may return the health (albeit lacking, if it's dead) of the first actor it finds. Try https://zdoom.org/wiki/ThingCount instead.

Re: Check if an actor exists?

Wed Dec 15, 2021 8:10 am

Rachael wrote:You would have been better off making a new thread in that case, and straight up asking. There are better ways of checking for existence of actors than checking their health - you can actually just count them, instead.

You shouldn't rely on health for obvious reasons - first and foremost it may return the health (albeit lacking, if it's dead) of the first actor it finds. Try https://zdoom.org/wiki/ThingCount instead.


i disagree (better ways, ThingCount).. for obvious reason - i know the count exactly, it's 1, the other inconvenience of this function is it's first argument, it's poorly described what it does and why there is a possibility to specify tid which *assumed* to be unique. yes, i did look around the doc before in hope to find Thing_Exists() or alike, read about ThingCount.. my method is better (in sky + projectile context) :)

Re: Check if an actor exists?

Wed Dec 15, 2021 8:53 am

Either way - it is NOT RELEVANT to this topic. Read the first post - it has nothing to do with your idea.

Please stop bumping topics with unrelated stuff.