Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Are crashing scripts necessarily bad?


Lanceor
 Share

Recommended Posts

Let's say I'm building an ingredient sorter and I want to include the ingredients from Shivering Isles and Vile Lair without creating a dependency on them.

Ref Ingredient

-----

Begin OnLoad


set Ingredient to LairVileSalts

My understanding is that if there is no such EditorID as LairVileSalts, the script will simply crash as soon as it's encountered. Assuming that I don't want the script to run if Vile Lair is not installed, are there any negative consequences in doing this? I'm not intending to use any Gamemode blocks in this way.

Link to comment
Share on other sites

I can't answer your question directly - I'm not sure. I know that scripts that run into errors like this won't recover until the mod is uninstalled. However, you don't need to make your mod dependent on Vile Lair or SI if you don't mind using OBSE.

We had something similar with DBC and were able to accommodate players running Vile Lair with code like the following:


		if (Player.GetEquipped DBBlackHandHood) || (Player.GetEquipped DBBlackHandRobe) || (Player.GetEquipped DBLeatherCuirass) || (Player.GetEquipped DBLeatherHelmet) || (Player.GetEquipped DBCListenersHood) || (Player.GetEquipped DBCListenersRobe)

			let wearingDB := 1

		elseif (IsModLoaded "DLCVileLair.esp")

			let crimsonArmour01 := getFormFromMod "DLCVileLair.esp" "00BE65"

			let crimsonArmour02 := getFormFromMod "DLCVileLair.esp" "00BE66"

			let crimsonArmour03 := getFormFromMod "DLCVileLair.esp" "00BE67"

			let crimsonArmour04 := getFormFromMod "DLCVileLair.esp" "00BE68"

			let crimsonArmour05 := getFormFromMod "DLCVileLair.esp" "00BE6A"

			let crimsonArmour06 := getFormFromMod "DLCVileLair.esp" "00C35E"

			if (Player.GetEquipped crimsonArmour01) || (Player.GetEquipped crimsonArmour02) || (Player.GetEquipped crimsonArmour03) || (Player.GetEquipped crimsonArmour04) || (Player.GetEquipped crimsonArmour05) || (Player.GetEquipped crimsonArmour06)

				let wearingDB := 1

			elseif wearingDB == 1

				let wearingDB := 0	;reset to 0 if player was previously wearing armour

			endif

		elseif wearingDB == 1

			let wearingDB := 0	;reset to 0 if player was previously wearing armour

		endif

IsModLoaded is an OBSE function, as is getFormFromMod.

In terms of SI, I thought there was a vanilla function to test if it existed or not. Although as I look at how SirFrederik handled that for Oblivion XP, it appears he still used an OBSE function to prevent the script from halting.

Link to comment
Share on other sites

Let's say I'm building an ingredient sorter and I want to include the ingredients from Shivering Isles and Vile Lair without creating a dependency on them.

Ref Ingredient

-----

Begin OnLoad


set Ingredient to LairVileSalts

Unless something has changed, you won't be able to get this to compile unless LairVileSalts is a valid ID. Using a fake won't work either because the fake would point to a different form ID.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...