carenalgas / popochiu

Godot plugin to make point-and-click adventure games, inspired by tools like Adventure Game Studio and PowerQuest.
https://carenalgas.github.io/popochiu/
MIT License
205 stars 19 forks source link

get_prop function fails #328

Closed balloonpopper closed 2 weeks ago

balloonpopper commented 2 weeks ago

Bug description

I'm trying to run the following code var FacePosition = R.LockerRoom.get_prop("Shower").position

This fails with the following error on line 304 of popochiu_room.gd:

Cannot call method 'get_nodes_in_group' on a null value.

image

What appears to be happening is that the get_LockerRoom() function in r.gd is calling get_instance in i_room.gd which runs

return load(load(tres_path).scene).instantiate()

The scene it instantiates isn't in the tree so get_nodes_in_group fails.

I'm confused why it's trying to instantiate the scene though as the scene is already instantiated and running.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a prop (e.g. duck)
  2. Create a region in your room
  3. In its "_on_character_entered" function put a get_prop similar to var FacePosition = R.LockerRoom.get_prop("Shower").position
  4. Run the room and enter the region

Expected vs observed behavior

The prop should be returned.

Environment information (please complete):

Additional context

mapedorr commented 2 weeks ago

Hi. Thanks for reporting this! I'm gonna work on a fix right now.