I'm inexperienced with effect shaders, but I'm looking for a way to keep other shaders from overriding the one I place on the player with a script. For instance, I script player.pms effectBurden on the player and I want it to stay on the player for a little while. But then a spell like Shield 5pts for 30 seconds virtually erases the Burden shader I put there. Is there a setting in the shader's properties to keep other shaders from overriding the one I put on the player?
If not, I guess I'll just script an update every couple seconds for the duration I want the shader on the player in case of any interruptions. Unfortunately, I've found no trace of a function that checks if a specific shader is on the player.
Thought I'd update my little shader adventure here in case anyone else comes across the same issue.
Well, in regards to my problem stated above, I couldn't find any kind of override prevention flag/property for shaders so I decided to add a update via my script that reapplies the intended "permanent" shader every couple seconds. The trick is to create two identical copies of your shader (I give the first one an "OnOff" suffix, and the second one an "Upkeep" suffix to tell them apart). Most shaders typically have a fade in/fade out effect designated by the
Alpha Fade in Time,
Full Alpha Time, and
Alpha Fade out Time of the
Fill/Texture Effect and
Edge Effect properties. Because of this, if you just keep applying the same shader to an object at a fixed interval, it'll simulate a "pulsing" effect from the Alpha Fade in Time settings everytime the shader is applied. Shaders already on the object actually stay on the object in layers. So when the most current one is removed, the next one underneath it becomes visible again (no fade in effect because it's been there this whole time). To get around this, and emulate a constant shader effect even when additional ones are added on top, we make the two copies of our shader with differeing fade in/out times and layer them with the script. The OnOff (1st) shader has your desired Fade In interval, but an
immediate Fade Out. The Upkeep (2nd) shader has an immediate Fade In interval with whatever Fade Out value you want. So in the script:
First we set everything up
scn ExamplePermaShaderScriptshort doonce01float timer01;This is the timer for marking the intervals the Upkeep shader is applied.float timer02;This is the overall timer for the entire effect. For this example, we want an uninterrupted shader applied to the player for 60 seconds, after which it will be removed.float fQuestDelayTime;For increasing the rate at which the script is processed.
Now for the actual application of the shaders. The script will apply the Upkeep shader every 2 seconds to keep any other long duration shaders (i.e. from spells) from overriding ours.
BEGIN GAMEMODEset fQuestDelayTime to .1;Important to keep track of the small interval timer we use.set timer01 to ( timer01 + GetSecondsPassed );Shader timer.set timer02 to ( timer02 + GetSecondsPassed );Overall effect timer.if ( doonce01 == 0 ) player.pms ExampleShaderOnOff;Shader #1, with the Fade In effects we want, is applied. set doonce01 to 1endifif ( timer01 >= 2 ) player.pms ExampleShaderUpkeep set timer01 to 0endif;The timer is reset every 2 seconds and the Upkeep shader is applied. Why 2? I don't know. It works.
Now we script the second timer to regulate the overall effect, which expires after 60 seconds with the removal of both shaders. The order the shaders are removed is important to avoid any visual "hiccups". When a shader is removed, no previously remaining shaders are visual until the current one's Fade Out time is up and it is completely removed. Because of this, the object will fade back to normal for a brief time before the underlying shader becomes visible again. But if we remove the shaders in the proper order, we can avoid this.
if ( timer02 >= 60 ) player.sms ExampleShaderOnOff;It's important to remove this one first. Remember, we set it to have NO Fade Out time, so it's removal is instantaneous and the underlying shader is immediately visible. player.sms ExampleShaderUpkeep;Remember, we gave this one a designated Fade Out time, so when it's removed, we get the desired effect.endifEND
Now, during the 60 seconds, if you or someone else casts a spell with a duration on yourself, the spell's respective shader only applies when the spell is applied to you, after which the script updates your intended "permanent" shader to be reapplied, overriding the current one from the spell. Unfortunately, the transition isn't seamless. But I consider that an adequate quirk of the game as it gives you good visual confirmation that another spell has successfully affected you.
NOTE: The script is just a general one for the sake of the example. It can most likely be edited to be more resource efficient for those who don't like running pointless, background quest scripts.
Thanks. I hope someone finds this helpful.