ServUO Version
Publish 57
Ultima Expansion
Endless Journey
So I'm trying to spawn OWLTR"s recipes in a bag but unsure how to attach the value to the item, in game you can just change the recipe on the scroll, but not sure how to do that on an item spawned in a bag. Any ideas? I've tried DropItem(new CraftingRecipe(Iron)); that's all I know how to do them lol :)
 
Looking through OWLTR I noticed that there are 2 types of crafting recipe's. The one your using CraftingRecipe and a separate one for CraftResources called ResourceRecipe.

The following should let you drop either into the bag.
C#:
            //Item Recipe Example
            DropItem(new CraftingRecipe() { Recipe = typeof(SkullCap) });
            
            //Resource Recipe Example
            DropItem(new ResourceRecipe(CraftResource.DullCopper));
 
From some of the work I have done, I have found that you need to create the scroll as an item before you can add it like that. Like this:
C#:
public class WallMountedAquariumRecipeScroll : RecipeScroll
    {
        [Constructable]
        public WallMountedAquariumRecipeScroll()
            : base(154)
        {
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);
            writer.Write(0); // version
        }

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

Once you have created the recipe scrolls as an item like this you will be able to add it to a bag or anything else in game. The number 154 is the recipe number. So when you use this code you will need to find the recipe number that you want to use and put it in.
 
From some of the work I have done, I have found that you need to create the scroll as an item before you can add it like that. Like this:
You don't have to do that with the OWLTR CraftingRecipe and ResourceRecipe scrolls I tested them as I posted above before I posted it. I haven't looked into the default RecipeScroll's built into servuo that you showed in your example so I'm not sure about those.
 
You don't have to do that with the OWLTR CraftingRecipe and ResourceRecipe scrolls I tested them as I posted above before I posted it. I haven't looked into the default RecipeScroll's built into servuo that you showed in your example so I'm not sure about those.
I don't use the OWLTR system so I am going from other work I have done with recipes.
 
Back