Jump to content

NPC Outfit Effect Script Crash


Halstrom

Recommended Posts

Here's a doozey for you scripters, what I'm doing is having an object effect on an outfit run the following script which adds a scripted token to handle the outfit swapping so it can update the health of the old item to the new item when the new item has been equipped. This script & system run flawlessly on the player but if a NPC wears the outfit as soon as it adds the object to the NPC's inventory it crashes my video card (Nvidia9700) and I have to reboot the computer, I swapped my token to a NVGolfBall to prove it wasn't my token script, I tried using a Misc token instead of a Armor token and got the same crash, it appears that an NPC object effect script can't add anything to a NPC. I've tried this different clean saved games on Kirina, Cass & Veronica with the same results, Vault suits & Combat Armor in 4 hours of fun filled Crash/Rebooting. I'll post it up in the latest update of SCR now too 0413.1, outfits are in SCR test box.

 

Unless someone can spot something stupid I'm doing I'm going to have to try adding another effect with an effect script instead and see if that works or use a quest script with some sort of ref/outfit mailbox system and queuing ability.

 

 

 

scn SexoutSCRS6EFFSwapArmorCombatCrashTest

ref rZActor
ref rCurrOutfit
ref rPrevOutfit
int iCurrOutfitHealth
int iCurrBellySize
int iCurrBreastSize
ref rCurrBodyType
int iPrevOutfitHealth
int iPrevBellySize
int iPrevBreastSize
ref rPrevBodyType
ref rNewUpperBody
int iSwap

int iCount
int iOkToRun
int iDeadCount
int iRemoving
ref rSwapToken
ref rOutfitList

Begin ScriptEffectUpdate

Set rZActor to GetSelf
Set rSwapToken to SexoutS6TokenSwapArmorCombat
Set rOutfitList to SexoutSLOutfitArmorCombatGroup

Set iCount to iCount + 1
if rZActor && iCount > 29 && SexoutSQVAR.iSCRStartCounter > 11
	Set iCount to 0

	Set iOkToRun to 0
	if rZActor.GetIsSex Female || rZActor.GetIsSex Male
		if rZActor.GetDead
			Set iOkToRun to 0
			Set iDeadCount to iDeadCount +1
			if iDeadCount > 19
				Set iOkToRun to -1
			endif
		else
			Set iOkToRun to 1
			Set iDeadCount to 0
		endif
	endif
	if rZActor == PlayerREF
		if rZActor.GetItemCount 00SexoutActor > 0 || rZActor.GetItemCount SexoutSP4TokenBirthAnimationF > 0
			Set iOkToRun to 0
		endif
	endif
	Set rCurrOutfit to rZActor.GetEquippedObject 2
	if rCurrOutfit && iOKToRun
		Set iCurrOutfitHealth to rZActor.GetEquippedCurrentHealth 2
		Set iCurrBellySize to rZActor.GetItemCount SexoutSPTokenBellySize
		Set iCurrBreastSize to rZActor.GetItemCount SexoutSPTokenBreastSize
		if rZActor.GetIsSex Female && iCurrBreastSize < 1
			Set iCurrBreastSize to 3
		endif
		Set rCurrBodyType to SexoutS9TokenBodyT3Cali
		if rZActor.GetItemCount SexoutS9TokenBodyBNB
			Set rCurrBodyType to SexoutS9TokenBodyBNB
		elseif rZActor.GetItemCount SexoutS9TokenBodyT3M
			Set rCurrBodyType to SexoutS9TokenBodyT3M
		endif


			Set iSwap to 0
			if rCurrOutfit != rPrevOutfit
				DebugPrint "SCRS6SwapEff %n : Outfit %n to %n" rZActor rPrevOutfit rCurrOutfit
				Set iSwap to 1
			elseif iCurrOutfitHealth != iPrevOutfitHealth
				DebugPrint "SCRS6SwapEff %n : %n Health %4.0f, %4.0f" rZActor rCurrOutfit iPrevOutfitHealth iCurrOutfitHealth	
				Set iSwap to 1
			elseif iCurrBellySize != iPrevBellySize
				DebugPrint "SCRS6SwapEff %n : %n Belly %2.0f, %2.0f" rZActor rCurrOutfit iPrevBellySize iCurrBellySize
				Set iSwap to 1
			elseif iCurrBreastSize != iPrevBreastSize
				DebugPrint "SCRS6SwapEff %n : %n Breast %2.0f, %2.0f" rZActor rCurrOutfit iPrevBreastSize iCurrBreastSize
				Set iSwap to 1
			elseif rCurrBodyType != rPrevBodyType
				DebugPrint "SCRS6SwapEff %n : %n BodyType %n, %n" rZActor rCurrOutfit rPrevBodyType rCurrBodyType
				Set iSwap to 1
			endif

			if iSwap && rZActor.GetItemCount rSwapToken < 1
				rZActor.AddItem NVFakeGolfBall 1 1
				DebugPrint "SCRS6SwapEff %n : %n added" rZActor rSwapToken
			endif

		Set rPrevOutfit to rCurrOutfit
		Set iPrevOutfitHealth to iCurrOutfitHealth
		Set iPrevBellySize to iCurrBellySize
		Set iPrevBreastSize to iCurrBreastSize
		Set rPrevBodyType to rCurrBodyType
	endif ; *** End CurrOutfit & OkToRun

endif

End

 

 

 

 

Link to comment

I never really liked object effect scripts ;)

 

I'm not sure how rCurrOutfit != rPrevOutfit can ever be anything but true. Doesn't an enchantment only apply while the armor's worn? Even if it's replaced with another that has the same enchantment, it's probably not the exact same script running. Or am I assuming too much?

Link to comment

I never really liked object effect scripts ;)

 

I'm not sure how rCurrOutfit != rPrevOutfit can ever be anything but true.

Well, hmm you're got me thinking there, it seems to work as intended it only occurs on the first run so does a check then that the outfit that has just been put on is the correct variation of damage or Pregnancy etc, I could have used an iDoOnce instead I guess.

 

Doesn't an enchantment only apply while the armor's worn? Even if it's replaced with another that has the same enchantment, it's probably not the exact same script running. Or am I assuming too much?

Hopefully you're right, it seems to end pretty immediately as soon as the outfit is removed, I'm not sure but I think I had to leave the outfit off for a few seconds occasionally rather than immediately swap between 2 variations or I think it remembered the previous outfit, I have to do more testing to confirm. I've had enough of skinning this octopus today. Time to watch some TV for a bit.

Link to comment

The good news is I seemed to have got around the issue by just having the object effect add a Spell Effect instead of Scripted Token got to make up some more spells for the other outfits yet but I'll update the combat armor for now and catch the resst later tonight or tomorrow. As the script is only run for the swapping process it should have minimal impact if it is removed during saves/fast travel etc.

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • 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