I keep getting a breakpoint from Nonexistent function x in base z

Thank you, sadly even with the copied script it works on my machine. You may have to upload your project to get further help on this, it must be something outside of the code or scene tree setup we’re missing.

1 Like

can you show a quick vid of it working? And would it have any conflicts with the tile editor at all?

'cause if so, it might be because of the scene it is in.

I read on the documentation that you have to get and set a node, just not sure if I implement it, it’ll work or not. Anyone else got ideas?

1 Like

Well… Sounds weird, but it might not be in the Steve scene that might be the problem- that scene is inside of another one, hence why I thought it might deal with unique names and such, but if it’s working as a standalone scene, then it could be a setting @gertkeno has enabled that I might’ve disabled or not known to enable. ^.^‘’ I’m just speculating though.

I changed as few settings as I could.

Here’s the entire scene file, besides the embedded script it’s very sort, only setting required parameters for the Animation Tree and Collision shape.

[gd_scene load_steps=14 format=3 uid="uid://bcu87s0bsen4d"]

[ext_resource type="Texture2D" uid="uid://bb7jrg5daebi8" path="res://icon.svg" id="1_c8kvs"]

[sub_resource type="GDScript" id="GDScript_cbk30"]
script/source = "extends CharacterBody2D

const WALK_ACCELL = 150
const RUN_ACCELL = 250
const ROLLTO = 270
const WALK_MAX_SPEED = 200
const RUN_MAX_SPEED = 300
const FRICTION = 100
#include in animation \"Slide\" on frame animation:
	#IF user hits left/right and new direction /= old direction, input slide anim
	# of \"skid\" to opposite direction(sliding right after swapping left makes
	#Steve use Skid-Right anim.

#var velocity = Vector2.ZERO
#const SPEED = 300.0
#const JUMP_VELOCITY = -400.0
#@onready var animationTree = %AnimationTree
var animationTree: AnimationTree
var animationState: AnimationNodeStateMachinePlayback

func _ready() -> void:
	#Tried, didn't give infoprint(get_path())
	print_tree()
	animationTree = $AnimationTree
	animationState = animationTree.get(\"parameters/playback\")
	animationState.travel(\"Idles 2\")

#func _physics_process(delta: float) -> void:
func _physics_process(delta: float) -> void:
	var Input_vector = Vector2.ZERO
	Input_vector.x = Input.get_action_strength(\"ui_right\") - Input.get_action_strength(\"ui_left\")
	Input_vector.y = Input.get_action_strength(\"ui_down\") - Input.get_action_strength(\"ui_up\")
	Input_vector = Input_vector.normalized()

	if Input_vector != Vector2.ZERO:

		#if KEY_SHIFT = bool(on/off):
		#use a
		animationState.travel(\"Walks\")
		#animationTree.set(\"parameters/Runs/blend_position\", input_vector,)
		animationTree.set(\"parameters/Walks/blend_position\", Input_vector)
		#animationTree.set(\"parameters/Rolls/blend_position\", input_vector,)
		animationTree.set(\"parameters/Idles 2/blend_position\", Input_vector)
		#velocity += input_vector * WALK * delta
		velocity = velocity.move_toward(Input_vector * WALK_ACCELL, WALK_MAX_SPEED * delta)
		#add in input_vector + RUN for Steve_run anims for above
			#specifically seperating run and walk anims so that player can choose
			#to \"sneak\" in specific areas. Remember, comment for reason, not just explanation.
		#velocity = velocity.limit_length(MAX_SPEED)
		#print(velocity)
		print(Input_vector.y)

	else:
		velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
		animationState.travel(\"Idles 2\")

		#I think I have to set up a cached command that puts in the last value that was preseed
		#\"On release of arrow direction, last x/y input put to Idle direction


	move_and_slide()
"

[sub_resource type="Animation" id="Animation_ve226"]
resource_name = "Idles"
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Rect2(0, 0, 128, 128), Rect2(128, 128, 128, 128)]
}

[sub_resource type="Animation" id="Animation_b5ndd"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:region_rect")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Rect2(0, 0, 128, 128)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Sprite2D:scale")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(1, 1)]
}

[sub_resource type="Animation" id="Animation_4l6y7"]
resource_name = "Walks"
loop_mode = 2
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 1),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(1, 1), Vector2(0.87, 0.87)]
}

[sub_resource type="AnimationLibrary" id="AnimationLibrary_0kp6j"]
_data = {
"Idles": SubResource("Animation_ve226"),
"RESET": SubResource("Animation_b5ndd"),
"Walks": SubResource("Animation_4l6y7")
}

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_cvjuk"]
animation = &"Idles"

[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_4p02t"]
animation = &"Walks"

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1vsl3"]

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_2k88m"]

[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ooobg"]

[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1bc2g"]
"states/Idles 2/node" = SubResource("AnimationNodeAnimation_cvjuk")
"states/Idles 2/position" = Vector2(423, 100)
states/Walks/node = SubResource("AnimationNodeAnimation_4p02t")
states/Walks/position = Vector2(604, 101)
transitions = ["Start", "Idles 2", SubResource("AnimationNodeStateMachineTransition_1vsl3"), "Idles 2", "Walks", SubResource("AnimationNodeStateMachineTransition_2k88m"), "Walks", "Idles 2", SubResource("AnimationNodeStateMachineTransition_ooobg")]

[sub_resource type="CircleShape2D" id="CircleShape2D_iblj5"]
radius = 72.0

[node name="Node2D" type="Node2D"]

[node name="CharacterBody2D" type="CharacterBody2D" parent="."]
script = SubResource("GDScript_cbk30")

[node name="Sprite2D" type="Sprite2D" parent="CharacterBody2D"]
texture = ExtResource("1_c8kvs")
region_enabled = true
region_rect = Rect2(0, 0, 128, 128)

[node name="AnimationPlayer" type="AnimationPlayer" parent="CharacterBody2D"]
libraries = {
"": SubResource("AnimationLibrary_0kp6j")
}

[node name="AnimationTree" type="AnimationTree" parent="CharacterBody2D"]
tree_root = SubResource("AnimationNodeStateMachine_1bc2g")
anim_player = NodePath("../AnimationPlayer")

[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
shape = SubResource("CircleShape2D_iblj5")

[node name="Camera2D" type="Camera2D" parent="."]
1 Like

What if it’s the blend space I’m using?


Like does this all look correct? From what it looks like, you’re just using a blendspace 2d I think? I’m not sure to be honest.

I am also using an AnimationNodeStateMachine, the subresource id matches here.

1 Like

I did a bit of thinking, and… Maybe it’s 1 of two things:
1, I probably messed up with the scene tree that the Steve scene is in, shown here:

I’m not sure, though. My 2nd thought is that, what if it’s the fact my code isn’t correctly poking the Animation Tree to get the animations from the Animation Player? If it works as base without adding any extra code, then it’s something I’m not noticing, but if it only works with the extra things you added in brackets on your end of the code, then… Perhaps its simpler than what we thought?

What do you mean by definition, by the way? Like how it’s set up when I click from Animplayer to AnimTree? Or just how the code was set up?

also, in the screenshot here, why does your animation tree have a Start but no End?

Shouldn’t matter, all of the player code is self-contained only accessing children of the player, your Player_Steve is instantiated correctly.

What does this mean? What extra things did I add in brackets?

Your second screenshot only shows the var AnimationPlayer warnings, you can remove that line 22 entirely, it’s an unused variable that also happens to shadow a native class name. Does the program work without errors?


This is a variable definition, it starts with var, only the code.

var animationTree: AnimationTree

My screenshot is cropped, it has an End that I do not connect anything to since it should always be playing “Idles 2” or “Walks”

1 Like

We’re getting somewhere!

I disconnected everything from End, 'cause I wanted it to go back to Idle, and…

image

image

	var animationPlayer = $AnimationPlayer
	#Tried, didn't give infoprint(get_path())
	print_tree()
	animationTree = $AnimationTree
	animationState = animationTree.get("parameters/playback")
	animationState.travel("Idles 2")

above is the code block that it’s having errors with, mainly the last line of the animation Idles 2 not working.

Looking into it, um… The AnimationPlayer scene in the Steve scene has… Nothing.

But in the main Steve scene, it has data. Could… That be the issue?

Seems like a bad way to set up the animation data as a seperate scene since it will be hard to edit, but this is the AnimationPlayer which has little relevance to the script error about using the AnimationTree.

The error states that this line results in null, your screenshot shows an AnimationTree with a valid “parameters/playback” are you sure this is the child AnimationTree?

animationState = animationTree.get("parameters/playback")

Another thing to note is that an AnimationTree could be set to start on “Idles 2”, yours already is (if you remove the line straight from Start → End), this travel line isn’t needed in the first place.

1 Like

I was trying to follow a tutorial on how to do this, but then everything kept breaking apart as I worked. Do… I have to reparent the AnimationTree under Animation Player?

When I hover over the Advance expression base node, it shows this:
image

But if I hover over Anim player’s “animation player”, it does this:
image

…Also if I capitalize the A in the AnimationTree, it tells me the get function won’t work.

I swear I’m trying. ;n;

The parent/child relationship isn’t so important as long as the animation tree can find a path to the animation player, which it can.

The Advance Expression Base Node is for automatic travel lines using regular GDScript for Advance conditions, it won’t cause this error in your script, usually this will be linked to the root node of the scene. It probably isn’t relevant. The dot . means “self” it will try to run expressions based on the animation tree.

The Anim Player path is ../ meaning to go up, then down to AnimationPlayer, representing a sibling path. This sounds correct too, I also doubt it has to do with the error getting "parameters/playback".

If you capitalize “AnimationTree” then it’s no longer operating on your variable, it’s trying to operate on the entire Type: AnimationTree, which must be instanced to use the non-static get function. Since you want to operate on the real AnimationTree that exists in your scene tree, you do not want to use capital A AnimationTree.


Have you tried just removing the animationState.travel("Idles 2") line? I’m confident it isn’t needed for your AnimationTree to start at “Idles 2”.

The error is very strange, it seems like a simple error, but I think we must be looking in the wrong place. Is there any way you could upload your project or this scene?

1 Like

I haven’t yet- I’ll give it a shot.


Rebounded back to an old error:


Mind if I upload the project personally to you? If you’re up for helping me figure this out, I’d like to post the solution after to this post so others don’t get hampered like I have.

1 Like

You can DM me the project sure.

This is a new error, the animationTree can’t use travel, but animationState.travel does work; assuming it isn’t null. But you also cannot travel to a “blend_position”, maybe this line is supposed to be a set function.

animationTree.set("parameters/Idles 2/blend_position", Vector2.ZERO)
1 Like