User talk:AlexTMjugador

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

Talk about getPedMaxHealth

If you said that you tested your code ok! I tested too on empty server and results of console:

start runcode
-- start: Resource 'runcode' started
run p = getRandomPlayer()
-- Command executed!
run setPedStat(p, 24, 0); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 1 [number]
run setPedStat(p, 24, 100); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 1 [number]
run setPedStat(p, 24, 500); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 83 [number]
run setPedStat(p, 24, 569); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 100 [number]
run setPedStat(p, 24, 900); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 176 [number]
run setPedStat(p, 24, 1000); setElementHealth(p, 200)
run getElementHealth(p)
-- Command results: 200 [number]
OK! Now try calculate with your formula:
100 * 0 / 569 = 0 hp (hmm.. not true)
100 * 100 / 569 = 17 hp (not true)
100 * 500 / 569 = 87 hp (not true)
100 * 569 / 569 = 100 hp (wow! right!)
100 * 900 / 569 = 158 hp (not true)
100 * 1000 / 569 = 175 hp (not true)

And now use formula from MTA sources:

max(1, 100 + (0 - 569) / 4.31) = 1 hp (yes, is true)
max(1, 100 + (100 - 569) / 4.31) = 1 hp (is true)
max(1, 100 + (500 - 569) / 4.31) = 83 hp (is true)
max(1, 100 + (569 - 569) / 4.31) = 100 hp (is true)
max(1, 100 + (900 - 569) / 4.31) = 176 hp (is true)
max(1, 100 + (1000 - 569) / 4.31) = 200 hp (is true)

--Lexr128 (talk) 10:16, 21 July 2014 (UTC)

It is tested in singleplayer with aid of savegame editors, but whatever. In singleplayer with a 1000 stat you don't have exactly 200 health, even doing the paramedic side missions. It's a bit logical that if you start with 569 stat 1000 stat isn't double health, considering how other stats are applied and even rendered in GTA: SA. I thought that it was like in original GTA: SA. --AlexTMjugador (talk) 16:53, 21 July 2014 (UTC)