Jump to content
MakeWebGames

Level/health ratio


Dazza

Recommended Posts

Re: Level/health ratio

Full Function

 

function check_level()
{
global $db;
global $ir,$c,$userid;
$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
if($ir['exp'] >= $ir['exp_needed'])
{
$newhp=round(($ir['level']*.05)+50);
$expu=$ir['exp']-$ir['exp_needed'];
$ir['level']+=1;
$ir['exp']=$expu;
$ir['energy']+=2;
$ir['brave']+=2;
$ir['maxenergy']+=2;
$ir['maxbrave']+=2;
$ir['hp']+=$newhp;
$ir['maxhp']+=$newhp;
$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);
$db->query("UPDATE users SET level=level+1,exp=$expu,energy=energy+2,brave=brave+2,maxenergy=maxenergy+2,maxbrave=maxbrave+2,
hp=hp+$newhp,maxhp=maxhp+$newhp where userid=$userid");
}
}
Link to comment
Share on other sites

Re: Level/health ratio

Just to confirm for others this works beautifully:

Open global_func.php

Find

$ir['maxhp']+=$newhp;

Add this under

$newhp=abs(($ir['level']*50)+(($ir['level']*50)*.10));

$newhp=round($newhp);

This gives the normal extra 50hp per level plus 10%

If you alter the .10 to whatever you want i.e you could have .20 for 20%

Savager done all the work on this, I just tested it - Top man and top mod!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...