Jump to content

Reference another mod's script without setting it as a master?


kurikinton

Recommended Posts

I seem to vaguely recall that there was a way that you could sometimes utilize functions from another mod's scripts (SOS for instance) without requiring that mod to be a master of your own mod.

 

I find myself needing to access script functions from a bunch of sexlab mods, but the more masters I add, it seems that the creation kit becomes more likely to corrupt the mod on save, so it would be helpful to be able to do some of that entirely in script and bypass the Creation Kit property setting step.

 

This would also make it possible to reduce mod functionality gracefully if some optional functionality wasn't available (Sexlab aroused for instance).

 

I'm pretty sure I've seen mods do this. Can anyone explain how or point to an example?

Link to comment

corrupting files on save... you got bigger problems. i've logged 2000+ hours in ck without that ever happening.

 

anyway, you are probably looking for something like...

;; if we were wanting sexlab.
SexLabFramework SexLab = Game.GetFormFromFile(0x00000000,"SexLab.esm") as SexLabFramework

where the 0x00000000 would be whatever the ID is of the Quest which has the framework script on it.

 

i'm not entirely 100% sure, i've done that before to check if a mod exists but i didn't try to access a script on a quest.

Link to comment

Not sure if this will help, but here's an example:

 

I'm using this to grab a potion from Milk Mod Economy without making it a master...

akSpeaker.equipitem(Game.GetFormFromFile(0x343F2, "MilkModNEW.esp"))

this is being done in dialogue, hence the "akspeaker" part.... 

I can grab items like that... and I know you can access information stored in StorageUtil, but I'm not sure how to grab a function from another mod's script. Pretty sure I've seen a tutorial on exactly that though... if I find it, I'll come back and post a link.

 

 

Link to comment
Thanks both of you for the input. That's a good start. I'll try messing around with Game.GetFormFromFile() and see where it takes me.
 

corrupting files on save... you got bigger problems. i've logged 2000+ hours in ck without that ever happening.

Actually the corruption was more likely due to trying to merge two mods (tried both manually and via Tes5Edit) and *then* edit the result in the CK because I didn't plan out the scope of my mod properly in advance. I'm starting over with a proper dependency map so I can split the mod up into parts as much as possible.
 

I'm not sure how to grab a function from another mod's script. Pretty sure I've seen a tutorial on exactly that though... if I find it, I'll come back and post a link.

 

Thanks, do please let me know if you find it!

Link to comment

you cant just grab functions, you have to grab the object the script is attached to, primarily Quests, for frameworks and such. my example was suppose to show that.

 

Yes, thanks, I understood that part because its the same as when setting a property to a script in the CK. 

Link to comment

 

Make sure you use it in a fashion so it doesn't put errors into the Papyrus log:

if Game.GetModByName("Sexlab.esm") > -1
    ; We can integrate with Sexlab!
    SexLabFramework SexLab = Game.GetFormFromFile(0x00000000,"SexLab.esm") as SexLabFramework
endif

 

Thanks, that worked like a charm:

 

 

 

Scriptname LSHookersSetupScript extends Quest  

Actor Property LSHooker1 Auto
Actor Property LSHooker2 Auto
Actor Property LSHooker3 Auto
Actor Property LSHooker4 Auto
Actor Property LSHooker5 Auto
Actor Property LSHooker6 Auto
Actor Property LSHooker7 Auto
Actor Property LSHooker8 Auto
Actor Property LSHooker9 Auto
Actor Property LSHooker10 Auto

function OnInit()
	Debug.Notification("Initializing Hooker Beauty")
	;stuff
	if Game.GetModByName("Sexlab Attraction.esm") > -1

	    SLAttractionMainScript SLAttraction = Game.GetFormFromFile(0x000012c7,"SexLab Attraction.esm") as SLAttractionMainScript
	    ;With SexLab Attraction, you have to first assign random stats before changing manually
            ;or else it will be ignored
	    SLAttraction.AssignNewStatsToActor(LSHooker1)
	    SLAttraction.AssignNewStatsToActor(LSHooker2)
	    SLAttraction.AssignNewStatsToActor(LSHooker3)
	    SLAttraction.AssignNewStatsToActor(LSHooker4)
	    SLAttraction.AssignNewStatsToActor(LSHooker5)
	    SLAttraction.AssignNewStatsToActor(LSHooker6)
	    SLAttraction.AssignNewStatsToActor(LSHooker7)
	    SLAttraction.AssignNewStatsToActor(LSHooker8)
	    SLAttraction.AssignNewStatsToActor(LSHooker9)
	    SLAttraction.AssignNewStatsToActor(LSHooker10)
	    SLAttraction.SetActorAttractiveness(LSHooker1, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker2, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker3, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker4, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker5, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker6, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker7, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker8, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker9, 90)
	    SLAttraction.SetActorAttractiveness(LSHooker10, 90)

	else
	    Debug.Notification("SexLabAttraction.esm not found")
	endif
endFunction
Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use