Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to call function 'get_character_name' in base 'null instance' on a null instance. Invalid access to property or key 'resource_path' on a base object of type 'null instance'. #2516

Open
rubatozis opened this issue Jan 13, 2025 · 0 comments

Comments

@rubatozis
Copy link

The problem

Describe the bug
I'm not sure if it's a bug or if I'm being stupid but I'm trying to make a simple logic for loading the game upon pressing play on the menu and it keeps giving me this error: Attempt to call function 'get_character_name' in base 'null instance' on a null instance. Alternatively (see below) I get this other error instead: Invalid access to property or key 'resource_path' on a base object of type 'null instance'.

To Reproduce
From menu:

# PLAY/CONTINUE BUTTON
func _on_button_1_pressed() -> void:
	get_tree().change_scene_to_file("res://scenes/game.tscn") # Leave menu and go to game scene

Then the game scene. This is pretty much copied from the docs:

func load_save_game_slot(slot_name: String) -> void:
	if Dialogic.Save.has_slot(slot_name):
		Dialogic.Save.load()

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	load_save_game_slot("Default")

But upon testing i get this error: Attempt to call function 'get_character_name' in base 'null instance' on a null instance.
Which points to this line of code:
var container := dialogic.PortraitContainers.load_position_container(character.get_character_name())
Inside res://addons/dialogic/Modules/Character/subsystem_portraits.gd.

Expected behavior
For the save to load normally.

System (please complete the following information):

  • OS: Windows 10
  • Godot Version: 4.2.2
  • Dialogic Version: 2.0 Alpha 16

Solutions

Workaround

I have tried calling the timeline first:

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	Dialogic.start("test_timeline")
	load_save_game_slot("Default")

Which gives me a different error of a similar kind:
Invalid access to property or key 'resource_path' on a base object of type 'null instance'.
Which points to this line of code:
dialogic.current_state_info['portraits'].erase(character.resource_path)
Inside res://addons/dialogic/Modules/Character/subsystem_portraits.gd.

This is most definitely my fault in some way but I am a brand new dev so... Don't really know what to do. Plz be patient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant