Why are monsters capable of activating without setting their Activation property explicitly?

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Post Reply
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Why are monsters capable of activating without setting their Activation property explicitly?

Post by Jekyll Grim Payne »

So, recently I've been trying to carefully document the confusing concept that is activation/deactivation, which resulted in me rewriting this article on the wiki: https://zdoom.org/wiki/Activation

It's a deceptively complex complex, because it touches upon both actor special execution, and the Activate()/Deactivate() virtuals, which are largely unrelated, except when there's an overlap with USESPECIAL/BUMPSPECIAL.

In any case, I've figured most of it out. Except one thing: for some reason, adding, for example, USESPECIAL and an Activate() override to an actor works as-is on monsters:

Code: Select all

class DoomImp_ : DoomImp
{
	Default
	{
		+USESPECIAL
	}

	override void Activate(Actor activator)
	{
		Console.Printf("Calling Activate()");
	}

	override void Deactivate(Actor activator)
	{
		Console.Printf("Calling Deactivate()");
	}
}
...BUT on non-monster actors it requires explicitly setting Activation THINGSPEC_Activate in their default block. On monsters the above code just works, on non-monsters it doesn't unless I set up the Activation property.

For the life of me, I can't figure out why; I've looked through the related ZScript and C++ functions and I don't see where this is set up or what even the conditions are (the ISMONSTER flag? something else?)

I need help figuring it out to complete the documentation and get rid of that Need more info bit I have there for now.
User avatar
phantombeta
Posts: 2179
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Why are monsters capable of activating without setting their Activation property explicitly?

Post by phantombeta »

I can't reproduce this on 4.11.3, nothing happens when trying to +use a DoomImp_.
User avatar
Jekyll Grim Payne
Global Moderator
Posts: 1118
Joined: Mon Jul 21, 2008 4:08 am
Preferred Pronouns: He/Him
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: Why are monsters capable of activating without setting their Activation property explicitly?

Post by Jekyll Grim Payne »

Okay, I'm confused because now I can't reproduce this either. Apparenly I confused myself during the multiple rounds of testing with ZScript and ACS...

While researching this further, it seems I was misunderstanding some of the THINGSPEC flags. From what I see now, the only flags that deal with Activate()/Deactivate() virtuals are THINGSPEC_Activate, THINGSPEC_Deactivate and THINGSPEC_Switch. All other THINGSPEC* flags only deal with the execution of the actor's special and don't interact with the virtuals at all (except maybe modifying activator pointers, I'm not sure).
Post Reply

Return to “Scripting”