diff --git a/game/player/NamePlate.gd b/game/player/NamePlate.gd index dc84eaa0..834755ad 100644 --- a/game/player/NamePlate.gd +++ b/game/player/NamePlate.gd @@ -46,7 +46,7 @@ var health_bar_label : Label = null var entity : Entity = null var health : EntityResource = null -func _ready(): +func _enter_tree(): name_label = get_node(name_label_path) as Label health_bar = get_node(health_bar_path) as TextureProgress health_bar_label = get_node(health_bar_label_path) as Label @@ -126,6 +126,7 @@ func c_health_changed(stat : EntityResource) -> void: if stat.max_value == 0: health_bar.max_value = 1 health_bar.value = 0 + return health_bar.max_value = stat.max_value health_bar.value = stat.current_value diff --git a/game/ui/unitframes/UnitframeBase.gd b/game/ui/unitframes/UnitframeBase.gd index 8eccae4a..be428ae7 100644 --- a/game/ui/unitframes/UnitframeBase.gd +++ b/game/ui/unitframes/UnitframeBase.gd @@ -133,8 +133,16 @@ func cname_changed(entity: Entity) -> void: func clevel_changed(entity: Entity, value : int) -> void: _level_text.text = str(_player.ccharacter_level) + var xpreq : int = ESS.get_resource_db().get_xp_data().get_character_xp(_player.ccharacter_level) + + if xpreq == 0: + _xp_range.value = 0 + _xp_range.min_value = 0 + _xp_range.max_value = 1 + return + _xp_range.min_value = 0 - _xp_range.max_value = ESS.get_resource_db().get_xp_data().get_character_xp(_player.ccharacter_level) + _xp_range.max_value = xpreq func notification_cxp_gained(entity: Entity, val: int) -> void: _xp_range.value = _player.ccharacter_xp