WENOPAL

Items and recipes in Project Zomboid B42 mods

Food, drinks, weapons, 3D models, crafting and repair recipes, with examples taken from published mods.

Level intermediate · Updated

Everything "declarative" in a mod (anything that isn't code) goes in .txt files inside media/scripts/. Always with the same shape:

text
module MiModulo
{
    imports { Base, }

    item ...        { ... }
    model ...       { ... }
    craftRecipe ... { ... }
    fixing ...      { ... }
}

You can split it across several files (items/, models/, recipes/) as long as they all use the same module.

Food

A real example: the vienesa (a Chilean-style hot dog sausage) from Completos Chilenos.

text
item Vienesa
{
    DisplayCategory = Food,
    ItemType = base:food,
    Icon = Vienesa,
    FoodType = Meat,
    Weight = 0.1,
    DaysFresh = 5,
    DaysTotallyRotten = 9,
    HungerChange = -8,
    Calories = 150,
    Carbohydrates = 2,
    Lipids = 13,
    Proteins = 6,
    IsCookable = true,
    GoodHot = true,
    MinutesToCook = 10,
    MinutesToBurn = 30,
    CookingSound = FryingFood,
    EvolvedRecipe = Pizza:8;Stew:8;Pie:8;Stir fry:8;Pasta:8;Rice:8,
}
  • IsCookable, MinutesToCook and MinutesToBurn make it cookable, and it burns if you leave it on too long.
  • GoodHot = true: gives a bigger mood boost when eaten hot.
  • EvolvedRecipe lets it be used as an ingredient in the game's "evolved" recipes (pizza, stew...). The number is how much it contributes.

Drinks and "what's left over"

Melón con Vino (a Chilean drink of wine served in a hollowed-out melon) leaves the rind behind when you finish it:

text
item MelonConVino
{
    ItemType = base:food,
    Tags = base:alcoholicbeverage,
    ThirstChange = -40,
    Alcoholic = TRUE,
    AlcoholPower = 0.3,
    EatType = Candrink,
    CustomContextMenu = Drink,
    CustomEatSound = DrinkingFromCan,
    ReplaceOnUse = Melvin42.MelonCascara,
    ...
}
  • CustomContextMenu = Drink swaps "Eat" for "Drink" in the menu.
  • ReplaceOnUse gives you another item when it runs out: the rind.

Melee weapons

A summary of the Sable de Luz (lightsaber). The most important fields:

text
item SableLuz
{
    ItemType = base:weapon,
    DisplayCategory = Weapon,
    Categories = LongBlade,
    SubCategory = Swinging,
    TwoHandWeapon = true,
    MinDamage = 8,
    MaxDamage = 14,
    MaxRange = 2.0,
    MaxHitCount = 10,
    CriticalChance = 35.0,
    ConditionMax = 30,
    ConditionLowerChanceOneIn = 30,
    SwingAnim = Bat,
    SwingSound = SableLuzSwing,
    HitSound = SableLuzHit,
    ...
}

3D models (on the ground and in hand)

An item can have one model for when it's in hand (StaticModel) and another for when it's on the ground (WorldStaticModel). They're declared with model blocks:

text
model MelonConVinoGround
{
    mesh = WorldItems/MelonConVino,     <- models_X/WorldItems/MelonConVino.x
    texture = MelonConVino,             <- textures/MelonConVino.png
    scale = 1.0,
}

And in the item, with the module in front:

text
StaticModel = Melvin42.MelonConVino,
WorldStaticModel = Melvin42.MelonConVinoGround,

Recipes (craftRecipe)

A real example: assembling a completo italiano (a Chilean hot dog topped with avocado, tomato and mayo).

text
craftRecipe MakeCompletoItaliano
{
    timedAction = Making,
    time = 60,
    Tags = InHandCraft;Cooking,
    category = Cooking,
    xpAward = Cooking:3,
    inputs
    {
        item 1 [CompleteItaliano.PanCompleto;Base.BunsHotdog_single] flags[InheritFoodAge;ItemCount],
        item 1 [CompleteItaliano.Vienesa;Base.Hotdog_single] flags[InheritFoodAge;ItemCount],
        item 1 [CompleteItaliano.Palta;Base.Avocado] flags[InheritFoodAge;ItemCount],
        item 1 [Base.Tomato] flags[InheritFoodAge;ItemCount],
        item 2 [Base.MayonnaiseFull],
    }
    outputs
    {
        item 1 CompleteItaliano.CompletoItaliano,
    }
}
  • [A;B] accepts either one: the mod's bun or the game's hot dog bun. That way the player doesn't get stuck hunting for one exact item.
  • flags[InheritFoodAge]: the completo comes out as fresh (or as old) as its ingredients.
  • Tags = InHandCraft lets you make it with the items in hand, no table needed.

And a recipe with a tool that doesn't get used up:

text
craftRecipe SLEnsamblarSable
{
    timedAction = MakingElectrical,
    time = 400,
    Tags = AnySurfaceCraft,
    category = Electrical,
    SkillRequired = Electricity:3,
    xpAward = Electricity:30,
    inputs
    {
        item 1 tags[base:screwdriver] mode:keep,
        item 1 [SL.EmpunaduraSable],
        item 1 [SL.CristalKyber],
        item 2 [Base.Battery] mode:destroy,
    }
    outputs
    {
        item 1 SL.SableLuz,
    }
}
  • tags[base:screwdriver] accepts any screwdriver. All the tags are in the tags reference, and the vanilla item IDs (Base.X) are in the items reference.
  • mode:keep gives the tool back; mode:destroy consumes the item.
  • SkillRequired requires a skill level and xpAward grants experience.

The recipe's visible name goes in Translate/<LANGUAGE>/Recipes.json, with the key matching the recipe name ("SLEnsamblarSable": "Assemble Lightsaber" in EN, "SLEnsamblarSable": "Ensamblar sable de luz" in ES).

Repair (fixing)

text
fixing Fix Sable de Luz
{
    Require : SableLuz,
    Fixer : Battery; Electricity=2,
    Fixer : ElectronicsScrap=2; Electricity=3,
}

Each Fixer is an alternative way to repair: which material, how much, and which skill it requires.

Where to look for more

The most reliable source is the game's own scripts: in the install folder, media/scripts/. If you want to know how something is done, find a similar vanilla item. Old guides on the internet are usually for Build 41, and many of them no longer work.