Jump to content

Only show a recipe when a specific mod is enabled?


GalloViking

Recommended Posts

Heya folks, I'm at a loss here.

 

I am trying to make a mod that adds "trading" recipes to buy and sell items with a ham radio. Problem is, I want to make it compatible with brita's for buying/selling their ammo and I don't know how to hide those recipes when the mod is not activated, through the use of Obsolete potentially. I know how to use getActivatedMods():contains("insertmodhere") but it only works in .lua, not .txt.

 

An easy solution would be to make a patch for brita's weapons, but as I add more recipes for other mods, I'll end up with dozens of patches and I'd rather not.

Link to comment
Share on other sites

  • 3 weeks later...

Just make the recipe invalid if the mod isnt installed:

 

module MyModID
{
    imports
    {
        Base
    }
        
    recipe Buy AN/PRC-77 Radio Man Pack
    {
       Money=1,
       Result: Bag_ARVN_Rucksack,
       Time: 50.0,
       OnCanPerform:Recipe.OnCanPerform.CanBuyFromBritaArmor
    } 
}



function Recipe.OnCanPerform.CanBuyFromBritaArmor(recipe, playerObj, item)
    return getActivatedMods():contains("Brita2")
end
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...