Edit state is only for editors, does not work without tools compiled.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Will_25

I don’t understand what the error!

Can you upload a minimal reproduction project somewhere (e.g. to a GitHub repository) and link to it here? We need more context to be able to help.

Calinou | 2022-01-20 21:45

I don’t really know how to do but maybe I can give you what is the error and the line of code that not work.

ERROR: Edit state is only for editors, does not work without tools compiled.
at: (scene/resources/packed_scene.cpp:1642)
SCRIPT ERROR: Attempt to call function ‘Normal’ in base ‘null instance’ on a null instance.
at: Normal_state (res://Player/Ketchup.gdc:86)

Code at line 86:

var Bullet = preload(“res://Bullet/Bullet.tscn”)
onready var animationTree = $AnimationTree
onready var animationPlayer = $AnimationPlayer
onready var animationState = animationTree.get(“parameters/playback”)
onready var ray = $RayCast2D
onready var shootingPosition = $ShootingPosition
onready var ShotGunPosition1 = $ShotGunPosition1
onready var ShotGunPosition2 = $ShotGunPosition2
onready var ShotGunPosition3 = $ShotGunPosition3
onready var hitbox = $HitBox
onready var Facher = $Facher

func _ready():
animationTree.active = true
stats.connect(“no_health”, self, “queue_free”)
position = position.snapped(Vector2(tile_size, tile_size))
last_position = position
target_position = position

func _physics_process(delta):
match state:
MOVE:
move_state(delta)

func shooting_state():
if Ketchup.shootingType == 0:
Shoot = Normal
elif Ketchup.shootingType == 1:
Shoot = ShotGun
elif Ketchup.shootingType == 2:
Shoot = SuperFire

match Shoot:
	Normal:
			#audioShooting.play()
			animationState.travel("Shooting")
			hitbox.set_deferred("monitorable", false)
	ShotGun:
			#audioShooting.play()
			animationState.travel("ShotGun")
			hitbox.set_deferred("monitorable", false)
	SuperFire:
			#audioShooting.play()
			animationState.travel("SuperFire")
			hitbox.set_deferred("monitorable", false)

#func shoot():
#match Shoot:
#Normal:
# Normal()
#ShotGun:
# ShotGun()
#SuperFire:
# SuperFire()

func Normal_state():
#audioShooting.pitch_scale = 0.6
#audioShooting.play()
hitbox.set_deferred(“monitorable”, false)
shooting_state()
var bullet = Bullet.instance(1)
bullet.BulletType = Normal
bullet.scale.x = 1
bullet.scale.y = 1
get_parent().add_child(bullet)
bullet.position = shootingPosition.global_position

Will_25 | 2022-01-20 22:37