SetThingSpecial and Controlling Dynamic Lights

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.

SetThingSpecial and Controlling Dynamic Lights

Postby volumetricsteve » Sat Sep 12, 2020 8:34 pm

I would like to control two dynamic lights from ACS.

Based on what I've seen here & here:

https://forum.zdoom.org/viewtopic.php?f=123&t=66846

https://zdoom.org/wiki/SetThingSpecial


It seems I should be able to control dynamic lights in-game with SetThingSpecial(); but I'm not seeing how to do that exactly.
SetThingSpecial looks like it takes a TID (which I'm not entirely clear on) and an arbitrary list of parameters that get set on that TID. I assume TID == entity number in GZDoom Builder, but based on the TID page....I don't actually know what it means, how TIDs are used, or where they're configured.

https://zdoom.org/wiki/TID

I don't see anywhere in GZDoom Builder where I'd set a TID, so I guess it's the entity ID? Or, in "Edit Thing" I have a tab that says "Action / Tag / Misc." In there, I can set a Tag, and I can set the two dynamic lights I care about to Tag 19 - I have no idea if that's the same as "TID" but I gave it a try and it seemed to have no impact.

From the original thread I listed, this was said:

22alpha22 wrote:I don't know if you still need help with this, but dynamic lights can absolutely be controlled from ACS. Just use SetThingSpecial to set the lights arguments and they will change in real time. You don't actually even need to give the lights a special, just set the special to '0' and set the arguments as usual.


I don't see where I'd set a light to "special" in any event, so I can't very well set it to '0'. Based on what's documented in the SetThingsSpecial(); wiki, I don't even know where to start with 'setting the arguments as usual'

My total shot-in-the-dark guess was:

Code: Select allExpand view
SetThingSpecial(19, 255, 255, 200);


I thought 19 would be the TID and the next three segments would be R , G and B

No impact.

I tried the same thing where instead of 19 for the TID, I tried the entity numbers on two lines:

Code: Select allExpand view
SetThingSpecial(186, 255, 255, 200);

Code: Select allExpand view
SetThingSpecial(187, 255, 255, 200);


No impact.

Without knowing which argN segment corresponds to what property, I'm just brute forcing guesses.

I did find this, but it says for ZScript only...and I think ZScript != ACS?

https://zdoom.org/wiki/Controlling_dynamic_lights


Any suggestions would be greatly appreciated.
volumetricsteve
 
Joined: 16 Feb 2015

Re: SetThingSpecial and Controlling Dynamic Lights

Postby DyNaM1k » Wed Sep 16, 2020 11:49 am

What SetThingSpecial() does is it assigns an action special (opening doors, raising/lowering floors and ceilings, etc.) to a thing. When the thing is activated, the action special will execute. You can also execute scripts like this.

Yes, TID is pretty much what you said, an entity number in a map editor, in your case, GZDoom Builder (You should switch to Ultimate Doom Builder btw).

Yes again, ZScript is very different from ACS. ACS is mostly used for map events and such, while ZScript is a replacement for DECORATE. It can do everything DECORATE does and much more.

Now to answer your main question, the mistake you are making is misusing the function. Make sure the dynamic lights have an unique TID, then, start passing the right arguments to SetThingSpecial. Look at the wiki page again. The first argument should be the TID, second is the number of the action special, the rest is the arguments for the said special. So in your case, you'd do something like

Code: Select allExpand view
SetThingSpecial(69, 0, 255, 0, 0, 128);


Where 69 is the TID of the dynamic light thing, 0 is the number of the action special, the middle three are the RGB values and lastly, 128 is the intensity of the light.
You can get a better idea of this by right-clicking the dynamic light thing in the editor and going to the second tab. You'll see everything there.

Hope this helps.
DyNaM1k
 
Joined: 25 Aug 2018
Discord: DyNaM1K#9464
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: Intel (Modern GZDoom)

Re: SetThingSpecial and Controlling Dynamic Lights

Postby volumetricsteve » Sat Oct 17, 2020 5:16 pm

This is fantastic, thank you! I'll give this a try.

*Give lights unique TID (does each one need to be different? the two I have in mind will be doing the same thing)
*apply new parameters with SetThingSpecial

I have updated to UDB since my last post as well.

I'm looking at the "Action" section of the second tab, as you suggest, but I'm not seeing how I'd determine which of the parameters in this window would correspond to the ordering of arguments passed to SetThingSpecial().

Based on what you said, 69 is the light TID, 0 is the Action Special, the Next three arguments are RGB and you end with Intensity.

Given what the window says, it looks like the last two arguments should be "Start intensity" and "End intensity", so it looks like the ordering of arguments is reading down a column, then moving to the next right column. Is that always a safe bet?

In that case, I would think I should be passing arguments like this:

Code: Select allExpand view
SetThingSpecial(69, 0, 255, 0, 0, 128, 256);


or, if I only care about the color and wanted to leave the intensity alone, could I pass fewer arguments?

Code: Select allExpand view
SetThingSpecial(69, 0, 255, 0, 0);


I also wonder, what if I just wanted to change the intensity?
If I did:
Code: Select allExpand view
SetThingSpecial(69, 0, 0,0,0, 128, 256);


wouldn't that make my light go dark? I guess I'd have to just put in the existing values for the color in order to change the intensities?

I'll try a few things but this is a big help. Thanks again.
volumetricsteve
 
Joined: 16 Feb 2015


Return to Scripting

Who is online

Users browsing this forum: No registered users and 0 guests