add_player_death_event
Adds a custom player death event to a Blueprint that pauses the game, shows the mouse cursor, and displays a lose widget when health reaches zero.
Instructions
Add a custom LostGame event to handle player death as described in Ch. 11.
Creates:
Custom Event "LostGame"
SetGamePaused(true)
ShowMouseCursor(true)
CreateWidget(LoseMenu) + AddToViewport
Modify EventAnyDamage to call LostGame when health reaches 0
Args: blueprint_name: Player character Blueprint name lose_widget_name: Widget to display on player death health_variable: Variable holding player health float node_position: [X, Y] graph position for the custom event node
KB: see knowledge_base/17_GAME_SYSTEMS_COOKBOOK.md#overview Example: add_player_death_event(blueprint_name="/Game/MCP_Test/BP_Example")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| node_position | No | ||
| blueprint_name | Yes | ||
| health_variable | No | PlayerHealth | |
| lose_widget_name | No | WBP_LoseMenu |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |