Jump to content

rpg gaming script modification help


PJ droopy pants

Recommended Posts

I am trying to change the code in my script to make it where the users experience points reset back at 0 each time the user levels instead of the experience point accumulating like it does now. I am doing this because I am adding a status bar that shows percent to next level and the way it is now it starts at around 80% after lvl 2. Thank you for any help you can offer and I will post the code that I have.

 

//level 2 - 500

//level 3 - 1500

//level 4 - 3500

//level 5 - 6000

function experience($L) {

  $a=0;

  $end=0;

  for($x=1; $x<$L; $x++) {

    $a += floor($x+1500*pow(4, ($x/7)));

  }

  return floor($a/4);

}

function Get_The_Level($exp) {

  $a=0;

  $end =0;

  for($x=1; ($end==0 && $x<100); $x++) {

    $a += floor($x+1500*pow(4, ($x/7)));

    if ($exp >= floor($a/4)){

} else {

  return $x;

  $end=1;

}

  }

}

function Get_Max_Exp($L){

$end=0;

if ($exp == 0){

return 457;

$end =1;

  }

for($L=1;($L<100 && $end==0);$L++) {

  $exp = experience($L);

  //echo $exp;

  if ($exp >= $user_class->exp){

	return $exp;

	$end=1;

  }

}

}

.

 

Link to comment
https://forums.phpfreaks.com/topic/136896-rpg-gaming-script-modification-help/
Share on other sites

That is what it is doing now. For example, when a users reaches the lvl 4 threashold the have 3500/3500 experiance points and that is 100% then it lvls them up to lvl 5 with this result 3500/6000. So the satus bar shows 58% to next lvl. I would like that to be 0%. So i was trying to figure out how to reset the exp back to 0 when lvl is reached. So it would be 0/2500 to lvl 5.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.