Hey, i'm making a top-down shooter. The enemies worked well before but now i just get a crash when they are in the game.
I made the player a unique name and reference it as '@onready'. This worked before! I changed something in the Player script but I don't know what could have caused this. Somehow the enemy now does't find the player which it uses to find its direction towards him.
#My enemies stopped working
8 messages · Page 1 of 1 (latest)
The symbol at player in the variable deceleration should be a "$" symbol
does enemy have its own scene and player also have it's own scene? You can't path between non-native scenes using "%". See https://docs.godotengine.org/en/stable/tutorials/scripting/scene_unique_nodes.html
Godot Engine documentation
Introduction: Using get_node() to reference nodes from a script can sometimes be fragile. If you move a button in a UI scene from one panel to another, the button's node path changes, and if a scri...
Try setting player using an @export + selecting player in the editor instead of an @onready. Based on your error that should fix your issue
I have both in an own scene. I also figured out that a new codeblock crashes it but I currently don't understand why
I'll quickly check that
Thank you! this works, now back onto damage functions 🙂
np! In the future, when the error message mentions Attempt to.... in base 'Null instance/Nil' it usually is your variable not being set correctly. In this case it was player