-
-
Notifications
You must be signed in to change notification settings - Fork 287
-
I am trying to implement the design of when there are 2 or more characters on the scene, only the character that is speaking will have normal modulated colors, while the characters who aren't speaking will grey out but not removed from the scene (I decided to use modulate to darken the portraits). Which part of the script should I look into? Or any better solution?
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 2 comments 2 replies
-
Hello, first thing, you marked this as a General discussion instead of a Question, if you can, you should fix that.
You can either use a script in your own game to handle the portraits or extend your own custom portraits.
Dialogic has the speaker_updated
signal, it will inform you what character is speaking, then each portrait can automatically be adjusted.
Beta Was this translation helpful? Give feedback.
All reactions
-
cutscene tscn - BoW - Godot Engine 12_1_2023 4_02_04 PM
Is this how should I connect it? Also I don't know how to access to "that character" in the signal, and change their modulate color when they are speaking / not speaking. I am kinda new to this...
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey, this might be a bit late, but for anyone that comes across this like me, i have managed to solved it (not the best possible solution i am sure, i am still new at godot and dialogic).
What i did was selecting the 5Portraits layer in my style then making it custom, inside the scene that opens there are 5 portrait containers with a script, in this script i wrote
DialogicUtil.autoload().Text.speaker_updated.connect(_on_speaker_updated)
in the _ready func
and then created this func
func _on_speaker_updated(character:DialogicCharacter):
if(get_child_count()>0):
if(get_child(0).get_meta('character').display_name!=character.display_name):
modulate = Color(0.1,0.1,0.1,1)
else:
modulate = Color(1,1,1,1)
Hope this helps!
Beta Was this translation helpful? Give feedback.
All reactions
-
Building on this reply, I eventually worked this out - a little cleaner I think and uses a tween for a nice fade in/fade out effect
@tool
extends DialogicLayoutLayer
## A layer that allows showing 5 portraits, like in a visual novel.
## The canvas layer that the portraits are on.
@export var portrait_size_mode: DialogicNode_PortraitContainer.SizeModes = DialogicNode_PortraitContainer.SizeModes.FIT_SCALE_HEIGHT
func _ready() -> void:
DialogicUtil.autoload().Text.speaker_updated.connect(_on_speaker_updated)
func _on_speaker_updated(current_speaker:DialogicCharacter):
for character: DialogicCharacter in Dialogic.Portraits.get_joined_characters():
var current_portrait = Dialogic.Portraits.get_character_portrait(character)
var target_color := Color(1, 1, 1, 1) if (current_speaker == character) else Color(0.6, 0.6, 0.6, 1)
# Tween modulate
var tween := get_tree().create_tween()
tween.tween_property(current_portrait, "modulate", target_color, 0.1)
Beta Was this translation helpful? Give feedback.