Halstrom Posted March 5, 2012 Posted March 5, 2012 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?
prideslayer Posted March 5, 2012 Posted March 5, 2012 It's the lower 24 bits (last 6 hex digits) of the NPC, but in decimal. You'll need to look up the NPCs ID in the GECK, ignore the first two digits, and convert the rest from hex to decimal.
astymma Posted March 5, 2012 Posted March 5, 2012 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.
prideslayer Posted March 5, 2012 Posted March 5, 2012 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.
Halstrom Posted March 5, 2012 Author Posted March 5, 2012 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
Recommended Posts
Archived
This topic is now archived and is closed to further replies.