I was making a game where there’s an explosion that happens whenever the grenade timer expires or it hits an enemy, but it uses the clunkiest system I have ever made and I get the error: Invalid access to property or key ‘Runner:<CharacterBody3D#58552485650>’ on a base object of type ‘Array[Node3D]’.
Here’s the code:
func explode():
var hitcheck_big:Array[Node3D] = $InitialBlast.get_overlapping_bodies()
var hitcheck_small:Array[Node3D] = $SmallBlast.get_overlapping_bodies()
for i in hitcheck_small:
var chicken = hitcheck_small[i]
if chicken is CharacterBody3D:
if chicken.is_in_group("hostile") or chicken.is_in_group("player"):
chicken.hurt(50)
for i in hitcheck_big:
var chicken = hitcheck_big[i]
if chicken is CharacterBody3D:
if chicken.is_in_group("hostile") or chicken.is_in_group("player"):
chicken.hurt(100)
var instance = explosion.instantiate()
instance.global_position = global_position
instance.transform.basis = Basis(Vector3.RIGHT, Vector3.UP, Vector3.BACK)
get_parent().add_child(instance)
Thank you for your help!