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...

Test for DLC


silhouett
 Share

Recommended Posts

I have an example of script below which assembles with no errors but doesn't work :)

 

I am missing something but I want to test if dawnguard is installed.   What do I need to modify to make this work ? 

 

Bool[] Property bDLCIsLoaded Auto ; Element 0 is bDawnguard, etc.
Int[] Property iKnownFormID Auto ; Element 0 is 2048 for Dawnguard's DLC1AurielsBow "Auriel's Bow" [WEAP:02000800], etc.
String[] Property sDLCName Auto ; Element 0 is Dawnguard.ESM, Element 1 is HearthFires.ESM, element 2 is Dragonborn.ESM, etc.
 
Function CheckForDLC()
    Int iIndex = sDLCName.Length
    While iIndex
        iIndex -= 1
        If bDLCIsLoaded[iIndex] != Game.GetFormFromFile(iKnownFormID[iIndex], sDLCName[iIndex])
            bDLCIsLoaded[iIndex] = !bDLCIsLoaded[iIndex]
            If bDLCIsLoaded[iIndex]
                Debug.Trace(sDLCName[iIndex] + " is loaded")
                If iIndex == 0 ; Dawnguard
                    ; Make any changes needed for Dawnguard
                ElseIf iIndex == 1 ; Hearthfire
                    ; Make any changes needed for Hearthfire
                ElseIf iIndex == 2 ; Dragonborn
                    ; Make any changes needed for Dragonborn
                EndIf
            Else
                Debug.Trace(sDLCName[iIndex] + " was loaded, but is no longer")
                If iIndex == 0 ; Dawnguard
                    ; Revert any changes previously made for Dawnguard
                ElseIf iIndex == 1 ; Hearthfire
                    ; Revert any changes previously made for Hearthfire
                ElseIf iIndex == 2 ; Dragonborn
                    ; Revert any changes previously made for Dragonborn
                EndIf
            EndIf
        EndIf
    EndWhile
EndFunction

Link to comment
Share on other sites

I see you are using the Game.GetFormFromFile function to test for existence of DLC or any other mod.

http://www.creationkit.com/GetFormFromFile_-_Game 

 

The example code you are using is actually set up to work with arrays and to test for any number of different mods. What you need to do in your mod is edit the properties and assign values for bDLCIsLoaded, iKnownFormID, and sDLCName.

 

Alternatively, if you only want to check for Dawnguard, you could radically simplify the code code as follows:

Bool Function CheckForDawnguard()
	If Game.GetFormFromFile(2048, "Dawnguard.ESM")
		return true
	EndIf
EndFunction
Edited by jaxonz
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...