tonyd Posted May 5, 2011 Share Posted May 5, 2011 Hello everyone, I am having trouble with experience from attacks that equal more than 100% I talked to Djkanna and he helped me out with the image bar going over 100% But I would like to have the exp go directly into levels so the user does not have to refresh for the credit to level. I have searched the forums and google extensivley and even tried editing the header file with no luck... has anyone else experienced this.. Its a paid version of v2.o3 Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 5, 2011 Share Posted May 5, 2011 For the part where users dont refresh, think you would run it with a javascript code, I have yet seen one on this forum.. as for exp going into levels that is kind of stupid, why would you want your players to level quickly? if your wanting them to level quickly just update the level in a query it's that simple!! Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted May 5, 2011 Share Posted May 5, 2011 I dont see what the problem would be with refreshing. For example they are always going to level up as soon as they go to any other page or continue doing what ever it is they are doing. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted May 5, 2011 Share Posted May 5, 2011 For the part where users dont refresh, think you would run it with a javascript code, I have yet seen one on this forum.. as for exp going into levels that is kind of stupid, why would you want your players to level quickly? if your wanting them to level quickly just update the level in a query it's that simple!! I think the poster means, rather than displaying over 100% exp just automatically update the level instead. A way this could be done is after crediting them their exp just call the check_level(); function again. Quote Link to comment Share on other sites More sharing options...
tonyd Posted May 5, 2011 Author Share Posted May 5, 2011 Should I call the check level function in the attack leave file? Or could I add it to the header file? I have a few level 20 guys that can beat a level hundred so when they get exp from him the return is above 100% Thanks for the help I'm going to try creating a link for the results page that includes check level if exp is greater than 100 Quote Link to comment Share on other sites More sharing options...
Djkanna Posted May 5, 2011 Share Posted May 5, 2011 Call it after the exp is given in the Attack leave file. Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted May 5, 2011 Share Posted May 5, 2011 oh ok automatic leveling didn't read it like that... Thought he wanted to give the player a level for each time experience is gained...my bad. Quote Link to comment Share on other sites More sharing options...
tonyd Posted May 5, 2011 Author Share Posted May 5, 2011 I tried to add the global function and check level to attack leave . With no results I'm not sure if its due to the percentage calculations. Should I create an experience equals level table and base the experience gained and submit it to that database? I'm really stuck on this. I think it will be a rare occasion that a player will gain over 100% needed for next level but it is possible. Quote Link to comment Share on other sites More sharing options...
tonyd Posted May 8, 2011 Author Share Posted May 8, 2011 I've tried adding Check_level() to no avail. In my globals should the check_level ()<---- curly brackets be empty? If not would it be correct to add experc or exper? This is what the globals looks like now 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"); } Quote Link to comment Share on other sites More sharing options...
sniko Posted May 8, 2011 Share Posted May 8, 2011 Curly brackets should be empty as no parameters are being passed. Quote Link to comment Share on other sites More sharing options...
tonyd Posted May 8, 2011 Author Share Posted May 8, 2011 Thank you PHP is new to me, Basically what im trying to do is have the home index page refresh and calculate total experience gained.. if that makes sense. I created a weapon that does a lot of damage so attacking a level 100 player nets over 100% experience, if experience =300% you would have to refresh home 3 times. I tried to call check_level in index and it still requires you to refresh. If you call a global function in the index? is the correct format $check_level (); Quote Link to comment Share on other sites More sharing options...
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.