Skip to main content

Demo Spell Examples

These demo spells showcase different features of the modular spell system, from projectile mechanics to channeling and area effects.

Burning Blast

A channeled projectile spell that forms and unleashes a burning ball of magma. Upon impact, it deals 250% damage and ignites all targets in a small radius.

Key Features

  • Channeling system with warmup period
  • Projectile retargeting during channel phase
  • Visual effects that evolve during flight
  • Area of effect damage on impact
  • Damage scaling at 250% base damage

How It Works

The spell is registered with the spell system, defining its cooldown, warmup, and channel behaviors:
burning_blast-cast:
  Skills:
  - skill:Spell{id=burning_blast;name=Burning Blast;type=ABILITY;
    spellcd=3;warmup=0.6;
    onChannelStart=burning_blast-exec;
    onChannelTick=[ 
      - vskill{s=channel-tick_fx} 
      - potion{t=SLOWNESS;l=2;duration=4;a=false;i=false;p=false}
      ]} @self
  • spellcd=3: 3 second cooldown
  • warmup=0.6: 0.6 second channel time
  • onChannelTick: Applies slowness while channeling
Once channeling completes, the spell fires a projectile:
burning_blast-fire:
  Skills:
  - skill:setRandomID
  - setvarloc{var=originloc;v=@origin}
  - setvar{var=fired;val=0}
  - projectile{fo=true;ti=3;syo=0;sfo=0;hnp=true;se=true;ham=true;
    velocity=0.1;i=1;g=0;mr=32;hr=0.4;vr=0.4;drawhitbox=false;
    bullet=DISPLAY;material=magma;rots=0,12,12;scale=0.5,0.5,0.5;
    onStart=burning_blast-start;
    onTick=burning_blast-tick;
    onHit=burning_blast-hit_entity;
    onEnd=burning_blast-end}
  • Uses DISPLAY entity with magma material
  • Starts slow (velocity=0.1) then accelerates
  • Tracks origin location for retargeting
While channeling, the projectile follows your cursor:
burning_blast-retarget:
  Conditions:
  - varequals{var=fired;val=0}
  Skills:
  - raytraceto{fo=true;origin=@selfeyelocation;md=64;rw=0.1;ys=0;yt=0;
    locationskill=[
    - setProjectileDirection{magnitude=1}
    ]} @forward{f=12;uel=true}
Only retargets when fired=0 (during channel phase)
On hit or at the end of flight, deals area damage:
burning_blast-hit_entity:
  Skills:
  - skill:damage-ability{immune=20;
    damageMod=[ - variableMath{var=damage;equation="x*2.5"} ];
    onHit=[
    - ignite{t=80}
    ]} 

burning_blast-end:
  Skills:
  - skill{s=burning_blast-hit_entity} @ENO{r=3}
  - sound{s=entity.generic.explode;p=1.2} 
  - e:p{p=explosion;a=1}
  - e:p{p=flame;a=12;speed=0.3}
  • Multiplies damage by 2.5x
  • Ignites targets for 4 seconds (80 ticks)
  • Hits all enemies within 3 blocks at impact location

Full Code

# Form and unleash a burning ball of magma. Upon impact, deals 250% damage and ignites all targets in a small radius.
burning_blast-cast:
  Skills:
  - skill:Spell{id=burning_blast;name=Burning Blast;type=ABILITY;
    spellcd=3;warmup=0.6;
    onChannelStart=burning_blast-exec;
    onChannelTick=[ 
      - vskill{s=channel-tick_fx} 
      - potion{t=SLOWNESS;l=2;duration=4;a=false;i=false;p=false}
      ]} @self

burning_blast-exec:
  Skills:
  - skill:burning_blast-fire{origin=@forward{uel=true;f=1;yo=-0.2}} @forward{yo=-0.2;f=12;uel=true}

burning_blast-fire:
  Skills:
  - skill:setRandomID
  - setvarloc{var=originloc;v=@origin}
  - setvar{var=fired;val=0}
  - projectile{fo=true;ti=3;syo=0;sfo=0;hnp=true;se=true;ham=true;
    velocity=0.1;i=1;g=0;mr=32;hr=0.4;vr=0.4;drawhitbox=false;
    bullet=DISPLAY;material=magma;rots=0,12,12;scale=0.5,0.5,0.5;
    onStart=burning_blast-start;
    onTick=burning_blast-tick;
    onHit=burning_blast-hit_entity;
    onEnd=burning_blast-end}

burning_blast-start:
  Skills:
  - wait{c=[ - hasaura{aura=<skill.var.id>-channel} false ]}
  - delay 1
  - modifyprojectile{t=VELOCITY;a=SET;v=12}
  - modifyprojectile{t=VELOCITY;a=ADD;v=1;repeat=6;repeati=4}
  - setvar{var=fired;val=1}

burning_blast-tick:
  Skills:
  - setvar{var=iterations;value="<skill.var.iterations|0>+1"}
  - skill:burning_blast-retarget
  - skill:burning_blast-tick_vfx

burning_blast-retarget:
  Conditions:
  - varequals{var=fired;val=0}
  Skills:
  - raytraceto{fo=true;origin=@selfeyelocation;md=64;rw=0.1;ys=0;yt=0;
    locationskill=[
    - setProjectileDirection{magnitude=1}
    ]} @forward{f=12;uel=true}

  - setvar{var=pitch;val="<skill.var.pitch|0>+12"} 
  - setvar{var=yaw;val="<skill.var.yaw|0>+12"}
  - setvar{var=roll;val="<skill.var.roll|0>+12"}

  - polygon{points=1;scale=1;db=0.5;mpd=false;
    pitch=<skill.var.pitch>;yaw=<skill.var.yaw>;roll=<skill.var.roll>;
      oe=[ 
      - e:p{p=small_flame;fo=true;origin=@targetedlocation;directional=true;a=1;speed=0.2} @projectileforward{f=0}
      ]} 

burning_blast-tick_vfx:
  Conditions:
  - varequals{var=fired;val=1}
  Skills:
  - setvarloc{var=originloc;v=@ProjectileForward{f=-4}}
  - slash{fromorigin=true;origin=@origin;mpd=false;dtt=true;fo=0;yo=0;
    angle=360;points=2;w=<skill.var.size|1>;h=<skill.var.size|1>;duration=0;pitch=90;roll="<skill.var.iterations>*24";
    oP=[
    - e:p{fo=true;origin=@VariableLocation{var=originloc};p=small_flame;a=1;directional=true;speed=0.3;hs=0.2;vs=0.2} @targetedlocation
    ]}

burning_blast-hit_entity:
  Skills:
  - skill:damage-ability{immune=20;
    damageMod=[ - variableMath{var=damage;equation="x*2.5"} ];
    onHit=[
    - ignite{t=80}
    ]} 

burning_blast-end:
  Skills:
  - skill{s=burning_blast-hit_entity} @ENO{r=3}
  - sound{s=entity.generic.explode;p=1.2} 
  - e:p{p=explosion;a=1}
  - e:p{p=flame;a=12;speed=0.3}
  - e:pr{p=flame;radius=0.1;points=12;a=1;speed=0.4;hS=0.20;vS=0.8;directional=true} 

  - e:p{p=reddust;color=#ff0000;amount=4;speed=0;hS=0.40;vS=0.4;size=2}
  - e:p{p=reddust;color=#ff6600;amount=4;speed=0;hS=0.40;vS=0.4;size=2}
  - e:p{p=reddust;color=#ff0000;amount=1;speed=0;hS=0.40;vS=0.4;size=5}
  - e:p{p=reddust;color=#ffaa00;amount=1;speed=0;hS=0.40;vS=0.4;size=5}

Common Patterns

These demo spells illustrate several reusable patterns:

Channeling System

All spells use the skill:Spell wrapper with channel callbacks:
  • onChannelStart: Initial setup
  • onChannelTick: Continuous effects
  • onInterrupt: Cleanup and cooldown

Variable Management

Spells use variables for state tracking:
  • setvar and setvarloc for storage
  • <skill.var.name|default> for retrieval with defaults
  • varequals conditions for state checks

Damage Scaling

The damage-ability skill provides:
  • damageMod for scaling (e.g., x*2.5 for 250%)
  • immune for hit immunity frames
  • onHit for additional effects

Visual Effects

Consistent particle effect patterns:
  • e:p for particle effects
  • e:pr for particle rings
  • Color coding with reddust particles
  • Sound effects synchronized with actions

Next Steps

Weapon Combos

Learn how to create combo systems for weapons

Custom Items

Build custom items that integrate with spells

Spell System

Understand the core spell system mechanics

Skill Reference

Browse all available skill mechanics

Build docs developers (and LLMs) love