0 votes

(Sorry for my english i'm using google translator)
I got this error "Invalid type in built-in function 'set_value' in base" ProgresBar ". Cannot convert argument 1 from float to String."

extends CanvasLayer

onready var hp = experion.hp

func _input(event):
    if event.is_action_pressed('ui_focus_next'):
    hp -= 10
    pass

func _physics_process(delta):
    get_node("Control/Healbar").set_value(hp)
    if hp >= 1:
         hp += delta * 0.6
in Engine by (60 points)

I feel there may be something wrong with your error message. Right Click and Copy it.

1 Answer

0 votes
Best answer

The variable in the function set_value() seems to think the argument that you are using is a string type. Try casting the value to a float type, i.e. set_value( float(hp) ).

by (2,464 points)
selected by

error: invalid operands 'String' and 'int' in operator '>='

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.