Skip to content

Cookbook Species And Moves

bryanthaboi edited this page Jul 19, 2026 · 1 revision

Cookbook — species and moves

Record shapes: Concepts: Data Model and Reference: Registries. Worked paths: Tutorial 03, Tutorial 05.

R11 — Add a new move (existing effect)

mod.content.moves:register("MODSTRIKE", {
  id = "MODSTRIKE", name = "MODSTRIKE",
  type = "NORMAL", category = "physical",
  power = 70, accuracy = 100, pp = 15,
  effect = "NO_ADDITIONAL_EFFECT",
})
mod.content.pokemon:patch("RATTATA", {
  learnset = { __append = { { level = 15, move = "MODSTRIKE" } } },
})

Checkpoint: Rattata learns MODSTRIKE at 15 and it deals plain damage. Browse effect ids with mod.content.move_effects:each().

R12 — Add a custom move effect

mod.content.move_effects:register("MODDRAIN_EFFECT", {
  kind = "secondary",
  run = function(ctx)
    if ctx.rng(0, 255) < 85 then
      ctx.changeStage(ctx.target, "speed", -1)
    end
  end,
})

Checkpoint: a move with effect = "MODDRAIN_EFFECT" drops speed about a third of the time. The ctx facade (say, anim, damage, inflict, changeStage, rng) is the supported surface (src/battle/EffectRegistry.lua).

R13 — Add a new species

mod.content.pokemon:register("MODMON", {
  id = "MODMON", name = "MODMON", dex = 152, types = { "NORMAL" },
  baseStats = { hp = 60, attack = 70, defense = 55, speed = 90, special = 65 },
  catchRate = 120, baseExp = 100, growthRate = "MEDIUM_FAST",
  level1Moves = { "TACKLE" }, learnset = {}, evolutions = {},
  spriteFront = mod.assets:path("assets/front.png"),
  spriteBack = mod.assets:path("assets/back.png"),
  frontSize = 5,
})

Checkpoint: modkit validate passes; the mon battles and the dex counts 152. Full field list and the catchable checkpoint: Tutorial 03.

R14 — Give a species a party icon

mod.content.icons:register("MODMON", {
  image = mod.assets:path("assets/icon.png"),
})

Checkpoint: the party menu shows the icon. The registry is keyed by species id — a species past dex 151 gets an icon without touching any list.

R15 — Give a species a cry

mod.content.cries:register("MODMON", { file = mod.assets:path("assets/cry.wav") })
-- or derive from a vanilla cry:
mod.content.cries:patch("PIKACHU", { pitch = 200 })

Checkpoint: the cry plays on send-out and in the dex. Def shapes: a file, a { base, pitch, length } derivation, or a chip program.

R16 — Add a growth curve

mod.content.growth_rates:register("ERRATIC", {
  expForLevel = function(level) return level * level * level end,
})

Checkpoint: a species with growthRate = "ERRATIC" levels on your curve. The curve must strictly increase — validation calls it at levels 1 and 2 and rejects a flat one.

R17 — Add an evolution method

mod.content.evolution_methods:register("FRIENDSHIP", {
  check = function(game, mon, evo, trigger)
    return trigger.kind == "levelup" and (mon.friendship or 0) >= 220
  end,
})
mod.content.pokemon:patch("MODMON", {
  evolutions = { { method = "FRIENDSHIP", species = "MODMON2" } },
})

Checkpoint: the evolution fires when check returns true (vanilla methods: LEVEL, ITEM, TRADEsrc/pokemon/Evolution.lua). The evolution.check hook wraps every check if you need to intercept globally.

Clone this wiki locally