Using ACS scripting to activate/deactivate shaders in game?

Sat Nov 06, 2021 8:14 pm

I downloaded thehttps://forum.zdoom.org/viewtopic.php?f=103&t=57352 from the ZDoom forums and thought it would fit nicely in an upcoming horror style mod. However, Is it possible to use ACS scripting to activate this shader when the player enters a room like he is entering a nightmare scene and the old video shader activates only in that room then deactivates when leaving that same room? I dont want the old video shader to play out all through the map. Think of Silent Hill 3, when some parts of the game uses the film grain effect in some scenes to make it more eerie.

Re: Using ACS scripting to activate/deactivate shaders in ga

Sun Nov 07, 2021 5:16 am

No, but you can use a static ZScript function which can be called from ACS via ScriptCall and in turn can enable or disable the shader.

ACS:
Code:
//make sure the player is the script's activator.
script "ToggleShader" (bool on)
{
    ScriptCall("MyActor", "ToggleShader", on);
}


ZScript:
Code:
class MyActor: Actor
{
     static void ToggleShader(Actor a, bool on)
     {
          if(a && a.player)
          {
               Shader.SetEnabled(a.player,"MyShader",on);
          }
     }
}

Re: Using ACS scripting to activate/deactivate shaders in ga

Sun Nov 07, 2021 2:31 pm

Forgive me for my ignorance, but I have no idea how to begin to set this up or were to put the zscript code or acs functions in a nice pk3 format structure. Never worked with zscript which makes things more convoluted.
Thanks for your reply Cherno!