I want to support Dawnguard on my mod, can I do it this way?

Post » Tue Nov 20, 2012 11:05 am

So, I've readied my mod for Dawnguard support. My mod works by reading FormLists and deal with the entries in those FormLists, the scripts are entirely independent from the Forms contained in those FormLists

So I've created a bunch of empty FormLists, which will be populated with Dawnguard Forms.

What I want to do is to make an extension to my mod, which will populate those empty FormLists. The extension will only create entirely new Forms and populate the empty FormLists, nothing more. After that, I'll convert that extension to an .esm for other plugins to depend on.

I was thinking that, this way users can deactivate the Dawnguard support without doing anything else (as the script is independent), and I can update the main mod and the script without having to re-do the whole Dwanguard entries again.
User avatar
N Only WhiTe girl
 
Posts: 3353
Joined: Mon Oct 30, 2006 2:30 pm

Post » Tue Nov 20, 2012 4:04 pm

Here's the guts of how Bag of Holding (albeit currently unreleased version) adds DLC added forms to FLSTs:
Spoiler
Int[] Property iDawnguardArrowArray AutoInt[] Property iKnownFormIDArray AutoFormList Property BagOfHoldingSortArcheryFLST AutoFormList Property BagOfHoldingSortArrowsFLST AutoFormList Property BagOfHoldingSortWeaponsFLST AutoString[] Property sPluginArray AutoFunction CheckForPlugins()	Int iIndex = bPluginArray.Length	While iIndex > 0		iIndex -= 1		If bPluginArray[iIndex] != Game.GetFormFromFile(iKnownFormIDArray[iIndex], sPluginArray[iIndex])			bPluginArray[iIndex] = !bPluginArray[iIndex]			If bPluginArray[iIndex]				Debug.Trace(sPluginArray[iIndex] + " is loaded.")				ElseIf iIndex == 0 ; Dawnguard.ESM					AddArrayToFormLists("Dawnguard.ESM", iDawnguardArrowArray, BagOfHoldingSortArrowsFLST, BagOfHoldingSortArcheryFLST, BagOfHoldingSortWeaponsFLST)				ElseIf iIndex == 1 ; Hearthfire.ESM				ElseIf iIndex == 2 ; Dragonborn.ESM				EndIf			Else				Debug.Trace(sPluginArray[iIndex] +  " was loaded, but is no longer.")				If iIndex == 0 ; Dawnguard.ESM				ElseIf iIndex == 1 ; Hearthfire.ESM				ElseIf iIndex == 2 ; Dragonborn.ESM				EndIf			EndIf		EndIf	EndWhileEndFunctionFunction AddArrayToFormLists(String asFileName, Int[] aiArray, FormList akPrimaryFLST, FormList akSecondaryFLST = None, FormList akTertiaryFLST = None) Global ; Import FormID Array elements to FormList(s)	Int iIndex = aiArray.Length	While iIndex > 0		iIndex -= 1		Form kForm = Game.GetFormFromFile(aiArray[iIndex], asFileName)		akPrimaryFLST.AddForm(kForm)		If akTertiaryFLST			akSecondaryFLST.AddForm(kForm)			akTertiaryFLST.AddForm(kForm)		ElseIf akSecondaryFLST			akSecondaryFLST.AddForm(kForm)		EndIf	EndWhileEndFunction
See also, http://www.creationkit.com/Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded (since you'll need to check for plugins on save load) and http://www.creationkit.com/Arrays_(Papyrus)#Creating_a_FormID_Array (since it's imperative for addition of DLC forms w/o requiring the DLC as a master).

If a plugin is deactivated, its forms will cease to exist and should be automatically purged from the FLST(s).
User avatar
Rachyroo
 
Posts: 3415
Joined: Tue Jun 20, 2006 11:23 pm

Post » Tue Nov 20, 2012 9:52 am

Let's put it this way:
Say that I have ExhibitA.esm, which has 2 empty FormLists

Then I have ExhibitB.esm, which populates those FormLists with its own entries.

If I deactivate ExhibitB.esm but still activate ExhibitA, will those FormLists be considered empty by the game?

I'm not going to just add Dawnguard items, but also create new items. They'll only be ARMA, ARMO, and COBJ entries. I'll add ARMO entries of both Dawnguards's and mine to the FormLists.

That's what the extension should do.

I'm saying this because using a script that checks for plugins seem to be redundant, and the script itself is independent.

Basically, this is what my script looks like: (pseudo-code, I don't remember the function calls off the top of my head)

FormList ListSkyrim AutoFormList ListDawnguard AutoAddInventoryEventFilter(ListSkyrim)AddInventoryEventFilter(ListDawnguard)OnAddedItem(Form A) If(A)IsInList(ListSkyrim) DoThis(A,ListSkyrim) Else If(A)IsInList(ListDawnguard) DoThis(A,ListDawnguard) EndIfEndOnAddedItem

The "DoThis" function is an independent function that accepts input and do things based on that. It's a bit hard for me to show you the script (I'm on mobile). Either way, the point is that the script doesn't need to know whether Dawnguard is installed or not, currently the script already has the empty FormLists (which won't do anything). The goal is to simply populate those empty FormLists with a new plugin data.
User avatar
Dina Boudreau
 
Posts: 3410
Joined: Thu Jan 04, 2007 10:59 pm

Post » Tue Nov 20, 2012 5:53 am

Let's put it this way:
Say that I have ExhibitA.esm, which has 2 empty FormLists

Then I have ExhibitB.esm, which populates those FormLists with its own entries.

If I deactivate ExhibitB.esm but still activate ExhibitA, will those FormLists be considered empty by the game?
They'll still be filled unless the plugin which defines the added forms is removed. If the forms are from ExhibitB and ExhibitB is deactivated, the forms no longer exist and will be purged from the FLST(s). You probably don't need a separate plugin to do this as master dependency can be sidestepped with http://www.creationkit.com/GetFormFromFile_-_Game, in which case you can define the forms in ExhibitA unless they directly reference forms in the DLC.
User avatar
Sweets Sweets
 
Posts: 3339
Joined: Tue Jun 13, 2006 3:26 am

Post » Tue Nov 20, 2012 2:22 pm

They'll still be filled unless the plugin which defines the added forms is removed. If the forms are from ExhibitB and ExhibitB is deactivated, the forms no longer exist and will be purged from the FLST(s). You probably don't need a separate plugin to do this as master dependency can be sidestepped with http://www.creationkit.com/GetFormFromFile_-_Game, in which case you can define the forms in ExhibitA unless they directly reference forms in the DLC.

Yes, the forms will be entirely from ExhibitB.I need to directly refer to items from Dawnguard.esm, because I'm going to duplicate them (that is, change the FormID and create a new form)
User avatar
kat no x
 
Posts: 3247
Joined: Mon Apr 16, 2007 5:39 pm


Return to V - Skyrim