Jump to content

Scripting Questions


Recommended Posts

Ok here it is the Scripting Questions thread.

Lets keep this to Simple quick Q&A not something that's likely to end up with 5 pages answers if possible. Some things ar ebig enough to deserve their own thread like if you are likely to want a lot of help on a mod you are making.

 

I'll start:

 

I've got got this code in my main script to enable it to add Kirina to Pregnancy if the user has Kirina loaded, as soon as I activate it it stops the script from running at all. It reqires NVSE of course too.

 

	if (0 == rZKirina) || (0 == GetGameRestarted)
	if (IsModLoaded "GIP_Kirina.esm")
		Set rZKirinaMod to GetModIndex "GIP_Kirina.esm"
		Set rZKirina to BuildRef rZKirinaMod 2781 ; Load Companion Kirina
	endif
endif

 

All the variable names have been defined it compiles and saves fine, I'm guessing the 2781 is supposed to point to Kirina the NPC's reference but suspect it is the wrong number as I copied this from a version to do Willow, but it did the same thing too. Is this the Hex number of the NPC concerned?

Link to comment

Ok here it is the Scripting Questions thread.

Lets keep this to Simple quick Q&A not something that's likely to end up with 5 pages answers if possible. Some things ar ebig enough to deserve their own thread like if you are likely to want a lot of help on a mod you are making.

 

I'll start:

 

I've got got this code in my main script to enable it to add Kirina to Pregnancy if the user has Kirina loaded' date=' as soon as I activate it it stops the script from running at all. It reqires NVSE of course too.

 

	if (0 == rZKirina) || (0 == GetGameRestarted)
	if (IsModLoaded "GIP_Kirina.esm")
		Set rZKirinaMod to GetModIndex "GIP_Kirina.esm"
		Set rZKirina to BuildRef rZKirinaMod 2781 ; Load Companion Kirina
	endif
endif

 

All the variable names have been defined it compiles and saves fine, I'm guessing the 2781 is supposed to point to Kirina the NPC's reference but suspect it is the wrong number as I copied this from a version to do Willow, but it did the same thing too. Is this the Hex number of the NPC concerned?

[/quote']

 

No, it actually works for Kirina as well. It seems that one was copied from the other, they are both xx000ADD which is dec 2781. You probably should be checking for 1 == GetGameRestarted though.

Link to comment

 

No' date=' it actually works for Kirina as well. It seems that one was copied from the other, they are both xx000ADD which is dec 2781.

[/quote']

 

Woah, imagine that.

 

You probably should be checking for 1 == GetGameRestarted though.

 

I didn't notice that but while on the subject..

 

It really should just be this:

if (GetGameLoaded || GetGameRestarted)
 if (IsModLoaded "GIP_Kirina.esm")
   Set rZKirinaMod to GetModIndex "GIP_Kirina.esm"
   Set rZKirina to BuildRef rZKirinaMod 2781 ; Load Companion Kirina
 else
   set rZKirina to 0
 endif
endif

 

To cover for the ref being set, and then the mod being disabled or it's position in the load order changed -- both would make it invalid.

Link to comment
I didn't notice that but while on the subject..

 

To cover for the ref being set' date=' and then the mod being disabled or it's position in the load order changed -- both would make it invalid.

[/quote']

Yep, it ended up being the first line crashing the script, maybe the first added NPC in any mod gets that number too :)

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