Supporting other mods via form lists or scripts, is this pos

Post » Sat Nov 17, 2012 9:11 am

Hi Guys,

I made a small mod called 'lightning during thunder storms' to provide the missing lightning strikes.

My mod uses a form list to store all the weathers that I decide are bad enough to justify lightning.

Spoiler

- SkyrimStormRainTU = 10a241
- SkyrimStormRainFF = 10a23c
- SkyrimStormRain = C8220
- SkyrimOvercastRainVT = 10A746
- FXMagicStormRain = D4886

This works great for a vanilla Skyrim, but we all love mods and especially weather mods.

My problem is now I want to use a weather mod such as RLWC or COT etc, these mods introduce new weather forms that my lightning mod doesn't detect as being 'bad enough for lightning'.

Is there anyway for other rmods to be able to add weathers into my mods bad weather form list?

If I include the references in my own mods form list, would they be considered NONE if the other mod was not installed? or would it be CTD!? and a dependency now introduced!

Are there any posts on mod 2 mod communication, especially scripted?

Thanks Guys, really appreciate any help.
User avatar
Carolyne Bolt
 
Posts: 3401
Joined: Mon Jul 10, 2006 4:56 am

Post » Fri Nov 16, 2012 11:55 pm

Yes. http://www.creationkit.com/GetFormFromFile_-_Game can be used to check for the presence/absence of other plugins 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 and, with a http://www.creationkit.com/Arrays_(Papyrus)#Creating_a_FormID_Array, you can add WTHR forms to your FLSTs on-the-fly w/o any master dependencies and it'll work regardless of load order. In a plugin's absence, your FLST will purge any missing forms as they'll not retain 'None'.

This sort of "patching", I doubt, would be frowned upon given it's merely additive and ensures your mod works seamlessly with another's.
User avatar
naome duncan
 
Posts: 3459
Joined: Tue Feb 06, 2007 12:36 am

Post » Sat Nov 17, 2012 2:20 pm

Many Thanks JustinOther,

Great advice on the GetFormFromFile (hadn't noticed that being added in the 1.6 update) this would make my mod 1.6 dependant but that is not a problem.I would rather have a dependency on SkyRim versions over having mod dependencies.

Is the FLST treated as a form as well? I think It would be nicer for the other mods to manage the Weathers (e.g. if they ever add more weathers and which weathers justify lightning) so it makes more sense for the mods requiring support to obtain my FLST as you mention and add in any Weathers they want to have lightning in.

Does that sound like it should work?

I will test it out myself but if you know of the top of your head it might save me some time.

Again many thanks for your assistance.
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Sat Nov 17, 2012 2:44 pm

Opps, reading the linked material before posted would have been good!

The example you linked to shows exactly that:-


; Obtain form 0000ABCD we expect to be added by the KillerBees plugin
; Note the top most byte in the given ID is unused so 0000ABCD works as well as 0400ABCD
FormList beekillerlist = Game.GetFormFromFile(0x0000ABCD, "KillerBees.esp") As FormList
; If "KillerBees.esp" is not loaded the form will be NONE. Otherwise, add our weapon to the list.
if ( beekillerlist )
beekillerlist.AddForm( WeapBeeSlayer )
endif
User avatar
Da Missz
 
Posts: 3438
Joined: Fri Mar 30, 2007 4:42 pm

Post » Sat Nov 17, 2012 12:35 am

OK, got this working just fine and just thought I would update here in case anyone needs to do something similar.

I basically did this:-
One Quest - which adds the bad weathers into the formlist of ones I check for.
One formlist - Containing all the bad weathers we want included.
One Alias - to register for game load events.
Two scripts:-
COTMintyQuestScript - attached to the quest, property filled by the formlist.
COTMintyAliasScript - attached to the alias, property filled by the PlayerRef.

Even the scripts are tiny compared to what I am used to:-

COTMintyQuestScript
Spoiler
Scriptname COTMintyQuestScript extends Quest  {Script to add more weather types to the list of bad weathers within Minty Lightning Mod}FormList Property COTBadWeathers Auto ; fill this with your own bad weathers from COTEvent OnInit()		AddBadWeathers()		EndEventFunction AddBadWeathers()		FormList MintyBadWeathers = Game.GetFormFromFile(0x0101D776, "MintyLightningMod.esp") As FormList		if (MintyBadWeathers) ; Only run if Minty Lightning Mod is installed				int index = COTBadWeathers.GetSize()				While(index > 0)						index -= 1						Weather COTWeather = COTBadWeathers.GetAt(index) as Weather						MintyBadWeathers.AddForm(COTWeather)									EndWhile				Debug.MessageBox("Climates Of Tamriel Support Added to Minty Lightning Mod")		endifEndFunction

COTMintyAliasScript
Spoiler
Scriptname COTMintyAliasScript extends ReferenceAlias  {OnPlayerLoadGame will not fire from a Quest script, so attach this to the PlayerRef}COTMintyQuestScript Property COTMintyQuest AutoEvent OnPlayerLoadGame()		COTMintyQuest.AddBadWeathers()EndEvent

Again, many thanks to JustinOther for the tip.

My mod now has a standalone compatibility patch to support the "Project Reality - Climates Of Tamriel - Weather" mod which is a pretty cool mod. Everybody happy and I can get back to trying to make fireworks ;o)
User avatar
Paul Rice
 
Posts: 3430
Joined: Thu Jun 14, 2007 11:51 am

Post » Sat Nov 17, 2012 4:33 am

I thought my code was clean, but guess who uploaded a mod with a debug message left active ;o)


Debug.MessageBox("Climates Of Tamriel Support Added to Minty Lightning Mod")

Now I have to go back into the hell, of publishing my patch again!

Anyone else hate publishing...
User avatar
Amiee Kent
 
Posts: 3447
Joined: Thu Jun 15, 2006 2:25 pm


Return to V - Skyrim