[SOLVED] playing a random sound after the previous one stops?
hi i'm new to Godot. this is my first day with the engine and my coding skills are very poor. i'm trying to play a random sound when the previous one stops, but i can't make it. i got a "control" node and 4 audiostreamplayer nodes as childs, "s1", "s2", "s3" and "s4". my control node code is this:
var a = RandomNumberGenerator.new()
var sound = 0
var sound = a.randi_range(1,4)
if get_node("s"+str(sound)).is_active == false:
the first part of the code works... it randomly plays one of the 4 sounds at the beginning of the scene. i don't now if this is the best way to do it, but it's the way that i found :P
the problem is that i can't make that when that first sound stop, another one start. the conditional "if get_node("s"+str(sound)).is_active == false:" give me the error "invalid get index 'is_active' (on base: null instance)"
probably is a very noob mistake...