Sign in to follow this  
minty1

How to have different crafting recipes for the same modded item that changes depending on DLC of the world?

Recommended Posts

minty1    1

I am working on a character mod character right now who has his own crafting tab and own items he can craft. Issue is that I can't seem to find a way to have the recipe change depending on the DLC that is in use in the world. I presumed the code would be really simple, just requiring this code 

Spoiler

    if SaveGameIndex:IsModeShipwrecked() then
    local runningteacraft = GLOBAL.Recipe("runningtea", {Ingredient ("jungletreeseed", 2), Ingredient ("coffeebeans_cooked", 1), Ingredient ("petals", 2)}, RECIPETABS.SPEEDTAB, {SCIENCE = 1, MAGIC = 0, ANCIENT = 0})    
        else
    local runningteacraft = GLOBAL.Recipe("runningtea", {Ingredient ("acorn", 2), Ingredient ("coffeebeans_cooked", 1), Ingredient ("petals", 2)}, RECIPETABS.SPEEDTAB, {SCIENCE = 1, MAGIC = 0, ANCIENT = 0})
        end

(My item is called Running Tea)

Anyway when I try to go into a world with this code, it gives me an error message which I posted as an image below. The weird thing is that the game still seems to run normally despite this error message, like I can see Maxwell's introduction dialogue and my character is able to die even though I am stuck on this screen.

I am sure this is quite a simple problem with an easy fix, but I am new to modding so not sure on how everything works just yet.

Anyone able to help me out? I would be very appreciative! 

20220511095502_1.jpg

Edited by minty1

Share this post


Link to post
Share on other sites
Leonidas IV    393

This error occour cause SaveGameIndex is in GLOBAL scope and don't exist in mod environment, so you need GLOBAL.SaveGameIndex

Also, you need GLOBAL.RECIPETABS too

Edited by Leonidas IV
  • Happy Hazard 1

Share this post


Link to post
Share on other sites
minty1    1
15 hours ago, Leonidas IV said:

This error occour cause SaveGameIndex is in GLOBAL scope and don't exist in mod environment, so you need GLOBAL.SaveGameIndex

Also, you need GLOBAL.RECIPETABS too

Ah hah! I can't believe that I missed that! Thank you so much dude, this was the issue. I really appreciate you helping me out, and also helping everybody out on this forum. 

God speed you magnificent bastard.

  • Happy Hazard 1

Share this post


Link to post
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
Sign in to follow this