Referencing another esp in a script

Post » Fri Jun 22, 2012 5:38 am

Is it possible ? Like add an if conditionso to ask likeis this esp mod loaded ? If so then ... Etc
User avatar
Logan Greenwood
 
Posts: 3416
Joined: Mon Jul 30, 2007 5:41 pm

Post » Thu Jun 21, 2012 6:04 pm

You cant reference it directly, but you can the script check for a variable that the other esp contains, IIRC.
User avatar
Jonny
 
Posts: 3508
Joined: Wed Jul 18, 2007 9:04 am

Post » Fri Jun 22, 2012 3:23 am

I am not sure about this in Skyrim, but in Oblivion I am under the impression that the following would apply:

Normally esp's don't know much about each other, but one can try to convey info through a change in an esm, that is master to both esp's.

You can try different ways of doing that: For example, have esp1 modify something in the esm, and test for that modification in esp2 (without modifying the reference again), and you probably need to touch a persistent reference for that. If esp1 needs to, or can adjust an existing global variable, that could provide a simple way to do it, along the lines that Echonite suggested above, assuming of course, that no other mod would ever be likely to touch the same variable. If you use an esm of your own, and the issue only involves you own esp's on top of that esm, this should be really straightforward by setting up in the esm a new global variable specifically for the purpose.

It may also be possible to inject a new reference or variable into the esm for the same purpose. Injection means using a modified ID for the item so, that the first two digits identify it with the master (like 00.. for Skyrim.esm) and not the originating esp (and the injected ID should naturally differ from any ID actually used by the esm), but I don't know how easy that is to do with the current Skyrim modding tools. That injected item could then conceivably be used to convey information from one esp to another.
User avatar
Auguste Bartholdi
 
Posts: 3521
Joined: Tue Jun 13, 2006 11:20 am

Post » Thu Jun 21, 2012 2:12 pm

v1.6 adds the capacity to do this via http://www.creationkit.com/GetFormFromFile_-_Game. Say Bag of Holding.esp, for instance, adds a global, fBagOfHoldingVersionGLOB [GLOB:0104B409]. You can check not only the existence of it, but make one of your properties or variables point to it and get its value, albeit you'd want to check for its existence OnPlayerLoadGame style. The below will tell you if Bag of Holding.esp is loaded or not and its version if applicable.

ScriptName YourModPlayerAliasScript extends ReferenceAliasGlobalVariable Property fBagVersionGLOB Auto	Event OnPlayerLoadGame()	fBagVersionGLOB = Game.GetFormFromFile(0x0004B409, "Bag of Holding.esp") As GlobalVariable ; Remember to cast	If fBagVersionGLOB		Debug.Notification("Bag of Holding.esp version " + fBagVersionGLOB.GetValue() + " is loaded.")	Else		Debug.Notification("Bag of Holding.esp is not loaded.")	EndIfEndEvent

Pretty f'n cool stuff if you ask me. This really tears down the wall.

Note: http://www.creationkit.com/OnPlayerLoadGame_-_Actor will not fire the first time a save is loaded, but every consecutive time. To get around that, you could set something up like 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.
User avatar
N3T4
 
Posts: 3428
Joined: Wed Aug 08, 2007 8:36 pm

Post » Thu Jun 21, 2012 7:16 pm

It would be cool to see some of the larger mods have little secrets in them like how the Gameboy Color Zelda games had a hidden shop if you played them in a Gameboy Advance.
User avatar
Rodney C
 
Posts: 3520
Joined: Sat Aug 18, 2007 12:54 am


Return to V - Skyrim