Create your first mod
This guide builds a mod called hello-cow. It runs before daCow_c::Execute and logs when a cow starts ticking.
1. Create the mod directory#
Inside your mods/ folder, create:
2. Write mod.json#
Create mods/hello-cow/mod.json:
{
"id": "hello-cow",
"name": "Hello Cow",
"type": "luau",
"entry": "main.luau",
"version": "1.0.0",
"hostVersion": "0.8.0",
"engineVersion": "1.0.0"
}
| Field | Description |
|---|---|
id | Unique id, no spaces |
name | Display name |
type | Use "luau" for Luau or TypeScript mods |
entry | Entry file path |
version | Semantic version of the mod package (for example, "1.0.0") |
hostVersion | Semantic version of the host game this mod requires (for example, "0.8.0") |
engineVersion | Semantic version of the Petrichor engine this mod requires (for example, "1.0.0") |
See manifest reference for all fields.
3. Write main.luau#
Create mods/hello-cow/main.luau:
What's happening here#
mod("hello-cow")builds a class fromPetrichor.Mod. See Script entry point.initruns once when Petrichor callsnew(). Register hooks here.self:before(sym, fn)runsfnbefore the game function.ctxhasctx.selfand parameters. Find symbols in Game Hooks. Actor names are on the Actors tab of the TP Ultimate Spreadsheet.return HelloCowreturns the class table. Petrichor creates an instance and callstick/shutdown(empty defaults fromPetrichor.Modunless you override them).
4. Run the game#
Copy hello-cow/ into your mods folder (see Prerequisites), then launch the game. You should see:
Next steps: reading struct fields#
Field names come from augment.bin. See hooks reference.
For TypeScript project setup, see TypeScript guide.
Shader mods
For visual effects without hooks, see Shader mod and the shader guides.