Skip to content

Examples

Complete, runnable addon examples. Each one is small enough to read in full but demonstrates a real, useful pattern.

Examples in this section

  • Keybind Action — Bind a key to trigger a script function. Covers on_key_press, DIK constants, and MCM key binding.
  • Item Use Effect — React when the player uses a specific item. Covers actor_on_item_use and reading item sections.
  • NPC Death Reward — Spawn loot or give the player money when a specific NPC type dies. Covers npc_on_death_callback and alife():create.
  • MCM Options — A mod with a full settings screen: checkbox, slider, and key bind options. Covers MCM registration and ui_mcm.get.

Tip

Each example is structured as a complete addon folder you can drop into gamedata/. The folder structure and all required files are shown.