Jump to content

more help needed.


seany123

Recommended Posts

what im trying to make a game... and basically everytime a player levels up his maxexp (amount of exp till next level) goes up to make it harder each time to gain a level.

 

i actually do have like a written down a amount of exp for every level..

 

my current tactic to make this happen is to go to every query which updates the players level and add the code in...

 

except my problem is im going to have like 2000 lines just for this... for example...

 

 

if($player->level == 1){

update ($player->maxexp == 5000);

}

 

else if($player0>level == 2){

update ($player->maxexp == 12,000);

}

 

and so on,

 

can anybody suggest a better more efficient way of doing this???

Link to comment
Share on other sites

How many levels are there and does the maxexp go up in a pattern (fore example goes up 7000 per level)

 

You could do

if($player->level == 1)
{
   update ($player->maxexp = 5000);
}
else
{
    $nextMaxEP = 5000 + (7000 * $player->level);
    update ($player->maxexp = $nextMaxEP);
}

Link to comment
Share on other sites

I doubt it will go up 7k each level, seeing first level only has 5k points. and most games u need like double the xp for each level u gain.

 

i think ur best bet it to put the "player level" and "MaxExp" value's into an array.

and when a player levels up, run through the array and execute the update player function with the assigned value's

 

$array = array(	"1"=>"5000"	,
	"2"=>"12000"	,
	"3"=>"23000"	);

foreach($array as $level => $max_exp){
if($player_level == $level){                            // $player_level has to have the player level as value ofcourse to work
	update ($player->maxexp = $max_exp);
}
}

Link to comment
Share on other sites

yeah the exp does go up in a pattern to a certain extent...

 

 

like say from level 1 - level 20 the increase per level will be the same, then at level 21 the increase will be larger.... for 20 levels.

 

im eventually planning for 500-1,000 levels.

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

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

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.