I am currently trying to build a Slay the Spire type game and am using a guide to get the base bones for the game, I'm so close to being done with a simple version of the AI but I am dealing with this bug that I cannot fix, no matter what I do and have spent 3 days looking for this alone. specifically when I run the game, the startup fails and I get the message, "Invalid access to property or key 'start_turn' on a base object of type 'Nil'." if anyone is willing to lend me a hand that would be immensely appreciated. if anyone needs the zip file for a closer look i will happily send that over.

    sleepingcheshire "Invalid access to property or key 'start_turn' on a base object of type 'Nil'."

    Can you post the line of code that produces that error message?

    An example of that error would be this line, where the variable sprite is not defined:
    sprite.position = Vector2(100.0, 200.0)

    The remedy is to figure out why that variable is not defined.

      Your enemy_handler is null. Somewhere you forgot to assign it.

      sleepingcheshire my guess is the object doesn't exist when the code is run.
      if you are using autoloads, check the order of the autoloads.

      another problem could be an @export you forgot to set.

      sleepingcheshire Events.player_hand_discarded.connect(enemy_handler.start_turn)

      show us enemy_handler. is it an export or is it set dynamically in game?

        Jesusemora extends Node2D

        @export var char_stats: CharacterStats

        @onready var battle_ui: BattleUI = $BattleUI as BattleUI
        @onready var player_handler: PlayerHandler = $PlayerHandler as PlayerHandler
        @onready var enemy_handler: EnemyHandler = $EnemyHandler as EnemyHandler
        @onready var player: Player = $Player as Player

        func _ready() -> void:
        var new_stats: CharacterStats = char_stats.create_instance()
        battle_ui.char_stats = new_stats
        player.stats = new_stats

        Events.enemy_turn_ended.connect(_on_enemy_turn_ended)
        
        Events.player_turn_end.connect(player_handler.end_turn)
        Events.player_hand_discarded.connect(enemy_handler.start_turn)
        
        start_battle(new_stats)

        func start_battle(stats: CharacterStats) -> void:
        enemy_handler.reset_enemy_actions()
        player_handler.start_battle(stats)

        so everyone thank you all for the help, turns out the node was beneath something it shouldn't have been, all your advice was immensely helpful in me figuring that out. much appreciated 🙂