Pulse Works Studio

Parse Error: Identifier "rand_range" not declared in the current scope.

rand_range was removed. Use randf_range for floats and randi_range for integers.

Cause

Godot 3's rand_range() always returned a float. Godot 4 split it into randf_range() and randi_range() so an integer roll is not an accident. The old name is not declared, so the call never type-checks.

Fix

func roll_damage() -> int:
	return randi_range(2, 6)

func scatter() -> float:
	return randf_range(-8.0, 8.0)

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.