I'm trying to make a script that adds glow to Dwemer automatons. (As an update to my already existing mod)
My mod currently uses membrane shader that covers automaton glow when automaton dies. (Automatons have glow maps attached to meshes) This method works perfectly, however there are few things that are bad -
1. The effect must remain constant after automatons have been killed.
2. Already dead automatons (not the static ones - but the not active, never been alive ones) are glowing, because they use the same mesh as living ones.
3. When using ENB, the glow shines a bit through the membrane shader after automaton gets killed. (depends on the ENB settings)
4. The membrane shader uses texture, but the problem is that the texture, when added as a membrane, looks too dark in the places with bright light and too bright in the darkness.
Solution - turn this thing around. In my update I removed the glow maps from the meshes and I use the membrane shader texture as glow. This way I can apply the glow to the active automatons only and when the automaton dies, the membrane shader gets removed slowly, making the glow disappear.
Now the problem I'm having with the membrane shader:
I need a simple way to detect if actor is alive. There is a script to detect if actor is dead, but not if the actor is alive. I'm using all kinds of different states to emulate this. But it's not working in every occasion. I need a 100 % working solution that's simple, just one state in script.
What is the simplest way to determine if actor is alive ?
And the worst problem: when my script works, everything seems fine - automaton glows and if I kill it, the glow disappears slowly.
But - when I hit the automaton with fire or lightning, the glow disappears instantly. (even when the automaton doesn't die)
It does not happen when I hit the automaton with a regular weapon or frost impact. Only when the weapon or spell does fire or shock damage.
How to prevent this ?