Carlos_ar

Member
ServUO Version
Publish 57
Ultima Expansion
Endless Journey
Sorry if this has been beaten to death, I did a search and nothing is resolved in previous posts, so I am asking here.

Here's a question regarding Recipes. So where does ServUO define the recipes?
I have it in DefCooking as RecipeName = 5000. It doesnt throw errors, but that seems too simple... Obviously when I add a recipescroll [add recipescroll 5000 I get a blank recipe scroll. I tried creating an Item with a base (5000) and a name Name = "RecipeName";
When I drop that item [add RecipeName I just get a blank recipe scroll. So I know I'm missing something that would further define the recipe. But where?
 
Heres what you do:
1. Create Recipe Item
2. Make your recipe:

C#:
using System;
using Server.Engines.Craft;

namespace Server.Items
{
    public class RecipeName : RecipeScroll
    {

        [Constructable]
        public RecipeName() : base(10100) // Set Recipe Number
        {

        }

        public RecipeName(Serial serial)
            : base(serial)
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }

    }
}


Go to your DefCrafting.cs // Whichever
C#:
public enum SmithRecipes
    {
        // magical
        ItemName = 10100,


Add Item to DefCrafting.cs Aswell //Whichever

C#:
            index = AddCraft(typeof(RecipeItem), 1011081, "the recipe item", 70.0, 120.0, typeof(IronIngot), 1044036, 90, 1044037);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRecipe(index, (int)SmithRecipes.RecipeName);
            ForceNonExceptional(index); /// Add TO whatever resources and stuff you want
 
Heres what you do:
1. Create Recipe Item
2. Make your recipe:

C#:
using System;
using Server.Engines.Craft;

namespace Server.Items
{
    public class RecipeName : RecipeScroll
    {

        [Constructable]
        public RecipeName() : base(10100) // Set Recipe Number
        {

        }

        public RecipeName(Serial serial)
            : base(serial)
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }

    }
}


Go to your DefCrafting.cs // Whichever
C#:
public enum SmithRecipes
    {
        // magical
        ItemName = 10100,


Add Item to DefCrafting.cs Aswell //Whichever

C#:
            index = AddCraft(typeof(RecipeItem), 1011081, "the recipe item", 70.0, 120.0, typeof(IronIngot), 1044036, 90, 1044037);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRes(index, typeof(Resource), "Resource", 1, 1053098);
            AddRecipe(index, (int)SmithRecipes.RecipeName);
            ForceNonExceptional(index); /// Add TO whatever resources and stuff you want
Awesome! Thank you!
 
Ok done and done....

Except... the recipes still only show up as blank recipe scrolls, until the player opens the crafting tool.

So let say the player collects a handful of scrolls, they appear blank. Then they open the tool... the scrolls are still blank but the scrolls they get after that now have stuff on them. I can {props the 'blank' scrolls and they have the appropriate recipe ID, but don't do anything when dclicked nor do they display what they are for.

I have no clue what I am doing wrong and at this point I'm just insanely frustrated by the whole thing.

******************
What is the difference between
AddCraft and index = AddCraft

It seems like they are interchangeable

If anyone is interested... after nearly a week tinkering with this script, I think I have it working properly.

So... The issue was, I added the Cooking Expansion which made DefCooking sooooo long. So what I did was split it up among different tools.
Kettle: Used for soups and boiled recipes
Tongs: Used for barbecue recipes and meat prep
Frying Pan: Used for pan frying and deep frying
Rolling Pin: Used for food prep and cold food assembly
Then I added a silver cauldron to make magic food and concoctions

There are many unlockable recipes, especially in the Magic department.

For simplicity I added all the food crafting in DefCooking, with the recipes listed under CookRecipes in DefCooking. Then I created DefCookingBoiling, DefCookingFrying, etc and just used the same scripts to reference back to DefCooking.

So, it turns out to do this, you HAVE to have index = AddCraft. If you just put AddCraft it throws an exception that that craft already exists. However... I neglected to change the crafts in DefCooking to also have Index =. So what was happening is the recipes would appear blank, until I opened the craft tool menu, then the title on the recipe would magically show up.

So... in DefCooking under CookRecipes I have the recipes listed, then under InitCraftList I have all the new stuff down as index = Addcraft.
Under each new tool I created (DefCookingBoiling, etc) I have the same InitCraftList that applies to the tool.

I don't know what, if any, problems this will cause in the future, but for now it works.

********************************************
ARGH! Well... Not quite... The scrolls show up right, but the tools now crash the server...
ROFL
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back