Need Help Making a Meal Recipe Def.

Started by Wistening, January 29, 2017, 11:16:49 AM

Previous topic - Next topic

Wistening

Okay, so how do I make a meal recipe def with only 2 ingredients, A Component and a Simple Meal?
It also keep telling me <Defs> is expected at line 42, position 11 when I start the game.
Uh

b4d

Can I have a look at your recipe def?

I tried to make a sample recipe def, tested it and it works
<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <RecipeDef>
<defName>CookMealWeird</defName>
<label>cook weird meal</label>
<description>Cooks a weird meal from a combination of simple meals and components.</description>
<jobString>Cooking weird meal.</jobString>
<workSpeedStat>CookSpeed</workSpeedStat>
<effectWorking>Cook</effectWorking>
    <soundWorking>Recipe_CookMeal</soundWorking>
    <ingredients>
<li>
<filter>
<thingDefs>
<li>Component</li>           
          </thingDefs>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>MealSimple</li>           
          </thingDefs>
</filter>
<count>1</count>
</li>
</ingredients>
<products>
      <MealWeird>1</MealWeird>
    </products>
<fixedIngredientFilter>
      <thingDefs>
        <li>Component</li>
<li>MealSimple</li>
      </thingDefs>
    </fixedIngredientFilter>
<skillRequirements>
<li>
<skill>Cooking</skill>
<minLevel>4</minLevel>
</li>
</skillRequirements>
    <workSkill>Cooking</workSkill>
<recipeUsers>
        <li>ElectricStove</li>
<li>FueledStove</li>
    </recipeUsers>
<workAmount>600</workAmount>
  </RecipeDef>
</Defs>


I'm no expert though. Don't know if there's any flaws on that recipe def

Wistening

Quote from: b4d on January 30, 2017, 12:12:16 AM
Can I have a look at your recipe def?

I tried to make a sample recipe def, tested it and it works
<?xml version="1.0" encoding="utf-8"?>
<Defs>
  <RecipeDef>
<defName>CookMealWeird</defName>
<label>cook weird meal</label>
<description>Cooks a weird meal from a combination of simple meals and components.</description>
<jobString>Cooking weird meal.</jobString>
<workSpeedStat>CookSpeed</workSpeedStat>
<effectWorking>Cook</effectWorking>
    <soundWorking>Recipe_CookMeal</soundWorking>
    <ingredients>
<li>
<filter>
<thingDefs>
<li>Component</li>           
          </thingDefs>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>MealSimple</li>           
          </thingDefs>
</filter>
<count>1</count>
</li>
</ingredients>
<products>
      <MealWeird>1</MealWeird>
    </products>
<fixedIngredientFilter>
      <thingDefs>
        <li>Component</li>
<li>MealSimple</li>
      </thingDefs>
    </fixedIngredientFilter>
<skillRequirements>
<li>
<skill>Cooking</skill>
<minLevel>4</minLevel>
</li>
</skillRequirements>
    <workSkill>Cooking</workSkill>
<recipeUsers>
        <li>ElectricStove</li>
<li>FueledStove</li>
    </recipeUsers>
<workAmount>600</workAmount>
  </RecipeDef>
</Defs>


I'm no expert though. Don't know if there's any flaws on that recipe def

Yeah, here.
<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>

        <defName>MakeBoltos</defName>
        <label>make bolt O's</label>
        <description>Make some good stuff.</description>
        <jobString>Cooking Bolt O's.</jobString>
        <workSpeedStat>CookSpeed</workSpeedStat>
        <effectWorking>Cook</effectWorking>
    <soundWorking>Recipe_CookMeal</soundWorking>
    <allowMixingIngredients>true</allowMixingIngredients>
    <ingredientValueGetterClass>IngredientValueGetter_Nutrition</ingredientValueGetterClass>
    <ingredients>
            <li>
                 <li>Component<li>
                     </filter>
                     <count 1.00>
                 <li>MealSimple<li>
                     </filter>
                     <count 1.00>
             </li>
     </ingredients>

    <products>
      <BoltOs>1</BoltOs>
    </products>
         
        <skillRequirements>
            <li>
                <skill>Cooking</skill>
                <minLevel>6</minLevel>
            </li>
        </skillRequirements>
    <workSkill>Cooking</workSkill>
    <recipeUsers>
         <li>ElectricStove</li>
        <li>FueledStove</li>
      </recipeUsers>
  </RecipeDef>
  <RecipeDef>
        <defName>Baconraw</defName>
        <label>prepare bacon from any meat</label>
        <description>unprocessed bacon, just meat and fat.</description>
        <jobString>Preparing bacon.</jobString>
        <workSpeedStat>ButcheryFleshSpeed</workSpeedStat>
        <effectWorking>ButcherFlesh</effectWorking>
    <soundWorking>Recipe_ButcherCorpseFlesh</soundWorking>
    <allowMixingIngredients>true</allowMixingIngredients>
        <ingredientValueGetterClass>IngredientValueGetter_Nutrition</ingredientValueGetterClass>
        <ingredients>
            <li>
                <filter>
                    <categories>
                        <li>MeatRaw</li>
          </categories>
                </filter>
                <count>0.5</count>
            </li>
        </ingredients>
        <products>
      <Baconraw>10</Baconraw>
    </products>
        <fixedIngredientFilter>
            <categories>
                <li>FoodRaw</li>
            </categories>
        </fixedIngredientFilter>
        <defaultIngredientFilter>
            <categories>
                <li>FoodRaw</li>
            </categories>
        </defaultIngredientFilter>
        <skillRequirements>
            <li>
                <skill>Cooking</skill>
                <minLevel>4</minLevel>
            </li>
        </skillRequirements>
    <workSkill>Cooking</workSkill>
    <recipeUsers>
            <li>TableButcher</li>
        </recipeUsers>
  </RecipeDef>
Uh

b4d

I think your xml is a bit messed up.

the very first <RecipeDefs> doesn't have any closing tag at the bottom.

there should be a <RecipeDef> above <defName>MakeBoltos</defName>

for MakeBoltos recipe, I'm not sure if this section is needed
<allowMixingIngredients>true</allowMixingIngredients>
    <ingredientValueGetterClass>IngredientValueGetter_Nutrition</ingredientValueGetterClass>


the ingredients part
<ingredients>
            <li>
                 <li>Component<li>
                     </filter>
                     <count 1.00>
                 <li>MealSimple<li>
                     </filter>
                     <count 1.00>
             </li>
     </ingredients>

I'm not sure yours will work.

Try to replace it with something like this
<ingredients>
<li>
<filter>
<thingDefs>
<li>Component</li>           
</thingDefs>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>MealSimple</li>           
</thingDefs>
</filter>
<count>1</count>
</li>
</ingredients>

Wistening

Uh

nccvoyager

#5
Just a little note here.
I seem to remember a thread about cooking recipes that used non-food items as "ingredients" mention that, well, they do weird things.

Just a heads up.

As for the code.
You have a typo of "RecipeDefs" and not "RecipeDef" at the beginning.

You also have an amount of "0.5" for the number of pieces of meat for use in the second recipe.
Use 1 or more or the recipe will fail.
(If you want it to use meat with a value of 0.5 nutrition, then you have to use a different piece of code. Which I forget, since I never use it.)