MOD / Lua API

MOD Creation Tutorial & Lua API

Learn how to create character stat MODs, skill MODs, gene BUFF MODs, skin MODs, and hitbox MODs. Understand MOD management, priority, and sandbox limits.

01

1. Quick Start

1.1 What is a MOD?

A MOD is a player-made content pack that modifies creature stats, skills, skins, and hitbox properties. The game ships with two example MODs β€” DemoCharacterMod and DemoSkinsMod β€” located in the game’s MOD directory (see path above). Copy and modify them to get started quickly.

1.2 MOD Directory Location

PlatformMods Directory Path
Windows (Steam)Steam Workshop auto-manages subscribed MODs
Windows (Local)C:\Users\{User}\AppData\LocalLow\NEXTINDIE Studio\Mesozoic Dawn\Mods\
Linux ServerGameDirectory\MesozoicDawn_Data\StreamingAssets\Mods\
AndroidInternalStorage/Android/data/com.../files/Mods/
iOSAppSandbox/Documents/Mods/

1.3 MOD Directory Structure

Text
Mods/
β”œβ”€β”€ DemoCharacterMod/           ← Full example (stats+skills+hitbox+skin)
β”‚   β”œβ”€β”€ mod.json                ← MOD manifest
β”‚   β”œβ”€β”€ preview.jpg             ← Preview image
β”‚   β”œβ”€β”€ CharacterAsset/
β”‚   β”‚   └── allo.txt            ← Allosaurus config (all 4 types)
β”‚   └── SkinsAsset/
β”‚       └── Crooked mouth.png   ← Skin texture
β”‚
β”œβ”€β”€ DemoSkinsMod/               ← Skin-only MOD example
β”‚   β”œβ”€β”€ mod.json
β”‚   β”œβ”€β”€ preview.jpg
β”‚   └── SkinsAsset/
β”‚       β”œβ”€β”€ allo_deser_allo.txt ← Skin script
β”‚       └── deser_allo.png      ← Skin texture
β”‚
└── MyFirstMod/                 ← Your MOD root directory
    β”œβ”€β”€ mod.json
    └── CharacterAsset/
        └── allo.txt

1.4 Create mod.json

JSON
{
  "Name": "MyFirstMod",
  "Author": "Your Name",
  "Version": "1.0",
  "SupportedVersion": "0.6.*",
  "Priority": 0,
  "Description": "My first MOD",
  "PreviewImagePath": "preview.jpg",
  "Tags": "Character"
}
FieldRequiredDescription
Nameβœ…Unique MOD identifier. Match the folder name.
Authorβœ…Author name.
Versionβœ…MOD version number.
SupportedVersionβœ…Compatible game version. Supports * wildcards (e.g. 0.6.*).
Priority❌Execution priority (default 0). Higher values run later and win.
Description❌Short MOD description.
PreviewImagePath❌Relative path to preview image (e.g. preview.jpg).
Tags❌Comma-separated tags (e.g. Character,Skin).

1.5 The In-Game MOD Interface at a Glance

On the login screen click MOD Management to open the MOD interface. It has three tabs β€” Local MODs, Workshop, Manage MODs β€” plus the Create MOD and Set Directory buttons, covering a MOD author's whole journey from creation to testing.

Tab / ButtonPurpose
Local MODsMODs already previewed to the local load list. Enable/disable and delete here. What the game actually loads is the enabled MODs on this tab.
WorkshopSteam only. Browse and manage the Workshop MODs you subscribe to (view, unsubscribe), with install/download status shown.
Manage MODsYour own MOD-draft workbench. Each MOD offers Preview, Export, Edit, Delete (and Upload to Workshop on Steam).
Create MODCreate a new MOD draft, choosing a template: Blank / Skin example / Character stats example / Gene stats example.
Set DirectoryPoint to an external writable folder as your MOD root, so you can edit scripts with a desktop text editor and sync them back into the game.

1.6 Create Your MOD (Recommended for Beginners)

The game has a built-in MOD creation tool β€” no need to make folders by hand:
β‘  Log in (creating a MOD requires login; the MOD is bound to your account).
β‘‘ MOD Management β†’ click Create MOD.
β‘’ Fill in the name (letters/digits/underscore/hyphen only, 1–64 chars), author, version, supported version, description, tags, and pick a template.
β‘£ Click Create β€” the system generates the directory skeleton (mod.json plus the template's example script folder).
β‘€ The MOD then appears on the Manage MODs tab as a draft, not yet on the local load list.

TemplateWhat it generates
BlankOnly mod.json β€” start from scratch.
Skin exampleSkinsAsset/ skin-script skeleton.
Character stats exampleCharacterAsset/ character-stats skeleton.
Gene stats exampleGeneBuff/ gene-override skeleton.

1.7 Edit and Preview

β‘  Find your MOD on Manage MODs. If you have "Set Directory," the MOD is synced to that external folder and you can open it directly in a text editor; otherwise edit the Lua scripts (CharacterAsset/*.txt, etc.), skin PNGs, and preview.jpg inside its folder in the game MOD directory.
β‘‘ Use the inline Edit button to change version, supported version, description, and tags (the name is locked).
β‘’ When done, click Preview to push the draft into the Local MODs load list.

1.8 Test in Game (Author Dev-Test Loop)

  1. Create: MOD Management β†’ Create MOD β†’ pick a template β†’ Create (generates a draft; see 1.6).
  2. Edit: edit the scripts and metadata on Manage MODs (see 1.7).
  3. Preview: click Preview to move the draft into the Local MODs load list.
  4. Enable: switch to Local MODs, confirm the MOD status is "Enabled" (green) and "Supported Version" is green (red means it is incompatible with the current game version β€” fix SupportedVersion).
  5. Test: enter single-player or create a room β€” the modified stats/skills/skins take effect immediately.
  6. Iterate: go back to Manage MODs and edit the scripts β†’ create a local Host room so the preview snapshot refreshes from the latest draft β†’ re-enter the match to verify. After Sync Preview is enabled once, neither a game restart nor another Sync Preview click is needed.
  7. Distribute: when satisfied, use Export to produce a .mod file to share; on Steam you can also Upload to Workshop to publish publicly.

1.9 Sync Preview Mode (Development Testing)

Sync Preview in Manage MODs creates a separate runtime snapshot of your draft and registers it in the local load list. The authoring source stays in the Manage MODs directory; Sync Preview is not publishing and does not upload the MOD to the Workshop.

1.10 Export .mod (Sharing and Installation)

Export packages the current working copy from Manage MODs into a compressed .mod file and opens the system save-location picker. The package is rooted at the directory containing mod.json and includes scripts, images, and other MOD files. Export does not enable preview, alter your draft, make the MOD public, or upload it to the Workshop.

  1. Author: in Manage MODs, click Export, save the .mod through the system file picker, then send that file to testers or players.
  2. Recipient: on the Local MODs tab, click Import MOD, select the received .mod (or a supported .zip), then confirm it appears in the local load list and is enabled.
  3. Multiplayer: before joining or creating a MOD-enabled room, every participant should use the same MOD content, version, and enabled state. An exported package is not a substitute for publishing to the Workshop.
02

2. Character Stat MOD

Create a .txt file in the CharacterAsset/ directory and define a CharacterAsset table to modify creature attributes. Omitted fields keep original values. Below is the complete allo.txt from the bundled DemoCharacterMod, showing every available field.

2.1 Full Example (allo.txt from DemoCharacterMod)

Lua
-- Complete Allosaurus stat configuration (*do not delete below)
CharacterAsset = {
    name    = "Allosaurus",     -- Display name
    enable  = true,            -- Enable creature
    jump    = false,           -- Allow jumping (needs matching animation)
    race    = "allo",          -- Race tag (*required, unique match key)
    ropoda  = 0,               -- Nest type (-1=none, 0=theropod, 1=sauropod, 2=ornithischian)
    ropode  = 0,               -- Egg type (-1=none, 0=theropod, 1=sauropod, 2=ornithischian)
    volume  = 2,               -- Size class 0~5 (light→super)
    rank    = 7,               -- Star rating 0~12 (S1~SS tier)
    branch  = 3,               -- Family classification 0~25
    habit   = 0,               -- Habit (0=land, 1=hydrophilic, 2=marine reptile, 3=aquatic, 4=amphibian, 5=flying)
    type    = 0,               -- Category (0=carnivore, 1=herbivore, 2=aquatic, 3=arthropod, 4=mammal, 5=flying)
    taste   = 0,               -- Diet (0=carnivore, 1=flowers, 2=leaves, 3=omnivore)
    spawn   = 0,               -- Reproduction (0=oviparous, 1=viviparous)
    health  = 26503.0,         -- Max health
    hunger  = 12227.0,         -- Max hunger
    water   = 3128.0,          -- Max water
    oxygen  = 474.0,           -- Max oxygen
    stamina = 100.0,           -- Max stamina
    attack  = 2802.0,          -- Base attack damage
    defend  = 779.0,           -- Base defense
    pen     = 5,               -- Penetration level 0~10
    ten     = 3,               -- Tenacity level 0~10
    restore = 266.0,           -- Natural recovery rate
    consume = 100.0,           -- Cruise consumption
    weight  = 3600.0,          -- Body weight (kg)
    speed   = 27.01,           -- Walk speed (km/h)
    swim    = 13.5,            -- Swim speed (km/h)
    flying  = 0.0,             -- Flight speed (km/h)
    runSpeed    = 54.01,       -- Sprint speed (km/h)
    turnSpeed   = 0.61,        -- Turn rate (degrees/sec)
    growtime    = 1560.0,      -- Time to reach adult (seconds)
    ovumtime    = 1080.0,      -- Egg generation interval (seconds)
    hatching    = 2210.0,      -- Incubation time (seconds)
    safe        = 1800.0,      -- Juvenile protection period (seconds)
    skill   = "LifeDrain,3;",  -- Innate EX skill
    gene    = "",              -- Innate gene
}

2.2 Classification & Identity

FieldTypeDescription
racestringRequired. Race tag (e.g. allo, rex, sauro).
namestringDisplay name for the creature.
enableboolAllow use in selection screen (true/false).
jumpboolAllow jumping (must have matching animation).
volumeintSize class 0~5 (light→super).
rankintStar rating 0~12 (S1~SS tier).
branchintFamily classification 0~25.
habitintHabit 0~5 (0=land, 1=hydrophilic, 2=marine reptile, 3=aquatic, 4=amphibian, 5=flying).
typeintCategory 0~5 (0=carnivore, 1=herbivore, 2=aquatic, 3=arthropod, 4=mammal, 5=flying).
tasteintDiet 0~3 (0=carnivore, 1=flowers, 2=leaves, 3=omnivore).
spawnintReproduction 0~1 (0=oviparous, 1=viviparous).
ropodaintNest type -1~2 (-1=none, 0=theropod, 1=sauropod, 2=ornithischian).
ropodeintEgg type -1~2 (-1=none, 0=theropod, 1=sauropod, 2=ornithischian).

2.3 Survival & Combat

FieldTypeDescription
healthfloatMax health points.
staminafloatMax stamina.
hungerfloatMax hunger.
waterfloatMax water.
oxygenfloatMax oxygen.
attackfloatBase attack damage.
defendfloatBase defense.
penintPenetration level 0~10.
tenintTenacity level 0~10.
restorefloatNatural recovery rate.
consumefloatCruise consumption rate.
weightfloatBody weight (kg).
forcefloatPhysical force 0~10000.

2.4 Movement Speed (km/h)

FieldTypeDescription
speedfloatWalk speed.
runSpeedfloatSprint speed.
swimfloatSwim speed (0 if not aquatic).
flyingfloatFlight speed (0 if not flying).
turnSpeedfloatTurn rate (degrees/sec).

2.5 Time Parameters

FieldTypeDescription
growtimefloatTime to reach adult (seconds).
ovumtimefloatEgg generation interval (seconds).
hatchingfloatEgg incubation time (seconds).
safefloatJuvenile protection duration (seconds).

2.6 Organ Efficiency (0.0 ~ 1.0)

FieldTypeDescription
musclefloatMuscle efficiency. Affects attack stamina recovery.
stomachfloatStomach efficiency. Affects food/water consumption rate.
lungfloatLung efficiency. Affects oxygen output.
heartfloatHeart efficiency. Affects health regen speed.
breedfloatBreed efficiency. Affects egg generation rate.

2.7 Body Dimensions & Innate Traits

FieldTypeDescription
lengthfloatBody length (m) 0.1~100.
widthfloatBody width (m) 0.1~100.
heightfloatBody height (m) 0.1~100.
tempMinfloatMin comfortable temp (Β°C).
tempMaxfloatMax comfortable temp (Β°C).
humidMinfloatMin comfortable humidity (%).
humidMaxfloatMax comfortable humidity (%).
skillstringInnate EX skill. Format: "GeneName,Level;".
genestringInnate gene. Same format.
03

3. Skill MOD

Use the CharacterSkill table to modify creature attack skills. Each skill is a key-value pair (keys can be named freely). Can be combined with CharacterAsset in the same .txt file.

3.1 Full Example (from DemoCharacterMod)

Lua
CharacterSkill = {
    attack1 = {
        Race         = "allo",      -- *Required* race tag
        AttackOrder  = 1,           -- Attack slot index (1=mouth1, 2=mouth2...)
        AttackType   = 0,           -- Attack type 0~7 (see enum below)
        DamageMode   = 0,           -- Damage mode 0~2 (see enum below)
        Area         = nil,         -- Allowed areas: nil=any, {0,1}=land+shallow only
        AttackRange  = 1.0,         -- Collision radius (meters)
        Modify       = 2.0,         -- Damage multiplier (1=no change)
        UseStamina   = 0.01,        -- Stamina cost percentage (0=default)
        TriggerSkill = "Scars,2;",  -- Skill triggered on hit (format: "Name,Level;")
    },
    attack2 = {
        Race         = "allo",
        AttackOrder  = 2,
        AttackType   = 1,           -- Tail
        DamageMode   = 1,           -- AOE
        AttackRange  = 3.0,
        Modify       = 0.8,
        UseStamina   = 0.03,
        TriggerSkill = "Blood,2;",
    },
}

3.2 AttackType Enum

ValueNameNotes
0BITEBite attack
1TAILTail swipe
2STEPStomp
3HANDForelimb attack
4BODYBody slam
5HEADHeadbutt
6FOOTKick
7DASHDash charge

3.3 DamageMode Enum

ValueNameNotes
0Single TargetSingle-target attack
1AOEArea-of-effect (the first valid target has no decay; later targets decay in order)
2ChargeCharge attack (requires charge animation)

3.4 Area Enum

ValueName
0Land
1Shallow Water
2Deep Water
3Sky
04

4. Hitbox MOD

Use the CharacterHitGroup table to modify armor penetration rate and damage multiplier for each body part β€” create weak spots or reinforced armor.

4.1 Body Part Constants

ConstantValuePart
BODY_HEAD0Head (high penetration weak spot)
BODY_BODY2Body / Torso (armored)
BODY_TAIL3Tail
BODY_BELLY7Belly (fatal weak spot)

4.2 Example (from DemoCharacterMod)

Lua
CharacterHitGroup = {
    head = {
        Race              = "allo",
        PartType          = BODY_HEAD,
        PenetrationRate   = 0.6,    -- 0~1 (higher = easier to penetrate)
        DamageMultiplier  = 1.5,    -- 0.5~2 (>1 = more damage taken)
    },
    body = {
        Race              = "allo",
        PartType          = BODY_BODY,
        PenetrationRate   = 0.05,   -- Almost impenetrable
        DamageMultiplier  = 0.8,    -- 20% damage reduction
    },
    belly = {
        Race              = "allo",
        PartType          = BODY_BELLY,   -- Belly (value=7)
        PenetrationRate   = 0.9,    -- Very high penetration
        DamageMultiplier  = 1.8,    -- Heavy bonus damage
    },
}
05

5. Gene BUFF MOD

The Gene BUFF MOD overrides the values and config of existing genes/skills/BUFFs via the global table CharacterGeneBuff. Like CharacterAsset, the script is XLua (.txt) and can live in the same file or a dedicated GeneBuff/ subfolder.

5.1 Config Structure (CharacterGeneBuff)

Lua
CharacterGeneBuff = {
    -- Key = the existing gene tag to override (get TAGs from the Skills & Genes list page)
    Bleed = {
        Repeat  = "COVER",   -- Optional: overwrite rule
        Upgrade = "EXP",     -- Optional: upgrade mode
        With    = "",        -- Optional: attached effect DSL, format tag,level;
        Copes   = "",        -- Optional: counter target tag
        Effects = {          -- *Required* per-level table (replaces the original per-level values)
            { Level = 1, Probability = 0.55, Effect = 0.03, Duration = 5 },
            { Level = 2, Probability = 0.65, Effect = 0.05, Duration = 7 },
        }
    }
}

5.2 Modifiable Top-Level Fields

FieldTypeDescriptionRequired
RepeatenumOverwrite rule (see 5.4)Optional
UpgradeenumUpgrade mode (see 5.4)Optional
WithstringAttached effect DSL tag,level;Optional
CopesstringCounter target tagOptional
EffectsarrayPer-level value table (see 5.3)Required

5.3 Effects Per-Level Fields

FieldTypeDescriptionRange
LevelintLevel number (≀0 falls back to index)β‰₯1
ProbabilityfloatTrigger probability0~1
ChancefloatSynthesis chance0~1
RangeintEffect range0~100
LimitintMax affected players0~10
EffectfloatCore strength valueDepends on effect type
CountintCount (with TRIGGER)β€”
SkillfulfloatProficiency needed to reach this levelβ€”
DurationfloatDuration (for counter genes = % reduction of DEBUFF time)-99999~99999
ForeverboolIs this level's BUFF permanentβ€”
IsEffectFixed / IsDurationFixedboolWhether value/time is a fixed number (display only)β€”

5.4 Available Enums

EnumAllowed values
Upgrade modeNONE (no upgrade) / TIME (proficiency by survival time) / EXP (proficiency by kills) / ALL (all sources)
Repeat ruleONE (reject repeat) / ADD (stack) / COVER (refresh)

5.5 Full Example (bundled DemoCharacterMod/GeneBuff/gene_buff.txt)

Lua
CharacterGeneBuff = {
    -- β‘  Override the per-level values of the existing gene Metabolism
    Metabolism = {
        Effects = {
            { Level = 1, Effect = 0.12, Skillful = 0   },
            { Level = 2, Effect = 0.18, Skillful = 100 },
        }
    },
    -- β‘‘ Override the trigger probability, values and duration of the existing skill gene Bleed
    Bleed = {
        Effects = {
            { Level = 1, Probability = 0.55, Effect = 0.03, Duration = 5 },
            { Level = 2, Probability = 0.65, Effect = 0.05, Duration = 7 },
        }
    }
}

5.6 Grant Innate Genes to a Creature

Lua
-- In the creature's CharacterAsset script, use the gene field to grant innate genes. Format: GeneName,Level;
CharacterAsset = {
    race = "allo",
    gene = "Metabolism,2;",
}

5.7 Loading & Constraints

  • Applies immediately: once the override succeeds, birth / trigger / execution all read the overridden values.
  • Strict reference validation: With must be tag,level, no self-reference, the referenced tag must exist, and the level must be in range; Copes must exist and not self-reference. Any failure rejects the override (never fails silently).
  • No valid Effects β†’ that override fails.
  • Session-level restore: leaving / disabling / resetting the MOD automatically restores the overridden genes, preventing cross-match residue.
  • Dual-side parity: the server must load the same MOD via GAME_MODS; hashes must match to join; /modReload hot-reloads gene values.
06

6. Skin MOD

Use the CharacterSkin table to add custom skins. Each .txt file defines one skin. Texture files go in a SkinsAsset/ folder within your MOD directory. See the bundled DemoSkinsMod for a complete example.

6.1 Skin Script

Lua
CharacterSkin = {
    Race = "allo",                              -- *Required* race tag
    Name = "Crooked mouth",                      -- *Required* unique skin name
    Path = "SkinsAsset/Crooked mouth.png",       -- *Required* texture path (relative to MOD root)
}

6.2 Texture Requirements

  • Format: PNG or JPG.
  • Resolution: match the original texture (typically 2048Γ—2048 or 4096Γ—4096).
  • Path must be relative to MOD root β€” no absolute paths.

6.3 Multi-Skin Directory Example

Text
MySkinMod/
β”œβ”€β”€ mod.json
β”œβ”€β”€ preview.jpg
└── SkinsAsset/
    β”œβ”€β”€ allo_crooked.txt   ← CharacterSkin { Race="allo", Name="Crooked mouth", ... }
    β”œβ”€β”€ crooked_allo.png   ← Texture file
    β”œβ”€β”€ rex_volcano.txt    ← Multiple races in one MOD is fine
    └── volcano_rex.png
07

7. Advanced: Management & Distribution

7.1 Priority System

When multiple MODs modify the same field of the same race, the larger Priority value runs later and wins. Default is 0. Same-priority MODs run in alphabetical order.

7.2 Lua Sandbox Security

  • os, io: system commands and file I/O are blocked.
  • dofile, loadfile, package: arbitrary file execution and dynamic library loading are blocked.

7.3 Packaging as .mod File

Compress all files in your MOD folder as ZIP, then rename to .mod. Ensure mod.json is at the archive root. Both .mod and .zip are recognized.

7.4 Server MODs

Servers specify MODs via the GAME_MODS environment variable (comma-separated):
GAME_MODS=DemoCharacterMod,MySkinMod
All server-required MODs must be installed and enabled on clients to join. Extra client-only MODs will not apply on that server. Admins can use /modReload to hot-reload MOD config.