saints row iv · missions & scripts
Saints Row IV Missions & Mission Scripts
How missions are defined, how mission scripts run, and what happens when a mission ends.
Missions & Scripts14 rows
| Topic | How it works | Where |
|---|---|---|
| Where missions come from | ||
| Mission list | _objectives.xtbl: each mission/quest with name, contact, priority, prerequisites, tutorials, story flags. | xtbl_load_objectives 006466d0 |
| In the world | Each mission has a mission_info object at its start point. Flags at +0x7A: bit 0 = unlocked, bit 2 = complete. | world_find_mission_info 00636270 |
| Current mission | Global pointer to the running mission. | g_current_mission 01810030 |
| Checkpoints | mission_checkpoints.xtbl: named restart points per mission. | xtbl_load_mission_checkpoints 0084df20 |
| How mission scripts run | ||
| Language | Lua 5.1 in the 'game play' engine. Globals are sandboxed so scripts can't accidentally create globals. | script_sandbox_globals 01148ab0 |
| Threads | Scripts run as cooperative threads: thread_new starts one, thread_yield pauses it until next frame. | script_thread_create 01147d90 |
| Every frame | All script threads are resumed once per frame (step #9 of the in-game frame). Spare frame time is used for Lua garbage collection. | script_system_frame 011497b0 -> script_threads_run 011483d0 |
| Typical flow | unlock -> player reaches the start trigger -> script spawns people/cars and sets objectives -> mission_end_success / failure. | 1,900+ Lua commands |
| Ending a mission | ||
| Who | Only the co-op host can end a mission. | mission_end 00849760 |
| Failure | Stores the failure text and the player's state for the retry. | |
| Success / cancel | Can warp the player between two navpoints to a safe place. | |
| Activities and diversions | ||
| Activities | activity_types.xtbl: each activity and what it turns off while running (roadblocks, helicopters, HUD...). _activity_goals.xtbl: score goals and bonus tiers. | xtbl_load_activity_types 0077ba40 |
| Co-op | Every activity is a host + participant class pair so both players share it. | |
| Diversions | 29 always-on side systems (mugging, stunts, hitman, streaking, collectibles...). | |
Built from SR4_Game_Explained.xlsx (650 KB), if you'd rather filter it in Excel. SaintsRowIV.exe v1.0.6.1 (Steam). Names are ours unless they're Volition's own Lua or C++ class names.

