Jump to content

Need Help With Scripting A Skeletonizing Mod!


Recommended Posts

Quote

So you can easily put ; in front of some lines of the script to narrow down the problem.

Sheesh; can't believe I forgot that. Thanks!

 

Quote

Now the first important question is: was the event firing 4 times since the begin? because if it was then you would have probably noticed it, but you never mentioned it.

So I disabled all but "the event fired" line with semicolons. When I killed someone and looked at the console, "the event fired" was indeed listed four times. Still not sure why. I tried it with different weapons too; still the same effect.

 

Quote

And second, the timer doesn't work on a function which is executed in a single frame, it can't calculate the time since it leasts 0.02 seconds

Really? I thought the laser glow/disintegration effects last just shy of 2 seconds. At least it seems that way according to the effect shader windows, as well as the vanilla disintegration script. Guess I'm reading it wrong?

 

EDIT: Found the culprit for the multiple event fired line: it was the quest script that I have the skeletonizer scripts attached to. This is how I wrote it:

 

ScriptName OMNYSkellyQuestScript

Begin GameMode

    If GetGameLoaded

    SetJohnnyOnDyingEventHandler 1 OMNYLaserSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYPlasmaSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYCharredSkeletonizerScript 0
    SetJohnnyOnDyingEventHandler 1 OMNYShockSkeletonizerScript 0

    endif

end

I disabled all but the laser script with semicolons, and sure enough, the "the event fired" only showed up once.

 

I'd rather not have all four scripts happen at once; I feel like that might cause problems.

Link to comment
4 hours ago, Omny87 said:

Really? I thought the laser glow/disintegration effects last just shy of 2 seconds. At least it seems that way according to the effect shader windows, as well as the vanilla disintegration script. Guess I'm reading it wrong?

 

 

The effect, not the script. The script leasts 1 frame, so 1 sec / framerate, so it can't count 2 seconds or whatever value you want on a timer. You must use something that leasts some time, i.e. a gamemode on a quest, or a spell, something that allows to count the time you need

Link to comment
3 hours ago, Omny87 said:

No I mean, how would I do that?

Well... you could create your own custom spell (check LaserDisintegrationEffect and LaserDisintegrationFXSpell to copy them), then you will attach your own script (in the same way that LaserDisintegrationEffectScript is attached to it), then inside that script you'll be able to put your timer inside a block that leasts some time (i.e. the ScriptEffectUpdate). Then, inside your event handler, you'll call your new spell with the CIOS command. Hopefully it'll cast the spell on the actor even if he's dead, let's see. Take a look at the duration of the spell (i.e. the laser effect leasts 4 seconds), because that's the max value that the timer will be able to handle.

Link to comment

I actually did go ahead and tried to design my own effect shader to replace the vanilla disintegration effect I was using before. I was messing around with settings all afternoon and I almost got what I wanted, but I can't seem to replicate it again. Should have written it down or something :(

 

I'll try your advice as well; thanks!

Link to comment

Well, after taking a few days to step back I'm back to working on this, and I've looked into your advice- I'm not entirely sure how to implement them though?

 

Like, I made my own Actor/Base effects (OMNYLaserSkellyFXSpell, and OMNYLaserSkellyBaseEffect respectively) and I've connected the two together like the vanilla laser effects, but I can't seem to get them to play with my script?

 

Here's what I got:

 

Actor effect: OMNYLaserSkellyFXSpell (exactly like the LaserDisintegrationFXSpell, but with my custom base effect below)

 

Base Effect: OMNYLaserSkellyBaseEffect (exactly like the LaserDisintegrationEffect, but attached to my laser skeletonizer script)

 

And here's my latest script:

 

scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.PMS LaserCritGlowFXShader
				rActor.CIOS OMNYLaserSkellyFXSpell
				rActor.additem OMNYLaserSkellySuit 1
				Set Timer to 1.8
					If Timer <= 0.5
						rActor.equipitem OMNYLaserSkellySuit 1
					Endif
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

But in-game, all that happens is the laser crit glow and the sizzling noise (which is new and exactly what I wanted, granted), but no disintegration effects, no sparks, and no skeletons!

 

I am so goddamn frustrated by all this I'm on the verge of just giving up.

 

 

 

Link to comment

A timer is something like this:

 

if fTimer < somevalue

   Set fTimer to fTimer +GetSecondsPassed

else

   ; The time has passed, do something

endif

 

A timer must be placed inside a script which executes continuously, so that everytime it executes it will sum GetSecondsPassed, which is the gap from the previous execution.

Link to comment

So I tried adding in a timer like this:

 

scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if Timer < 4
		Set Timer to Timer + GetSecondsPassed
		else 
		set Timer to 0
	Endif


	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.PMS LaserCritGlowFXShader
				rActor.PMS OMNYLaserSkellyEffect
				rActor.additem OMNYLaserSkellySuit 1
					if (GetSecondsPassed <= 2.0) && (rActor.GetDead == 1)
						rActor.equipitem OMNYLaserSkellySuit 1
						rActor.SMS LaserCritGlowFXShader
						rActor.SMS OMNYLaserSkellyEffect
					Endif
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

But it still doesn't change anything.

 

My goal is to make it so that once they get killed via an energy weapon they:

 

1- get covered with the glowing/sparking disintegration effect

2- turn into a skeleton about 1 second later while still glowing

3- have the glowing fade away to reveal the skeleton.

 

Right now they turn into skeletons instantly upon death. I'm trying to use the timer to delay the skeleton effect, to make the disintegration look a bit more "realistic". But thus far all my attempts are fruitless. Here's a video recording I made of what I got so far.

 

Here's what my custom Effect Shader looks like in GECK:

 

image.png.36c1e4a8009d5d9ca6c6b77e2a73d3b6.png

 

Link to comment

Because the logic behind the script is not correct. Here how the game reads it:

- is timer <4? yes it is, so add GetSecondsPassed. It's the first time the script runs, so it probably will be still 0.

- is (all the other conditions to change it in skeleton?) yes, then change it to skeleton.

period.

You're declaring it as Function{rActor}, so I guess it's still the event handler we were talking on the other page of comments. As I said that event handler runs on a single frame, when the enemy dies, so that timer will never increase.

A correct logic would be using the event handler to cast a spell to the enemy, with the CIOS command. That spell will least some time, and in a script attached to the spell you'll put the timer. The only thing to test in this case will be if the spell casted on the dead body, will still execute even if he's dead, I don't remember.

Link to comment
4 hours ago, Omny87 said:

So I should probably have a separate script for the actual "spell" and have this script be the one applying the spell on death?

Exactly. That's what I was meaning here:

Quote

Well... you could create your own custom spell (check LaserDisintegrationEffect and LaserDisintegrationFXSpell to copy them), then you will attach your own script (in the same way that LaserDisintegrationEffectScript is attached to it), then inside that script you'll be able to put your timer inside a block that leasts some time (i.e. the ScriptEffectUpdate). Then, inside your event handler, you'll call your new spell with the CIOS command. Hopefully it'll cast the spell on the actor even if he's dead, let's see. Take a look at the duration of the spell (i.e. the laser effect leasts 4 seconds), because that's the max value that the timer will be able to handle.

but it was explained quite bad, glad we understood. The only thing I don't know is if the spell will actually be casted on a dead actor, I don't remember, it needs to be tested.

Link to comment

Well, two steps forward and one step back.

 

Good news is that I took your advice and made my own spell. Here's the new skeletonizer Object script:

 

scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

Begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.CIOS OMNYLaserSkellyFXSpell
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

 

And here's the disintegration Effect Script

 

scn OMNYLaserSpellFXScript

ref rActor
Float Timer
Short DoOnce


begin ScriptEffectStart
	Print "Laser Time!"
	if getisid nvcrmrhouse == 0
		additem OMNYLaserSkellySuit 1
		PMS LaserCritGlowFXShader 3
		PMS effectLaserDisintegration 2
		Set Timer to 3
		Set DoOnce to 0
	Endif
End

Begin ScriptEffectUpdate
	If DoOnce == 0
		If Timer <= 1
			Print "Skeleton Time!"
			equipitem OMNYLaserSkellySuit 1
			Set DoOnce to 1
		Endif

I tried it in-game and it aaaaalmost works the way I want it. Still trying to work out the timing.

 

But there's one major snag that's popped up recently- it's happened a few times in my previous tests, but now it's happening much more frequently. When I shoot someone and they get skeletonized, seconds later the game will freeze and/or CTD half the time.

 

I thought maybe it was because I had a bunch of other mods running (yeah I know, I realize now that was probably a bad idea to start with), but after deactivating all my mods in Mod Organizer and starting over with a fresh save, now if I shoot someone, the game CTDs as soon as I shoot someone. Re-activating them makes it go back to the 50% freeze-or-crash state.

 

I tried a few things- looked through Mod Organizer to clean up any conflicts, re-arrange files properly, and other stuff. I'll try turning different mods on and off to pinpoint the issue, But I feel like maybe I broke something somewhere and may have to just start over. Wouldn't be a total loss; I have all the resources I need.

 

 

Link to comment
3 hours ago, Omny87 said:

Well, two steps forward and one step back.

 

Good news is that I took your advice and made my own spell. Here's the new skeletonizer Object script:

 


scn OMNYLaserSkeletonizerScript

Float Timer
ref rActor
ref rKiller

Begin Function {rActor}

	Print "The event fired"
	set rKiller to rActor.GetKiller

	if rKiller.IsWeaponInList OMNYListOfLasers
		Print "the killer's weapon is eligible"
			if (rActor.GetIsCreature == 0) && (rActor != PlayerRef)
				Print "the victim is eligible"
				rActor.CIOS OMNYLaserSkellyFXSpell
			EndIf
	endif
	Print "welcome to the bone zone"
		
end

 

And here's the disintegration Effect Script

 


scn OMNYLaserSpellFXScript

ref rActor
Float Timer
Short DoOnce


begin ScriptEffectStart
	Print "Laser Time!"
	if getisid nvcrmrhouse == 0
		additem OMNYLaserSkellySuit 1
		PMS LaserCritGlowFXShader 3
		PMS effectLaserDisintegration 2
		Set Timer to 3
		Set DoOnce to 0
	Endif
End

Begin ScriptEffectUpdate
	If DoOnce == 0
		If Timer <= 1
			Print "Skeleton Time!"
			equipitem OMNYLaserSkellySuit 1
			Set DoOnce to 1
		Endif

I tried it in-game and it aaaaalmost works the way I want it. Still trying to work out the timing.

 

But there's one major snag that's popped up recently- it's happened a few times in my previous tests, but now it's happening much more frequently. When I shoot someone and they get skeletonized, seconds later the game will freeze and/or CTD half the time.

 

I thought maybe it was because I had a bunch of other mods running (yeah I know, I realize now that was probably a bad idea to start with), but after deactivating all my mods in Mod Organizer and starting over with a fresh save, now if I shoot someone, the game CTDs as soon as I shoot someone. Re-activating them makes it go back to the 50% freeze-or-crash state.

 

I tried a few things- looked through Mod Organizer to clean up any conflicts, re-arrange files properly, and other stuff. I'll try turning different mods on and off to pinpoint the issue, But I feel like maybe I broke something somewhere and may have to just start over. Wouldn't be a total loss; I have all the resources I need.

 

 

The second script is incomplete.

Try this as ScritpEffectUpdate block:

 

Begin ScriptEffectUpdate
        If Timer <= 1

            If DoOnce == 0

                Set DoOnce to 1

                Print "Skeleton Time!"
                equipitem OMNYLaserSkellySuit 1

            Endif

        Else

           Set Timer to Timer -GetSecondsPassed
        Endif

End

 

If you had NVAC and then you removed it when you were making your experiments, that COULD explain the random crashes that became persistent

Link to comment

I added your script, and I also got rid of the old scripts that dictate the fire, plasma, and shock effects, since I wasn't using them (I've been focusing on the laser effects right now).

 

It seems to work alright, and the CTDs have stopped, but the game still doesn't seem to like it when I linger on the skeletons? Like, sometimes it'll freeze just before the skeleton appears, or after it appears, the game will freeze if I look at the skeleton for too long. I even tried shooting someone and then quickly looking away- once I looked back at their skeleton, the game froze seconds later. So I think there's still some kind of issue happening between the effect shaders and the skeleton suit being equipped.

 

I might have to look at the skeleton models themselves again- they look a little different from last time (they're missing their neck bones). I might have accidentally saved them over with an older model. So the issue may be that.

 

 

Is there some kind of helpful modder's tool that I can use that can give me a better hint at what the problem is? Some kind of game crash/freeze diagnostic thingy? I'll try looking for one myself but if you know of one please point me towards it.

Link to comment

A model with a problem can cause a ctd, especially if there's a problem with the weighting.

To narrow down if the problem is the model or something happening in the script, my advice is try to put it on another context and see if it causes a similar issue.

For example:

- put a ; in front of the equip line, see if it's really the skeleton that causes the freeze

- if it's not, move the equip line from the spell to your even handler, just right after the additem, so that it will equip instantly, see if the problem comes from equipping seconds later

- try in console to additem to yourself and try to equip it yourself, see if it causes the same issue

Link to comment

I managed to narrow down the problem- the skeleton suit is fine, it was the effects that was causing the issue, specifically the Magic Effect/Base Effect that I had linked to the script. I had "No Duration" unchecked. After checking that, no more freezing!

 

But, OF COURSE, yet another problem arises. Now it seems that the ScriptEffectUpdate block doesn't want to work. The "skeleton time" message doesn't pop up, and they don't equip the skeleton suit.

 

Ugh, it's always something every time! How anyone else has the patience to mod this damn game is beyond me. But still, I will figure this out. Maybe I have to check/uncheck some other tag in the Base Effect or something.

 

scn OMNYLaserSpellFXScript

ref rActor
Float Timer
Short DoOnce


begin ScriptEffectStart
	Print "Laser Time!"
	if getisid nvcrmrhouse == 0
		PMS LaserCritGlowFXShader 3
		PMS effectLaserDisintegration 3
		additem OMNYLaserSkellySuit 1
		Set Timer to 2
		Set DoOnce to 0
	Endif
End

 Begin ScriptEffectUpdate
	If DoOnce == 0
		If Timer <= 1
			Print "Skeleton Time!"
			equipitem OMNYLaserSkellySuit 1
			Set DoOnce to 1
		EndIf
	Else
	Set Timer to Timer -GetSecondsPassed
	Endif


End

EDIT: Okay, I finally figured it out. I had to write the last bit to "Set Time to [Timer - GetSecondsPassed]" and now it works properly!

 

Just needs a bit more polish and I think I can make this work.

 

Actually, now that this hurdle is passed, I do have one more question: would it be possible to have an NPC "freeze" in place for a couple seconds before collapsing into a ragdoll? It's not a dealbreaker for me if it's not possible, but I think it would be funny. Some kind of paralysis spell perhaps?

Link to comment
46 minutes ago, Omny87 said:

I managed to narrow down the problem- the skeleton suit is fine, it was the effects that was causing the issue, specifically the Magic Effect/Base Effect that I had linked to the script. I had "No Duration" unchecked. After checking that, no more freezing!

 

But, OF COURSE, yet another problem arises. Now it seems that the ScriptEffectUpdate block doesn't want to work. The "skeleton time" message doesn't pop up, and they don't equip the skeleton suit.

 

Ugh, it's always something every time! How anyone else has the patience to mod this damn game is beyond me. But still, I will figure this out. Maybe I have to check/uncheck some other tag in the Base Effect or something.

 


scn OMNYLaserSpellFXScript

ref rActor
Float Timer
Short DoOnce


begin ScriptEffectStart
	Print "Laser Time!"
	if getisid nvcrmrhouse == 0
		PMS LaserCritGlowFXShader 3
		PMS effectLaserDisintegration 3
		additem OMNYLaserSkellySuit 1
		Set Timer to 2
		Set DoOnce to 0
	Endif
End

 Begin ScriptEffectUpdate
	If DoOnce == 0
		If Timer <= 1
			Print "Skeleton Time!"
			equipitem OMNYLaserSkellySuit 1
			Set DoOnce to 1
		EndIf
	Else
	Set Timer to Timer -GetSecondsPassed
	Endif


End

 

you copied wrong my last script, you inverted two conditions (the doonce and the timer)

Link to comment

Oh, I copied it right the last time, I was just switching them around to see if that changed anything to try and fix my previous problem. I'll switch it back.

 

EDIT: Okay, switching them back the way you had it makes it not work properly, so I switched them aruond once more.

Link to comment
6 hours ago, Omny87 said:

That's better; though the third-to-last line needed another space and parentheses like so:

 

Set Timer to (Timer - GetSecondsPassed)

 

I noticed that when comparing this script to the vanilla disintegration script.

No it doesn't, for both the things, but nevermind.

Link to comment
  • 1 year later...

Well, the Skeletonizer Mod's been out for a while now. Thanks for all your help!

 

That said, while it's in a good spot, it's still not quite what I have in my original vision of the mod. There's a couple things I want to fix:

 

1: The Bloody Mess perk doesn't play well with this mod. I've successfully made a script that prevents all the energy weapons from dismembering people before skeletonizing them (so you don't have non-skeletal limbs falling off of skeletons), but even with that script, having the Bloody Mess perk causes anyone hit by energy weapons to turn into a floating cloud of gorey bits with a colorful ribcage in the middle before collapsing to the ground, which doesn't look impressive at all. So I'm trying to see if there's a way to disable the Bloody Mess perk's effect on energy weapons.

 

2: This is a minor thing, but when characters get skeletonized, their equipped weapons disappear back into their inventory, and I would much prefer them to still be holding their weapons while skeletonized (it looks funnier). I've tried a few commands; EquipItem, SetWeaponOut, etc. but they either don't work or give me decompiling errors in the console.

 

3: Another minor thing, but I want to try and improve the effect shader to make it really look like their flesh is being burned away to reveal the bones underneath; right now they just sort of "poof" into a skeleton after igniting. It doesn't look bad, but I'd rather have something more visceral. How I plan to do this was to make the skeleton "costume" a piece of armor that an NPC would wear "inside" their body, while the effect shader dissolves them away to reveal the skeleton. Trouble is, when I do that, the skeleton is also effected by the shader, so the whole character ends up vanishing.

Is there a way to set up a mesh so that it isn't effected by effect shaders at all? Perhaps something in NifSkope? I've tried googling guides on NifSkope but they're frustratingly absent.

Link to comment
On 12/8/2021 at 10:57 PM, Omny87 said:

Well, the Skeletonizer Mod's been out for a while now. Thanks for all your help!

 

That said, while it's in a good spot, it's still not quite what I have in my original vision of the mod. There's a couple things I want to fix:

 

1: The Bloody Mess perk doesn't play well with this mod. I've successfully made a script that prevents all the energy weapons from dismembering people before skeletonizing them (so you don't have non-skeletal limbs falling off of skeletons), but even with that script, having the Bloody Mess perk causes anyone hit by energy weapons to turn into a floating cloud of gorey bits with a colorful ribcage in the middle before collapsing to the ground, which doesn't look impressive at all. So I'm trying to see if there's a way to disable the Bloody Mess perk's effect on energy weapons.

 

2: This is a minor thing, but when characters get skeletonized, their equipped weapons disappear back into their inventory, and I would much prefer them to still be holding their weapons while skeletonized (it looks funnier). I've tried a few commands; EquipItem, SetWeaponOut, etc. but they either don't work or give me decompiling errors in the console.

 

3: Another minor thing, but I want to try and improve the effect shader to make it really look like their flesh is being burned away to reveal the bones underneath; right now they just sort of "poof" into a skeleton after igniting. It doesn't look bad, but I'd rather have something more visceral. How I plan to do this was to make the skeleton "costume" a piece of armor that an NPC would wear "inside" their body, while the effect shader dissolves them away to reveal the skeleton. Trouble is, when I do that, the skeleton is also effected by the shader, so the whole character ends up vanishing.

Is there a way to set up a mesh so that it isn't effected by effect shaders at all? Perhaps something in NifSkope? I've tried googling guides on NifSkope but they're frustratingly absent.

 

Hello pal, how are you?

 

I give an idea for 1), what about this... you double click Bloody Mess, in the middle of the window you add 2 conditions, one is GetWeaponType == 4 and one is ==7, with OR flagged. Is it viable?

 

2) seems very tricky. There's one thing I was thinking... long time has passed and I don't remember well but it deserves to be looked maybe: when handling npc there's a normal behaviour, when you equip an armor you also add/remove a simple item like a pen on the next lines of script, to avoid the fact it won't equip the weapon back. It was on the wiki but I can't find it back now. Do you think it could be what makes the npc "lose" the weapon when they wear the skeleton armor?

 

3) if you check on the shaders window you can see a AFFECT SKIN ONLY flag, is it what you looking for? EDIT: no, I think I misunderstood. In this way, the armor over won't dissolve and simply disappears when you wear the skeleton. Unless when you try it in game you see it's a nice effect, I'd say I have no idea, you're probably on the right track thinking about the nif, it can be some flag under the BSShaderPPLightingProperty, like chaging the shader type or adding / removing the shader flags, but it's something I don't know. If there's someone who knows it, it's Wei for sure, the guy who makes all the cool mods with special effects and worked in Frontier too, I would try to send him a PM to ask

Edited by A.J.
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use