I'm trying to add character sprites / portraits to the dialogue ballons I made/modified using the Dialogue Plugin.
I was following the offical tutorital to the letter with the necessary changes to link to the files I want to use. But it won't work and I've checked the code and compared and constrasted multiple times and can't see what I've done wrong.
I even repeated the process from scratch and still cant get it to work. No problem loading the custom balloon, it just won't include the images.
Here is the code I added / changed
@onready var portrait: TextureRect = %Portrait
var portrait_path: String = "res://Draft Files/Milo Draft.png" % dialogue_line.character.to_lower()
if FileAccess.file_exists(portrait_path):
portrait.texture = load (portrait_path)
else:
portrait.texture = null
The problem was the usage of the % operator without a placeholder. This leads to an error which stops code execution.
Changing that part fixed the error:
var portrait_path: String = "res://Draft Files/Milo_Draft.png"
Also recommended to remove the whitespace in the file and directory names, because this could lead to problems on some systems.