Skip to content

Improve player_name variable in dialogues - #3029

Merged
manuq merged 1 commit into
mainfrom
player-name-fix
Oct 16, 2026
Merged

manuq merged 1 commit into
mainfrom
player-name-fix

Conversation

@manuq

@manuq manuq commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

The dialogue template in project.setttings references {{ player_name }}. Change the setter of temporary_game_states in balloon to ensure that a fallback is used when no state provides player_name. For that, move the default player_name in Player to a constant. Also revert using the locals variable to store the player_name, use a dedicated variable instead.

Also, change the way to obtain player_name from state. Instead of checking if the state is Player, do as other parts of the project: assume that any Node2D is in group player is the player.

Fix #3028

The dialogue template in project.setttings references {{ player_name }}. Change
the setter of `temporary_game_states` in balloon to ensure that a fallback is
used when no state provides `player_name`. For that, move the default
`player_name` in Player to a constant. Also revert using the locals variable to
store the player_name, use a dedicated variable instead.

Also, change the way to obtain `player_name` from state. Instead of checking if
the state is Player, do as other parts of the project: assume that any Node2D is
in group `player` is the player.
@manuq
manuq requested a review from a team as a code owner October 16, 2026 15:08
@manuq

manuq commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator Author

I did 3 tests with the following dialogue inside a Cinematic node:

~ start
{{player_name}} meets Juan
{{player_name}}: Hello
Juan: Hi, {{player_name}}
=> END
  1. With a Player instance in the scene, of name "Martita":
Grabacion.de.pantalla.desde.2026-10-16.12-11-32.mp4
  1. With a Node2D added to group "player", and adding a builtin script to it:
extends Node2D

var player_name := "Martita"

The result is the same as in 1.

  1. Just the Cinematic node in the scene (no Player instance or anyrhing in group "player"):
Grabacion.de.pantalla.desde.2026-10-16.12-13-31.mp4

You can notice that the cinematic doesn't stop execution when no player node exists, and the ribbon is blue for line {{player_name}}: Hello in all cases.

@manuq
manuq merged commit 4b0d7af into main Oct 16, 2026
6 checks passed
@manuq
manuq deleted the player-name-fix branch October 16, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cinematic node and new dialogue resource placeholder text

1 participant