Godot Version
Godot 4.3
Question
I’m trying to create a conditional that checks if the player is nearby an enemy (CharacterBody3D).
IsPlayerClose Script:
extends ConditionLeaf
var player = Global.player
func tick(actor: Node, _blackboard: Blackboard) → int:
var actor_position = actor.global_position
var player_position = player.global_position
if actor_position.distance_to(player_position) < 5 :
return SUCCESS
return FAILURE
When I try to run the scene, I get the following error message: “Invalid access to property or key ‘global_position’ on a base object of type ‘Nil’.”