Jump to content
MakeWebGames

EXP level goes past 100% and breaks design


Recommended Posts

Re: EXP level goes past 100% and breaks design

for display purposes you could also do check for 100% for example

if($exp>100%)

{

$exp=100%;

}

*not a working fix, just an example, this wouldn't actually change their experience, it would just prevent the bar from going over 100%

Link to comment
Share on other sites

Re: EXP level goes past 100% and breaks design

won't the '%' give an error in php?

Well, try this:

$experc=(int) ( $ir['exp']/$ir['exp_needed']*100);
$exopp=100-$experc;

if ($experc > 100){
$var['exp'] = ($experc/100);
list($exp,$the_rest) = burst('.',$var['exp']);
echo '[img=bar.gif]X' . $exp;

It works in theory.

It will output:

|__________|X5

Please correct me if i'm wrong.

Link to comment
Share on other sites

Re: EXP level goes past 100% and breaks design

yes it will, thats why I added that what i posted won't work just an eample

for it work it would have to be more like the following

if($exp > $expneeded)

{

$exp=$expneeded;

}

* This would return $exp as being 100% for displaying, like before this probably won't actually work on the game unless you change the variables to what you use and maybe some slight other modifications. It is just an example to point you in the right direction, hope it helps.

Link to comment
Share on other sites

Re: EXP level goes past 100% and breaks design

in theory $expneeded shouldn't exceed 100%, it should always equal 100%.

I may be wrong, but if $exp > $expneeded, then do the leveling stuff. . .

with each level gained $expneeded raises for that account which creates a new 100% mark for that account.

Just a note, i know $expneeded can be greater than 100 but I was using it like a percent. Basically calling $expneeded=100% of experience needed to level, so if $exp > $expneeded that means the $exp is greater than 100% of $expneeded.

If I actually had the mc codes I could probably explain it more than what I did. It appears you have them so +1 on the assist ;)

Both examples yield the same results, i think (not tested). Mine is just more generic, yours looks more workable on a live system

Link to comment
Share on other sites

Re: EXP level goes past 100% and breaks design

around this line somewhere. . .

$experc=(int) ( $ir['exp']/$ir['exp_needed']*100);

I don't own a version of mc codes, but that line is from the header of mccodes lite, can somebody else give better detail?

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...