All Questions


Juan Uys

Please clarify adding StatusEffectContainer to player + enemy instead of Battler.tscn

Here's my transcript from Discord:

hey folks, quick question about In the _status_effect_container is null when the time_scale is set
I checked the spelling, and even let code-complete find the correct node here: onready var _status_effect_container: StatusEffectContainer = $StatusEffectContainer
I added a _ready() in the StatusEffectContainer script, with a print, but it doesn't seem to be called
I tried restarting Godot too
hmm, ok - my Battler "implementation" doesn't seem to have properly inherited from Battler.tscn, so it's missing the new StatusEffectContainer node

opyateToday at 22:50

Fixed now. I'll dig through the previous chapters to see if there was something unclear about "new inherited scene" when creating characters

opyateToday at 22:58

found it: section: Creating derived battler scenes
You could use the scene inheritance feature in Godot. I recommend to avoid it... <snip> That’s why, instead, I recommend creating new scenes, which is what we’ll do here.
so, the subsequent addition of StatusEffectContainer to Battler.tscn wasn't propagated to the player + enemy, because those were new and not inherited
What is a good solution here? Just create the StatusEffectContainer on both player + enemy? (perhaps the tut should reflect this)
  • Nathan Lovato replied

    As I answered on Discord, you can either:

    • Add an instance of the node in each battler scene.
    • Use scene inheritance for all battlers (I don't like it much in the feature's current state but it's an option)
    • Create a new StatusEffectContainer from code (and remove any existing instance from a battler scene).

    Here's how you'd go about creating it from code.

    var _status_effect_container :=
    func _ready() -> void:

    Thanks for pointing this out, I took a note to update the corresponding lesson(s)