User talk:AlexTMjugador: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "== Hello from Lex128 regarding getPedMaxHealth == If you said that you tested your code ok! I tested too on empty server and results of console: <table><tr><td><syntaxhighlight lang="lua"> start ru...")
 
Line 43: Line 43:
max(1, 100 + (1000 - 569) / 4.31) = 200 hp (is true)
max(1, 100 + (1000 - 569) / 4.31) = 200 hp (is true)
</pre></td></tr></table>
</pre></td></tr></table>
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. --[[User:AlexTMjugador|AlexTMjugador]] ([[User talk:AlexTMjugador|talk]]) 16:53, 21 July 2014 (UTC)

Revision as of 16:53, 21 July 2014

Hello from Lex128 regarding 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)

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. --AlexTMjugador (talk) 16:53, 21 July 2014 (UTC)