Open mcNuggets1 opened 6 months ago
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
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.
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.
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
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.
This is taking up a lot of performance however. A setter would be better.
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