ScriptExists and ActorExists functions

Moderator: GZDoom Developers

Post Reply
User avatar
Ijon Tichy
Posts: 104
Joined: Fri Dec 31, 2010 9:22 pm
Location: Basically I don't exist
Contact:

ScriptExists and ActorExists functions

Post by Ijon Tichy »

int ScriptExists(int scriptIdent);

This is a pretty simple suggestion. Returns 1 if a script identified with the given number/string exists, and 0 otherwise. This would be handy for modular ACS systems that don't want to have "Unknown script 42" popping up all the time.

inb4shotdown

Edit: SImilarly,

int ActorExists(int actorName);

Returns 1 if an actor with the given names exists, 0 otherwise. Same idea, but probably less useful (can't you just define a dummy actor you twat).
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: ScriptExists and ActorExists functions

Post by Ed the Bat »

These suggestions seem great to me. I've found that defining dummy actors leads to conflictts when the real one is found, as the engine won't know which one to use in some situations (not to mention the ugly warning). Defining dummy scripts seems to work, however, as a matching script in a newer library will quietly override the dummy.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: ScriptExists and ActorExists functions

Post by Kate »

You can check if an actor exists by doing this:
bool exists = [wiki]SpawnForced[/wiki] ("ClassToCheckFor", 0,0,0, 4096);
if (exists) [wiki]Thing_Remove[/wiki] (4096);
It won't have any real impact on the game since if the thing is removed before the tic is over, it won't have had any chance to really do anything because doom logic prevents action functions from ever being executed on first spawn (which is why the first spawn frame never does anything), therefore allowing you to simply check to see if it exists at all.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: ScriptExists and ActorExists functions

Post by Ed the Bat »

Kate wrote:It won't have any real impact on the game...
Unless it happens to be a projectile and the spawnpoint chosen happens to have a player or monster in it. Then it will injure them, even within the 0 tics for which it exists.
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Re: ScriptExists and ActorExists functions

Post by Kate »

in that case, use -32767.0,-32767.0 as the coordinates since no legitimate doom map can ever be that big without breaking the blockmap =p (reference)
Last edited by Kate on Tue Mar 26, 2013 1:29 pm, edited 2 times in total.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: ScriptExists and ActorExists functions

Post by Ed the Bat »

Thanks for the tip! I'm gonna use that from now on.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”