Skip to content
mouse114514 edited this page Sep 12, 2026 · 1 revision

When Die

When Die

Overview

Triggers once when the player dies. Good for death cleanup, saving data, game-over handling, or death presentation.

This is a hat block: it must be placed at the top of a script.

Slots

This block has no parameter slots.

Connections

Connection Type Description
Top - hat block, cannot connect
Bottom Statement connected blocks run when the player dies

Typical Uses

  • Persist variables on death
  • Run game-over / settlement presentation
  • Play a death sound
  • Reset custom state

Example

when die
├── talk "You died"
├── play sound "death"
└── set myVar to 0

Generated Code

Emits the patch marker //PATCH:OnDie, injected into the OnDie() method.

Block ID: cu_when_die


中文 | Event Blocks | Block Reference

Clone this wiki locally