Jump to content

Need Help With Scripting a Mod I'm Making


Omny

Recommended Posts

"Trying to implement something new + GECK = frustration" is pretty much the definition of "Vault-Tec experiment", which is the widely held view of the GECK itself. (A circular definition if there ever was one.)

 

Based only upon your descriptions so far, I suggested using an IMOD because it appears the problem is one of "timing" of the displayed effects:

Right after the effect shaders do their thing and the skeleton ragdolls on the ground, the body suddenly becomes transparent like this for about 1 second, and then snaps back to being opaque.

 

My thought was that you just needed to hide the transition where the body becomes "transparent" for a second with an IMOD. That only needs to fog the player/camera view of the skeleton during that transition, and is pretty much what the IMOD effects do. How important is it REALLY that the camera can see the area surrounding the skeleton while the transition occurs?

 

Otherwise I can only suggest you might look into how 'EVE - Essential Visual Enhancements' handles such. (I'm not a modeller nor a "beam weapon user", but thought much was implemented in the "projectile" effect.) Heed the "NOTE: If an object has multiple effects, only the visual effects for the most expensive effect is played. Since all effects have a cost of 0, the first effect defined in the object will be used." You may need to delay some effects by a frame so they can take effect separately.

 

-Dubious-

Link to comment
Share on other sites

I tried looking into the Imagespace Modifiers to see how they work, testing them in the Render Window and seeing which ones are closest to what I'm trying to go for, but thus far if I try to open more than about three or four of them, the window opens up blank and I can't press any buttons anymore, and I have to use Task Manager to close the GECK. So until I can fix that problem it's pretty much useless to me. I haven't found anything that really look like what I'm going for anyway; there doesn't seem to be any modifiers that only overlay NPCs, they just apply an effect across the entire camera view like blurring and recoloring. Unless there's one I missed? Something like how the VATS system can highlight bodies?

 

Ultimately, my goal is to make it so that once an NPC gets 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 them equipping the skeleton suit, 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:

 

OKqDiaq.png

 

 

And here's what my script looks like thus far:

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"
				Set Timer to 4
				rActor.PMS LaserCritGlowFXShader 2
				rActor.PMS OMNYLaserSkellyEffect 1
				rActor.additem OMNYLaserSkellySuit 1
					if (GetSecondsPassed <= 2) && (rActor.GetDead == 1)
						rActor.equipitem OMNYLaserSkellySuit 1
					Endif
			EndIf
	endif
	Print "welcome to the bone zone"
		
end
Link to comment
Share on other sites

I can see why you "can almost taste it". It looks pretty good to me.

What I am having trouble with is figuring out which of your three "goals" is having the problem. Nrs 1 & 2 seem to be there, but 3 isn't "fading away"; it just "shuts off", correct? On that basis, it implies to me that "equipping" the "OMNYLaserSkellySuit" item is "cutting off" the "OMNYLaserSkellyEffect" effect. (Might need to pin down exactly what line of code is causing that.)

I'm not experienced with creating Shader Effects but notice that there are "Fade In/Out" timers. If it is correct that "equipping the suit" is cutting off the fade out effect, perhaps you need a version of the suit that "applies" the glowing effect to the suit when it is equipped and fades out (the reverse of what is happening now). So you have the existing 'OMNYLaserSkeletonizerScript" with an additional line of "rActor.PMS OMNYLaserSkellyEffect_2" following the "equipitem" line which does the "fade out" effect.

 

Another possibility is that you are attempting to do too many things in this "single frame" function. You might need to set some flag variables and split parts out into the quest.

-Dubious-

Edited by dubiousintent
Link to comment
Share on other sites

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 Timer <= 1
            If DoOnce == 0
                Print "Skeleton Time!"
                equipitem OMNYLaserSkellySuit 1
                Set DoOnce to 1
            Endif
        Else
           Set Timer to Timer -GetSecondsPassed
        Endif

End 

I tried it in-game and it aaaaalmost works the way I want it. Still trying to work out the timing. It used to have a "SMS" function for the effects but I found that was the cause of the weird transparency flicker.

 

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.

 

EDIT: Fixed the problem; edited the effect script above to reflect the current version.

 

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, which were part of the head/armor addon). 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.

Edited by Omny
Link to comment
Share on other sites

Alright, I managed to narrow down the problem- the skeleton suit is fine (I fixed the skeleton head), 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?

Edited by Omny
Link to comment
Share on other sites

 

Check out the "Paralysis" base effect ("actor value" under "Miscellaneous" of the "Stats List" page).

 

Well I tried a couple things: adding a paralysis effect to the actor effect like so:

 

pQQaJOb.png

 

and adding the paralysis base effect to the script like so:

scn OMNYLaserSpellFXScript

ref rActor
Float Timer
Short DoOnce


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

Begin ScriptEffectUpdate
	If DoOnce == 0
		If Timer <= 2.5
			Print "Skeleton Time!"
			equipitem OMNYLaserSkellySuit 1
			Set DoOnce to 1
		Else
			Set Timer to (Timer - GetSecondsPassed)
	Endif
		If Timer <= 0
			setav paralysis 0
		Endif
	Endif
End

But unfortunately the paralysis doesn't occur. I even tried using console commands to paralyze someone and then shooting them with a laser, but the paralysis stops once they die. Seems it only works when they're alive.

 

 

 

 

Either way, this illustration I made is basically my ultimate end goal (excuse how crude it looks, I swear I'm a better artist than this):

sWwzAfx.jpg

 

 

EDIT: I found another mod on the nexus, the Groovitron, which among other things allows you to freeze NPCs in place. I'll contact the mod owner and see if I can get insight on their scripting.

Edited by Omny
Link to comment
Share on other sites

  • 8 months later...

Well, the mod has been launched on the Nexus and thus far has been working well. It's currently pretty close to my own vision of the final product.

 

Right now there are a couple snags I want to try and overcome:

 

1: I found that if I use the "DismemberLimb" function, I can make their skeletons fall apart shortly after skeletonization, which looks pretty cool, but it also still makes blood sprays/puddles, which doesn't look right (especially if you use EVE's more violent and dramatic-looking blood spray effects). I've been trying to find a way to stop these gore effects, but as far as I can tell the blood spray is encoded in the BodyPartData of the NPCs themselves, and unless I disable gore effects entirely in the game, they'll still show up. Is there a way to edit the BodyPartData via scripts? the GECK wiki doesn't seem to have the answers as far as I can tell. If I can't fix it, it's not a big deal; this is just a minor aesthetic thing (plus it seems to crash the game if it happens too many times at once).

 

2: Currently when someone gets skeletonized (I.E. equips their skeleton suit) they un-equip their current weapon, storing it back in their inventory. I'd much rather have them keep their weapon in hand. I've tried a few things, with my latest attempt being creating a reference called "rWeapon" on the top of the Effect Script, setting "rWeapon" to the target's equipped weapon, and having them re-equip it right after equipping the skeleton suit. Here's what I got:

scn OMNYLaserSpellFXScript

Float Timer
Short DoOnce
float fFloat
ref rWeapon

begin ScriptEffectStart

	set rWeapon to GetEquippedItemRef 5

	if getisid nvcrmrhouse == 0
		additem OMNYLaserSkellySuit 1
		PMS OMNYLaserSkellyGlow 
		PMS OMNYLaserSkellyMelt 
		Set Timer to 2
		Set DoOnce to 0
	Endif
	set fFloat to Rand -2.2, -1.2

End


Begin ScriptEffectUpdate
	SetVelEx 0 0 .5
	Set Timer to Timer - GetSecondsPassed
	If DoOnce == 0
		If Timer <= 1.5
			equipitem OMNYLaserSkellySuit 1
			equipitem rWeapon 1
			Set DoOnce to 1
			Endif
	Endif
	If Timer <= 0.5
		SMS OMNYLaserSkellyMelt
		SMS OMNYLaserSkellyGlow
		Set DoOnce to 1
	endif
	if Timer <= fFloat
		dispel OMNYLaserSkellyFXSpell
	endif

End

Unfortunately, it doesn't seem to work- nothing dramatic happens in-game, but in the console, a block of text pops up that reads:

Error in script 5203f7f3 (OMNYLaserSpellFXScript) in mod OMNYSkeletonizer02.esp
Failed to execute function 'EquipItem' on line 9 of script 'OMNYLaserSpellFXScript' (5203f7f3).
Decompiled Line: EquipItem rWeapon 1

I tried using "EquipItem2" and "EquipItemAlt", and neither seems to work, though they also don't produce error messages.

Link to comment
Share on other sites

  • 3 months later...

Update: well, I found out how to get around the Bloody Mess perk, and I've also made a small breakthrough in fixing the "disappearing weapons" problem!

 

So, in the script, NPCs are given a skeleton suit via "AddItem", but the actual act of doing that makes them automatically un-equip their weapon (I noticed that their weapons vanish as soon as they die, before they skeletonize). However, I found that if I disable the "AddItem" part of the script, open up the game, add the skeleton suit to their inventory manually via console, and then killed them via lasers, their skeleton would be holding the weapon as I wanted. So that's a step in the right direction!

 

So it seems to me like the solution here is to give all the NPCs the skeleton suits from the get-go- I'll probably have to make a script/edit one of my current scripts to add a leveled list of the skelly suits to the NPCs, or something along those lines. If there's a simpler solution, let me know!

Link to comment
Share on other sites

Update Again: Okay, it seems I managed to fix that disappearing weapon bug! I went into the Object Script and added a line with the "AddItemAlt" command, like so:

    if rKiller.IsWeaponInList OMNYListOfLasers
            if rActor.GetIsCreature == 0
                rActor.AddItemAlt OMNYLaserSkellySuit 1
                rActor.CIOS OMNYLaserSkellyFXSpell
            EndIf

Man, that solution is a hell of a lot simpler than what I was trying before. I was actually considering just shoving the skelly suits into literally every NPC's inventory. But this is a much more elegant solution!

 

There's just one last bug that's been plaguing this mod of mine: the "IsWeaponInList" command. Because of this mod, the skeletonizing effect only works properly when the player is holding the appropriate weapon. In normal combat when shooting at someone with a plasma rifle this is fine, but when it comes to mines or grenades, it's a different story: if you throw a frag grenade and then switch to holding a plasma rifle before the grenade explodes, the target will be turned into a green skeleton. Likewise if you were to throw down a plasma mine and are holding a shotgun while an enemy walks over it, they won't be turned into a green skeleton and will simply explode as normal.

 

So what I need to do is to re-write this script so that it detects what weapon they've been killed with, rather than what weapon their killer is holding at the time. Trouble is, there doesn't seem to be a convenient way of doing that. I've found GetCauseOfDeath, but the name is frustratingly deceptive- it can only determine if someone was killed via one of 8 broad categories. IsKillerObject seems to only refer to when someone gets killed by an object like a trap or something (the GECK wiki doesn't seem to know for sure, which is also annoying).

Edited by Omny
Link to comment
Share on other sites

  • Recently Browsing   0 members

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