Guest Sniko` Posted July 22, 2009 Posted July 22, 2009 Weight Mod - Allows the ability to establish weight to all items and limit the total weight players can carry. Limits inventories. (Idea thought by Voice4Vision) You're unable to view this code. Viewing code within this forum requires registration, you can register here for free. [b]Check level function[/b] - keep a copy of yours (global_func.php)[code]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['maxitmweight']+=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, maxitmweight=maxitmweight+10 where userid=$userid");[/code] [b]staff_items.php form - CREATE NEW ITEM FUNCTION[/b] find [code] Item Sell Value: <input type='text' name='itmsellprice' /> [/code] above add[code]Item Weight: <input type='text' name='itmweight' /> [/code] [b]Later in that file find - NEW ITM SUBMIT FUNCTION[/b][code]if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype']) || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']))[/code] replace with[code]if(!isset($_POST['itmname']) || !isset($_POST['itmdesc']) || !isset($_POST['itmtype']) || !isset($_POST['itmweight']) || !isset($_POST['itmbuyprice']) || !isset($_POST['itmsellprice']))[/code] [b]Later in that file find the edit form function[/b] find[code]Item Desc.: <input type='text' name='itmdesc' value='{$itemi['itmdesc']}' /> [/code] Below it add[code]Item Weight: <input type='text' name='itmweight' value='{$itemi['itmweight']}' /> [/code] Now find the db query[code]$m=$db->query("INSERT INTO items VALUES('{$_POST['itmid']}',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor)"); [/code] Replace with[code]$m=$db->query("INSERT INTO items VALUES('{$_POST['itmid']}',{$_POST['itmtype']},'$itmname','$itmdesc',{$_POST['itmbuyprice']},{$_POST['itmsellprice']},$itmbuy, '{$_POST['effect1on']}', '$efx1', '{$_POST['effect2on']}', '$efx2', '{$_POST['effect3on']}', '$efx3', $weapon, $armor, '{$_POST['itmweight']}')");[/code] Now go to equip_weapon.php and equip_armour.php and add[code]if($r['itmweight'] > $ir['maxitmweight']) { print "This item cannot be equipped because you dont have enough weight to carry this item."; $h->endpage(); exit; }[/code] Thanks Sniko +1 if used or liked the idea of, alos plus voice4vision for the idea Any bugs please reply Quote
Richard Posted July 22, 2009 Posted July 22, 2009 Re: [V2] Item Weight I like this idea +1 I think it could be expanded upon a little, Perhaps to make it so each equipped item adds to your carried weight, But very nice Quote
dj_rive Posted September 20, 2009 Posted September 20, 2009 +1 This will be perfect for the project I'm working on Quote
gideon prewett Posted October 21, 2009 Posted October 21, 2009 i like this idea im going to try to add this but so every item has a weight and u can only carry a cirtain ammount includeing med items and collectibles etc and have it so ur max carry weight is ur max strengh :thumbup: but +1 Quote
sixsens Posted October 3, 2012 Posted October 3, 2012 Thats a nice addition to the game ill test that for sure! thx for this mod sniko 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.