RedZone Posted April 6, 2009 Posted April 6, 2009 I got a question this is VERY annoying. My game has bunnys on it like level 2000 players and when like level 5's beat the level 2000 to gain EXP/Levels every time they click on something they go up 1 level till they catch up to the amount of exp gained. Any ideas how to fix this? I wanna be able to show the right level the first time. Quote
Lithium Posted April 6, 2009 Posted April 6, 2009 Re: Levels hmmm a level 5 can beat a level 2000? that is not good! Also, i think there's a "level upgrade mod" floating around these forums. If i remember correctly, it simply makes you jump to the correct level, according your experience. Quote
rulerofzu Posted April 6, 2009 Posted April 6, 2009 Re: Levels Happens in a lot of games. Player keeps their stats low but plays the game for a long time to become high lvl bunny not much you can do about that. The problem you have is that $ir is controlling the update which as you mention doesnt update instantly and waits for the user to click click click You should be able to remedy this in global_func.php find 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']) { $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']+=50; $ir['maxhp']+=50; $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+50,maxhp=maxhp+50 where userid=$userid"); } } add into it $update_ir="true"; and before the db query if ($update_ir==true) so like this .... if ($update_ir=="true") { $db->query("UPDATE users SET level=level+1,exp=$expu,energy=energy+2,brave=brave+2,maxenergy=maxenergy+2,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid"); } it should work ...i use a different leveling code so thats not tested on the original code. Quote
Strats Posted April 7, 2009 Posted April 7, 2009 Re: Levels You should just make the money strong as hell lmao Quote
MaKaVeLLi Posted April 8, 2009 Posted April 8, 2009 Re: Levels I got a question this is VERY annoying. My game has bunnys on it like level 2000 players and when like level 5's beat the level 2000 to gain EXP/Levels every time they click on something they go up 1 level till they catch up to the amount of exp gained. Any ideas how to fix this? I wanna be able to show the right level the first time. Go into your global file as they stated below your first post and you can just add in a "while" statement. This will make a player jump to the correct level on the very next click no matter how many levels they need to catch up to their EXP gain. Quote
AlabamaHit Posted April 8, 2009 Posted April 8, 2009 Re: Levels it does that cuase if they are gaingin more than 1 level per attack......They are gaingin TO much........simple as that.. Quote
rscott4581 Posted April 9, 2009 Posted April 9, 2009 Re: Levels Happens in a lot of games. Player keeps their stats low but plays the game for a long time to become high lvl bunny not much you can do about that. The problem you have is that $ir is controlling the update which as you mention doesnt update instantly and waits for the user to click click click You should be able to remedy this in global_func.php find 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']) { $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']+=50; $ir['maxhp']+=50; $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+50,maxhp=maxhp+50 where userid=$userid"); } } add into it $update_ir="true"; and before the db query if ($update_ir==true) so like this .... if ($update_ir=="true") { $db->query("UPDATE users SET level=level+1,exp=$expu,energy=energy+2,brave=brave+2,maxenergy=maxenergy+2,maxbrave=maxbrave+2, hp=hp+50,maxhp=maxhp+50 where userid=$userid"); } it should work ...i use a different leveling code so thats not tested on the original code. All this is doing is the exact same thing it was doing... click, click, click, click..... it still has a SET level=level+1 so if 5 levels is jumped, it still takes the clicks to remedy it Quote
rulerofzu Posted April 9, 2009 Posted April 9, 2009 Re: Levels yeah well thats what i put in 'my' leveling code to resolve the problem which. As i stated. Quote
AlabamaHit Posted April 9, 2009 Posted April 9, 2009 Re: Levels if you look at the code you will see why you have to click so much... It's obvious. You have to becuase that function runs every page load.(Click). And it only updates 1 level at time. Quote
rscott4581 Posted May 8, 2009 Posted May 8, 2009 Re: Levels OK I know there is a better way but this works absolutely and without fail, no more click click click... Pay close attention to my exp needed calculation is changed from the original, just swap that out for yours. find this if($ir['exp'] >= $ir['exp_needed']) { $expu=$ir['exp']-$ir['exp_needed']; $ir['level']+=1; $ir['exp']=$expu; $ir['energy']+=1; $ir['brave']+=1; $ir['maxenergy']+=1; $ir['maxbrave']+=1; $ir['hp']+=50; $ir['maxhp']+=50; $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*2.2); $db->query("UPDATE users SET level=level+1,exp=$expu,energy=energy+1,brave=brave+1,maxenergy=maxenergy+1,energy=maxenergy,maxbrave=maxbrave+1, hp=hp+50,maxhp=maxhp+50,hp=maxhp where userid=$userid"); event_add($ir['userid'],"You just Gained a Level!"); } Underneath it past this, notice the string sequence, this allows for 1 more level for each one added but change the strings in sequence to match up, otherwise it won't work, now some of you that has a better way feel free to post it, but for now this solves the problem of the clicks. $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*2.2); if($expu >= $ir['exp_needed']) { $expa=$expu-$ir['exp_needed']; $ir['level']+=1; $ir['exp']=$expa; $ir['energy']+=1; $ir['brave']+=1; $ir['maxenergy']+=1; $ir['maxbrave']+=1; $ir['hp']+=50; $ir['maxhp']+=50; $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*2.2); $db->query("UPDATE users SET level=level+1,exp=$expa,energy=energy+1,brave=brave+1,maxenergy=maxenergy+1,energy=maxenergy,maxbrave=maxbrave+1, hp=hp+50,maxhp=maxhp+50,hp=maxhp where userid=$userid"); event_add($ir['userid'],"You just Gained a Level!"); } After adding that one it will jump 2 levels now per click if you have enough XP built up to do so... Add the third underneath that and it jumps 3 levels per click: $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*2.2); if($expa >= $ir['exp_needed']) { $expb=$expa-$ir['exp_needed']; $ir['level']+=1; $ir['exp']=$expb; $ir['energy']+=1; $ir['brave']+=1; $ir['maxenergy']+=1; $ir['maxbrave']+=1; $ir['hp']+=50; $ir['maxhp']+=50; $ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*2.2); $db->query("UPDATE users SET level=level+1,exp=$expb,energy=energy+1,brave=brave+1,maxenergy=maxenergy+1,energy=maxenergy,maxbrave=maxbrave+1, hp=hp+50,maxhp=maxhp+50,hp=maxhp where userid=$userid"); event_add($ir['userid'],"You just Gained a Level!"); } Some of you view this as simple etc, it works, plain and simple. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.