YAML Spell Tutorial

This comprehensive tutorial will teach you everything you need to know about creating spells using YAML files in OpenRoads.

📚 Table of Contents

📝 YAML Basics

YAML (YAML Ain't Markup Language) is a human-readable data format. Here are the key rules:

Indentation

  • Use spaces, not tabs

  • Consistent indentation (usually 2 spaces)

  • Child elements are indented more than parents

Data Types

Quotes

  • Always quote strings that might be confused for other types

  • Quote strings with special characters

  • Numbers and booleans don't need quotes

🏗️ Spell File Structure

Each spell file should contain a single spell definition:

✅ Required Properties

Every spell must have these properties:

name (string)

The display name of the spell.

description (string)

A brief description of what the spell does.

sp_cost (number)

How many spell points the spell costs to cast.

target_type (string)

What the spell targets. Must be one of:

  • "self" - Targets the caster

  • "enemy" - Requires an enemy target

  • "player" - Requires a player target

  • "room" - Requires a room ID

  • "none" - No target required

effects (list)

What the spell actually does. Must contain at least one effect.

🔧 Optional Properties

Element and Level Requirements

Timing

Requirements

⚡ Effect System

Effects define what your spell actually does. You can have multiple effects in one spell.

Damage Effects

Healing Effects

Teleportation Effects

Summoning Effects

Stat Modification Effects

💬 Message System

Customize messages for different situations:

Basic Messages

Cast Time Messages

Broadcast Messages

Message Placeholders

  • %s - String values (target names, item names)

  • %d - Numeric values (levels, spell points, damage)

Example:

🚫 Restrictions

Control when and where spells can be cast:

Combat Restrictions

Instance Limits

Location Restrictions

🎯 Advanced Examples

Multi-Effect Spell

Complex Teleport Spell

Summoning with Restrictions

📋 Best Practices

File Organization

  • Use descriptive filenames: fireball.yaml, greater_heal.yaml

  • One spell per file

  • Group related spells with prefixes: fire_bolt.yaml, fire_wall.yaml

Spell Design

  • Start with simple effects and add complexity gradually

  • Balance SP cost with power level

  • Consider cast time vs. power (more powerful = longer cast time)

  • Use appropriate cooldowns to prevent spam

YAML Style

  • Use consistent indentation (2 spaces recommended)

  • Quote all string values

  • Use descriptive comments when needed

  • Keep lines under 80 characters when possible

Testing

  • Test with different character levels

  • Test with different elements

  • Test edge cases (no SP, wrong element, etc.)

  • Verify all messages display correctly

🐛 Troubleshooting

Common YAML Errors

Indentation Error:

Missing Quotes:

Invalid List Syntax:

Spell Not Loading

  1. Check server logs for YAML parsing errors

  2. Verify file is in spells/custom/ directory

  3. Ensure file has .yaml or .yml extension

  4. Validate YAML syntax online

Spell Not Working

  1. Check all required properties are present

  2. Verify target_type matches how you're casting

  3. Check element and level requirements

  4. Ensure effect types are spelled correctly

Performance Issues

  1. Avoid very short cooldowns on powerful spells

  2. Limit max_instances for summoning spells

  3. Use reasonable cast times for balance

🎓 Graduation

Congratulations! You now know how to create YAML spells in OpenRoads. Here's what to explore next:

  1. Spell Effects Reference - Complete effect documentation

  2. JSON Spell Guide - Learn about hardcoded spells

  3. Experiment - Try creating your own unique spells!

Happy spell crafting! ✨

Last updated

Was this helpful?