Jump to content

Recommended Posts

Hello, I need help :)...

So, I was wondering is it possible to make alternate crafting recipes for a mod character which only they can craft?

Like for example I want my character be able to craft wood walls with 3 gold nuggets, stone walls with 6 gold nuggets & moonrock walls with 12 gold nuggets. And each of the craftings would give 6 walls & only characters with the "amazon" tag can access these wall recipes..

Would this be possible or not? Because I have no idea how I would even do this :wilson_blush:... And thanks so, so, so much for reading my problem! I wish you have a splendid day/night :encouragement:!!!

Edited by SuperDavid
AddRecipe(self, name, ingredients, tab, level, placer, min_spacing, nounlock, numtogive, builder_tag, atlas, image)

An example with your amazon, though untested:

local function GenerateWallRecipe(prefab, count)
    AddRecipe(
        prefab,
        {
            Ingredient("goldnugget", count)
        },
        RECIPETABS.TOWN,
        TECH.SCIENCE_ONE,
        nil,
        nil,
        nil,
        6,
        "amazon"
    )
end
GenerateWallRecipe("wall_wood_item", 3)
GenerateWallRecipe("wall_stone_item", 6)
GenerateWallRecipe("wall_moonrock_item", 12)

 

Thank you so much CarlZalph :D!! If I can just ask 1 more thing is there a way she can have still have the original recipes & these ones too? So she can craft it with gold or the normal way or is that not possible? Again, thank you so much!

EDIT. Nvm I found out you can't have 2 recipes for same prefab :(

Edited by SuperDavid

You need different names for recipes.

local function GenerateAmazonWallRecipe(prefab, count)
	local amazon_prefab = prefab.."_amazon"
	local amazon_recipe = AddRecipe(
		amazon_prefab,
		{
			Ingredient("goldnugget", count)
		},
		GLOBAL.RECIPETABS.TOWN,
		GLOBAL.TECH.SCIENCE_ONE,
		nil,
		nil,
		nil,
		6,
		"amazon"
	)
	amazon_recipe.product = prefab
	amazon_recipe.sortkey = GLOBAL.AllRecipes[prefab].sortkey + 0.5
	local upper_amazon_prefab = string.upper(amazon_prefab)
	local upper_prefab = string.upper(prefab)
	local STRINGS = GLOBAL.STRINGS
	STRINGS.NAMES[upper_amazon_prefab] = STRINGS.NAMES[upper_prefab]
	STRINGS.RECIPE_DESC[upper_amazon_prefab] = STRINGS.RECIPE_DESC[upper_prefab]
end

GenerateAmazonWallRecipe("wall_wood_item", 3)
GenerateAmazonWallRecipe("wall_stone_item", 6)
GenerateAmazonWallRecipe("wall_moonrock_item", 12)

 

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...