DAI 4.1 · STEP-BY-STEP · dai_skills

Skills

Create server-authoritative abilities with cooldowns, resource costs, progression gates, projectiles and function/command dispatch.

Build from scratchTest in Minecraft4.1 source-aligned

1. Create supporting state

Skills can gate on numeric level/rank/resource states and a string job state. Define those first with the State & Capabilities guide.

2. Create a skill definition

Place it under data/<namespace>/dai_skills/.

data/my_game/dai_skills/arc_shot.json
{
  "display_name": "Arc Shot",
  "description": "A stamina-gated projectile skill.",
  "properties": {
    "resource_state": "my_game:stamina",
    "level_state": "my_game:level",
    "rank_state": "my_game:arc_shot_rank",
    "projectile": "my_game:arc_bolt",
    "cooldown_group": "my_game:ranged_skill"
  },
  "numbers": {
    "resource_cost": 20,
    "required_level": 3,
    "required_rank": 1,
    "cooldown_ticks": 40,
    "projectile_count": 1,
    "projectile_speed": 1.6
  },
  "events": {
    "cast": "function:my_game:skills/arc_shot"
  }
}

3. Understand supported skill fields

numbers

cooldown_ticks resource_cost required_level required_rank max_rank projectile_count projectile_spread projectile_speed projectile_forward_offset

properties

cooldown_group resource_state level_state job_state required_job rank_state required_tag blocked_tag projectile

events

cast may be a function:, command:, bare namespaced function ID, or command text. A skill may also spawn its configured projectile.

4. Cast it

skill_cast
server_skill_cast

The server runtime checks cooldown → level → job → rank → tags → resource cost → projectile/dispatch, then deducts the resource and starts the cooldown only after a successful cast.

Definition of done

  • Insufficient resource cannot cast.
  • Cooldown prevents repeat activation.
  • Level/job/rank/tag gates match your progression.
  • The cast has at least one outcome: projectile, function or command.

Client casting in 4.1

Multiplayer clients cannot invoke every registered skill simply by knowing its ID. A directly player-cast skill must opt in with flags.client_callable; the server still evaluates cooldowns, resources, job/rank/tag requirements and the skill definition itself.

{
  "display_name":"Dash",
  "enabled":true,
  "flags":{"client_callable":true},
  "numbers":{"cooldown_ticks":40},
  "events":{"cast":"my_pack:dash_cast"}
}
Default is secure: omit the flag or set it to false for skills that should only be invoked by trusted server/internal flows.