Mission Scripting
Write and run mission scripts for Sunrise.
Warning
Sunrise is a work in progress. The scripting SDK and API are not complete. Some parts may be missing or may not work.
A mission script is a Lua file that runs on the local server while an activity is live. It reacts to what the game client reports, and it asks the client to do things: spawn enemies, open doors, show goals, play lines. Sunrise does the networking, counting and bookkeeping. The script only decides what should happen.
Your scripts live in Sunrise/scripts/<name>/<name>.lua in your game install. A
mod can ship scripts too, and its script replaces the base one. The scripts
that ship with Sunrise, and the shared libraries in Sunrise/scripts/lib/, are working examples.
Start with Your first script.
These pages use a few conventions:
- Lua is shown for anything a script does. C-like pseudocode is shown for what Sunrise does.
Slot.X,Squad.Xand similar names are placeholders unless the text names a real mission.- A path like
scripts/lib/flow.luais relative to theSunrisefolder in your game install.
Your first script
From an empty folder to a running, reloadable mission script.
Read more →The world model
Activity, scenario, state, region, slot, squad: the words the other pages use.
Read more →How a script runs
Callbacks, transactions, faults, limits, the sandbox and what survives a reload.
Read more →Lua API reference
Every call a mission script can make, and every field an event carries.
Read more →The generated SDK modules
The mission and activity modules Sunrise writes, and how their keys are made.
Read more →The live SDK views
Reading the catalog, manifest and generated world from a running script.
Read more →Recipes
Short answers to how do I spawn, open, show, play, wait and finish.
Read more →The shared script libraries
Reference for lib.mission_lib, lib.flow, lib.campaign, lib.freeroam and lib.combat.
Read more →Build a mission from scratch
A whole mission in four beats, from survey to a finished run.
Read more →Finding things in game
Use the in-game tools to find the slot, squad, line or goal you need.
Read more →Debugging a script
The Script page, the log, common errors, faults and an offline check.
Read more →Quick reference
The program skeleton, the calls you need most, and where every file lives.
Read more →