Jump to content
MakeWebGames

Recommended Posts

Posted

hi all, im wondering how do you make it harder to levelling up when you attack someone and leave them? heres the script, could someone edit it for me please to make it give out less experience? i dont wanna mess it up lol.

 

<?php
$atkpage=1;
include "globals.php";

$_GET['ID'] = abs(intval($_GET['ID']));
$_SESSION['attacking']=0;
$ir['attacking']=0;
$db->query("UPDATE users SET attacking=0 WHERE userid=$userid");
$od=$db->query("SELECT * FROM users WHERE userid={$_GET['ID']}");
if($_SESSION['attackwon'] != $_GET['ID'])
{
die ("<font color=white>Cheaters don't get anywhere.");
}
if($db->num_rows($od))
{
$r=$db->fetch_row($od);
$gq=$db->query("SELECT * FROM gangs WHERE gangID={$r['gang']}");
$ga=$db->fetch_row($gq);
if($r['hp'] == 1)
{
print "<font color=white>What a cheater u are.";
}
else
{
print "<font color=white>You beat {$r['username']}

";
$qe=$r['level']*$r['level']*$r['level'];
$expgain=rand($qe/2,$qe);
$expperc=(int) ($expgain/$ir['exp_needed']*100);
print "<font color=white>You took {$r['username']} to the attacking rating company.



The owners of the attacking rating company said welldone for beating this person you gained



$expperc EXPERIENCE!



You then went home and told your mum of your achievement!";
$hosptime=rand(10,20);
$db->query("UPDATE users SET exp=exp+$expgain WHERE userid=$userid");
$db->query("UPDATE users SET hp=1,hospital=$hosptime,hospreason='Left by <a href=\'viewuser.php?u={$userid}\'>{$ir['username']}</a>' WHERE userid={$r['userid']}");
event_add($r['userid'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] attacked you and left you lying outside the hospital.",$c,'combat');
$db->query("UPDATE users SET attacksdone=attacksdone+1 WHERE userid=$userid");
$atklog=mysql_escape_string($_SESSION['attacklog']);
$db->query("INSERT INTO attacklogs VALUES('',$userid,{$_GET['ID']},'won',unix_timestamp(),-2,'$atklog');");
$_SESSION['attackwon']=0;
$warq=$db->query("SELECT * FROM gangwars WHERE (warDECLARER={$ir['gang']} AND warDECLARED={$r['gang']}) OR (warDECLARED={$ir['gang']} AND warDECLARER={$r['gang']})");
if ($db->num_rows($warq) > 0)
{
$war=$db->fetch_row($warq);
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT-1 WHERE gangID={$r['gang']}");
$ga['gangRESPECT']-=1;
$db->query("UPDATE gangs SET gangRESPECT=gangRESPECT+1 WHERE gangID={$ir['gang']}");
if($ga['gangRESPECT'] <= 0 && $r['gang'])
{
mysql_query("DELETE FROM loaned WHERE nGANG={$ga['gangID']}",$c);
}
print "

<font color=gold>You earnt 1 respect for your gang!</font>";

}
//Gang Kill
if ($ga['gangRESPECT']<=0 && $r['gang'])
{
$db->query("UPDATE users SET gang=0 WHERE gang={$r['gang']}");

$db->query("DELETE FROM gangs WHERE gangRESPECT<='0'");
$db->query("DELETE FROM gangwars WHERE warDECLARER={$ga['gangID']} or warDECLARED={$ga['gangID']}");
}
$npcs=array(
);


if($r['user_level']==0)
{
$q=$db->query("SELECT * FROM challengebots WHERE cb_npcid={$r['userid']}");
if ($db->num_rows($q)) {
$cb=$db->fetch_row($q);
$qk=$db->query("SELECT * FROM challengesbeaten WHERE userid=$userid AND npcid={$r['userid']}");
if(!$db->num_rows($qk))
{
$m=$cb['cb_money'];
$db->query("UPDATE users SET money=money+$m WHERE userid=$userid");
print "
<font color=white>You gained \$$m for beating the challenge bot {$r['username']}";
$db->query("INSERT INTO challengesbeaten VALUES($userid, {$r['userid']})");
}
}
}


}
}
else
{
print "<font color=white>You beat Mr. Ghost!";
}

$h->endpage();
?>
Posted

Well

These are the 3 lines you need to look at (26,27,28)

qe=$r['level']*$r['level']*$r['level'];

$expgain=rand($qe/2,$qe);

$expperc=(int) ($expgain/$ir['exp_needed']*100);

But I believe you also need to look at the global_func file for the exp needed. Which is where the formula is for the exp needed.

Id have to look up the original code to help you further as i ripped it all out and put in my own exp function.

Posted

yes i know its them 3 lines but what do i change them to, to make it harder to level up

and if i change both

 

$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*2.2);

in global_func.php into like

 

$ir['exp_needed']=(int) (($ir['level']+1)*($ir['level']+1)*($ir['level']+1)*25);

that would make it harder to level up. BUT! it will make it quicker for the players to reach the EXP cap.

it then stop them from going any futher...

Posted

I am a little confused on what you are needing here. Exp cap?

As far as attack leave... these two lines are key:

qe=$r['level']*$r['level']*$r['level'];

$expgain=rand($qe/2,$qe);

A calculator would work wonders in helping you with this.

You figure a level 2 would give between 4/8 exp. which is calculated this way: (2 x 2 x 2)/2, 2 x 2 x 2

So a level 10 would give between 500/1000 = (10 x 10 x 10)/2, 10 x 10 x 10

As you can see this is a huge jump already. but take a level 100 = 500,000/1,000,000: (100 x 100 x 100)/2, 100 x 100 x 100

As you can see, that is an unreal jump. So you really need to figure out how much you might want to give out per level since that would move out of control quickly.

Something like:

qe=$r['level']*200;

$expgain=rand($qe/2,$qe);

Would yield 200,400 for a level 2: (2x200)/2,2 x 200.

Or between 10,000/20,000 for a level 100: (100x200)/2, 100 x 200

As you can see, its already much easier to manage with numbers like these. With more tweaks, test attacks, and number crunching you will come across a formula you are comfortable with. You will also want to figure out a formula for figuring out how much experience would be a level up (in global_functions). I tend to run thru a bunch of example levels to see what kind of numbers we would be dealing with.

Posted

im still so confused lol.

the only thing im thinking is... if i change that 2.2 into like between 25-50 then change the exp table in users into deflut 64,4 lol.

that make the game harder and the users wouldnt beable to reach that exp cap, correct?

I HATE EXP FORMULA! i think it be harder to understand and the crime formula lol.

Posted
I do like your solution Wolfe but one draw back is it's still using MC's technique, It would be a whole lot easier to work out your own method of using Experience than actually sticking with MC...
Mccodes technique isnt horrible if tweaked. I worked out a different method myself, but i was offering him a way to figure out the numbers to decrease the exp paid out within the system he is using.

Nicholas, doing it your way could possibly work, but you will want to run sample calculations. And, tbh, i would rather change exp payouts then have the exp field be so dang large.

Posted

Wolfe i would agree, people need to think about editing MC rather than just customising it for their own needs. Players will get sick of MC eventually, i for one only ever played one MC game and when i went to another it was just plain and boring. I still actually play the original game i first ever played of MC.

They did do a lot of editing compared to most of the websites i see on here but not enough for people to realise it isn't MC, A lot of games use MC for a base then cut everything they don't need and use custom scripts (idea for you lot who are just running generic MC), Them people need the props i say.

Nicholas think global not local, Edit the entire attack feature rather than asking people which lines gain EP, Another TC won't help anyone mate.

Posted

figured a way how to slow it down. (players leveling up)

 

$qe=$r['level']*$r['level']*$r['level'];
if($ir['level'] <= 15)
{
$expgain = rand($qe/2,$qe) > $ir['exp_needed'] / 100 * 15 ? $ir['exp_needed']/100*15 : rand($qe/2,$qe);
}
else if($ir['level'] > 15 && $ir['level'] <= 50)
{
$expgain = rand($qe/2,$qe) > $ir['exp_needed'] / 100 * 10 ? $ir['exp_needed']/100*10 : rand($qe/2,$qe);
}
else if($ir['level'] > 50 && $ir['level'] <= 100)
{
$expgain = rand($qe/2,$qe) > $ir['exp_needed'] / 100 * 5 ? $ir['exp_needed']/100*5 : rand($qe/2,$qe);
}
else
{
$expgain = rand($qe/2,$qe) > $ir['exp_needed'] / 100 * 3 ? $ir['exp_needed']/100*3 : rand($qe/2,$qe);
}
$expperc=(int) ($expgain/$ir['exp_needed']*100);

 

any level lower and level 15, max exp you can get is 15% by attacking a high level.

any level between level 15 to 50 the max exp you can get is 10% by attacking a high level.

any level between level 50 to 100 the max exp you can get is 5% by attacking a high level.

and finally any level higher and level 100 should only get 3% exp.

even if they attack a level like 500 times higher and their level.

Posted

I agree with crimegame,its best to rewrite the whole scritpt because mccodes get boring eventually,that why i have started to recode my attack system and alot of other stuff.

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