Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

How do i fix the Head Icons of my Custom Healthbar? #13445

Description

@Ramiro0045

Describe your problem here.

Basically, im trying to port my mod that was made in 0.6.3 to 0.7.1h
but the healthbar changed a lot code wise, which made it so im unable to fix the head icons
or at least use updateHitbox('healthBar'); to fix it

so, how do i fix it in psych engine 0.7.1h?
Screenshot_21
Screenshot_22

this is how my HealthBar Script in lua looks like

-- Originally Made by Misha21220
-- Edited by ItzJiggzy

-- It Only "works" in Psych Engine 0.7.X

function onCreate()
	if getPropertyFromClass('backend.ClientPrefs', 'data.zerothCustomHealthbar') and not hideHud then
		customHealthBar_Border()
		customHealthBar_Stats()
	end
end

function onCreatePost()
	if getPropertyFromClass('backend.ClientPrefs', 'data.zerothCustomHealthbar') and not hideHud then
		customHealthBar_FlxBar()
		-- customHealthBar_Icons()
	end
end

function customHealthBar_Border()
-- Border
	makeLuaSprite('HealthBarBorder', 'ZerothBarBorderAlt')
	setObjectCamera('HealthBarBorder', 'hud')
	setProperty('HealthBarBorder.alpha', getPropertyFromClass('backend.ClientPrefs', 'data.healthBarAlpha'))
	scaleLuaSprite('HealthBarBorder', 0.8, 0.8)
	screenCenter('HealthBarBorder', 'x')
	setProperty('HealthBarBorder.y', getProperty('healthBar.y') - 108)
	addLuaSprite('HealthBarBorder', true)
	
	-- if downscroll then
		-- setProperty('HealthBarBorder.y', getProperty('healthBar.y') - 66)
		-- setProperty('HealthBarBorder.flipY', true)
	-- end
end

function customHealthBar_Stats()
-- Stats
	makeLuaSprite('HealthBarStats', 'ZerothBarStats')
	setObjectCamera('HealthBarStats', 'hud')
	setProperty('HealthBarStats.alpha', getPropertyFromClass('backend.ClientPrefs', 'data.healthBarAlpha'))
	scaleLuaSprite('HealthBarStats', 0.8, 0.7)
	screenCenter('HealthBarStats', 'x')
	setProperty('HealthBarStats.y', getProperty('healthBar.y') + 25)
	addLuaSprite('HealthBarStats', true)
	-- if downscroll then
		-- setProperty('HealthBarStats.y', getProperty('healthBar.y') + 43)
	-- end
end

function customHealthBar_FlxBar()
local centeredFlxBar = 204 - (getProperty('healthBar.width') / 2)
-- flxBar -- Needs Fixing
	scaleObject('healthBar', 1.45, 4.3)
	-- screenCenter('healthBar', 'x')
	setProperty('healthBar.y', getProperty('healthBar.y') - 45)
	setProperty('healthBar.x', centeredFlxBar);
	-- updateHitbox('healthBar');
end

-- Dont know why i felt proud/satisfied on like this thingy, when it basically others guy code but with my textures

and also, this are the Textures that is using, even tho they are not connected to the actions of the flxBar or the Head Icons

HealthBarBorder:
ZerothBarBorderAlt

HealthBarStats:
ZerothBarStats

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

Yes, I edited a ClientPrefs.hx to add custom options and Playstate.hx to change the healthbarImage without affectting the original healthbar, also Achievements but that doesnt have anything to do with this issue, i didnt change anything on HealthIcon.hx or any of the maths related to the Healthbar or the Head Icons

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions