Jump to content

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


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Archived

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

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...