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
asked Jul 15 in Engine by Comet (61 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) ).

answered Jul 15 by Ertain (782 points)
selected Jul 15 by Comet

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.