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).
ScriptExists and ActorExists functions
Moderator: GZDoom Developers
- Ijon Tichy
- Posts: 104
- Joined: Fri Dec 31, 2010 9:22 pm
- Location: Basically I don't exist
- Contact:
- 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
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.
Re: ScriptExists and ActorExists functions
You can check if an actor exists by doing this:
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.bool exists = [wiki]SpawnForced[/wiki] ("ClassToCheckFor", 0,0,0, 4096);
if (exists) [wiki]Thing_Remove[/wiki] (4096);
- 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
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.Kate wrote:It won't have any real impact on the game...
Re: ScriptExists and ActorExists functions
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.
- 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
Thanks for the tip! I'm gonna use that from now on.