Check if an actor exists? [split]

Please do not mimic the behavior of the posts shown here.

Moderator: GZDoom Developers

Check if an actor exists? [split]

Postby determin1st » Tue Dec 14, 2021 6:52 pm

to determine if projectile/actor still exists

Code: Select allExpand view
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
User avatar
determin1st
 
Joined: 06 Oct 2021

Re: Check if an actor exists?

Postby Rachael » Tue Dec 14, 2021 8:59 pm

determin1st wrote:to determine if projectile/actor still exists

Code: Select allExpand view
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.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Check if an actor exists?

Postby determin1st » 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
User avatar
determin1st
 
Joined: 06 Oct 2021

Re: Check if an actor exists?

Postby Rachael » 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.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support

Re: Check if an actor exists?

Postby determin1st » 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) :)
User avatar
determin1st
 
Joined: 06 Oct 2021

Re: Check if an actor exists?

Postby Rachael » 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.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle
Graphics Processor: nVidia with Vulkan support


Return to Hall of Unpleasantness

Who is online

Users browsing this forum: No registered users and 1 guest