Jump to content

Why cant I get postprocess shaders to turn on through scripting?


Gunrock

Recommended Posts

I have spent countless hours trying to produce a script in which the player enters a room and activates this shader.

 

ACS:

script "SetShader" (int shaderSetting)
{
     //assuming that the player has a tid of 1000
    SetUserVariable(1000, "shaderSetting", shaderSetting);
}

Zscript:

class MyPlayerPawn : PlayerPawn
{
       int shaderSetting;
       int shaderSettingLast;
      
       override void Tick()
        {
              Super.Tick();
              if(shaderSetting != shaderSettingLast)
             { 
                  switch(shaderSetting)
                  {
                    case 0:
                     Shader.SetEnabled(player,"ShaderA",false);
                     Shader.SetEnabled(player,"ShaderB",false);
                    break;
	
                   case 1:
                   Shader.SetEnabled(player,"ShaderA",true);
                   Shader.SetEnabled(player,"ShaderB",false);
                  break;
	
                 case 2:
                Shader.SetEnabled(player,"ShaderA",false);
                   Shader.SetEnabled(player,"ShaderB",true);
                 break;
   }

                   shaderSettingLast = shaderSetting;
              }


         }
}

I included a demo map that I have been struggling with this script for hours on.

TestShader.zip

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...