Jump to content

Conditional script loading


francogp

Recommended Posts

Hello,

 

I just want to modify some variables on other mod script, from my mod, only if the other mod is loaded (I use a lua function to detect it)

 

for example, a mod declare this in it's script folder (this is just an example):

module Hydrocraft
{
    imports
    {
        Base, farming

    }

/************************ITEMS************************/
	
item HCCream
    {
	Type				=	Food,
	DisplayName			=	Cream,
	Weight				=	0.1,
	ThirstChange 			=	-5,
	DaysTotallyRotten		=	7,
	DaysFresh 			=	4,
	Icon				=	HCCream,
    }

And from MY mod, I want to change the "wheight" from 0.1 to 0.2, but ONLY if "item HCCream" is declared (loaded from some script). I don't want to have a loading failed because that mod is not present.
So, my mod should be something like a mod for a mod, only if that mod is installed, otherwise skip that.

 

Can I do that?

NOTE: I don't want to override ALL the file, only THAT variable, so the mod will be compatible in the future.

Edited by francogp
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...