Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetHealthHudDisplayValues does nothing or corrupts the health bar #2539

Open
mcNuggets1 opened this issue May 14, 2024 · 5 comments
Open

SetHealthHudDisplayValues does nothing or corrupts the health bar #2539

mcNuggets1 opened this issue May 14, 2024 · 5 comments
Labels
bug FxDK FxDK issues triage Needs a preliminary assessment to determine the urgency and required action

Comments

@mcNuggets1
Copy link

What happened?

There is no real documentation of SetHealthHudDisplayValues.
I found two seperate ways of using it. None of it works.

SetHealthHudDisplayValues(100, 100, false)
Does nothing.
Tried this: SetMaxHealthHudDisplay(1000)
Des nothing.
Tried with floats, instead of numbers, that just made the bar go invisible.

The only documentation I found told me, that the native only needs to be called once and then needs to be undone with setting health to -1.
None of that besides resetting health to -1 works.

Expected result

It would change the value to the specified

Reproduction steps

SetHealthHudDisplayValues(40, 100, false)

Importancy

Unknown

Area(s)

FiveM, FXServer, FxDK, OneSync, Natives

Specific version(s)

FiveM b3095

Additional information

No response

@mcNuggets1 mcNuggets1 added bug triage Needs a preliminary assessment to determine the urgency and required action labels May 14, 2024
@github-actions github-actions bot added the FxDK FxDK issues label May 14, 2024
@AdrianIsBored
Copy link

I believe you may alternatively directly call functions on the minimap scaleform to achieve something similar, e.g. SET_PLAYER_HEALTH: https://vespura.com/fivem/scaleform/#MINIMAP

@Mathu-lmn
Copy link

This native looks like some kind of override as I tried taking damage after using the native, and my HP stayed the same under the minimap.
I believe this native is not achieving the described goal.

After testing, it looks like it just makes the health bar red if the first argument is not -1. And makes the health bar green again after passing -1 as the first argument.
The second parameter and the boolean have no impact at all on this native.

@mcNuggets1
Copy link
Author

This native is for overriding visual health on the healtbar apparently, it doesn't really do that however.

And yeah the only function it has, is to seemingly bug out the healthbar.

@Mathu-lmn
Copy link

Yeah I first wrote what the native was "supposed" to do hahah
And yeah the only usage is to make the health bar red or green. I think it's worth opening a thread on the forums for such issue

@mcNuggets1
Copy link
Author

function UpdateHealthbar(minimapScaleform)
local health = GetLocalPlayerHealth()

BeginScaleformMovieMethod(minimapScaleform, "SET_PLAYER_HEALTH")
ScaleformMovieMethodAddParamInt(health)

if lastHealth > health then -- Was added?
	ScaleformMovieMethodAddParamBool(true)
else
	ScaleformMovieMethodAddParamBool(false)
end

local gameTimer = GetGameTimer()
if lastMaxHealthUpdate < gameTimer then
	lastMaxHealthUpdate = gameTimer
	maxHealth = GetLocalPlayerMaxHealth()
end

ScaleformMovieMethodAddParamInt(maxHealth)

if GetLastDamageTime() > lastDamageDrawn then -- Show hurt damage
	lastDamageDrawn = GetLastDamageTime()
	ScaleformMovieMethodAddParamBool(true)
else
	ScaleformMovieMethodAddParamBool(false)
end

EndScaleformMovieMethod()

end

I did follow your advice and finally got dis stuff working.
I hope you dont mind my extra code I didn't remove.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug FxDK FxDK issues triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

3 participants