Jump to content
MakeWebGames

[V2] Item Weight


Recommended Posts

Guest Sniko`
Posted

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

Posted

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

  • 1 month later...
  • 1 month later...
Posted

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

  • 2 years later...

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