Jump to content
MakeWebGames

Recommended Posts

Posted

Hello to All,

Is there any mod that when a user equip weapon there will be additional stat bonus. For example when you equip a sword you get 100 agility.

Thanks in advance..

Posted

Re: Weapon with stats

Erm thats quite easy to do but wouldnt it be a bit stupid. As people can just equip then equip a million times and get thier agility very high. Unless you do something like you can only do it once.

Posted

Re: Weapon with stats

What code should i add here to make the item when equip add stats..

thanks in advance

 

<?php
include "globals.php";
$_GET['ID'] = abs((int) $_GET['ID']);
$id=$db->query("SELECT iv.*,it.* FROM inventory iv LEFT JOIN items it ON iv.inv_itemid=it.itmid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid LIMIT 1");
if($db->num_rows($id)==0)
{
print "Invalid item ID";
$h->endpage();
exit;
}
else
{
$r=$db->fetch_row($id);
}
if(!$r['weapon'])
{
print "This item cannot be equipped to this slot.";
$h->endpage();
exit;
}
if($_GET['type'])
{
if(!in_array($_GET['type'], array("equip_primary", "equip_secondary")))
{
print "This slot ID is not valid.";
$h->endpage();
exit;
}
if($ir[$_GET['type']])
{
item_add($userid, $ir[$_GET['type']], 1);
}
item_remove($userid, $r['itmid'], 1);
$db->query("UPDATE users SET {$_GET['type']} = {$r['itmid']} WHERE userid={$userid}");
print "Item {$r['itmname']} equipped successfully.";
}
else
{
print "<h3>Equip Weapon</h3><hr />
<form action='equip_weapon.php' method='get'>
<input type='hidden' name='ID' value='{$_GET['ID']}' />
Please choose the slot to equip {$r['itmname']} to, if there is already a weapon in that slot, it will be removed back to your inventory.

<input type='radio' name='type' value='equip_primary' checked='checked' /> Primary

<input type='radio' name='type' value='equip_secondary'  /> Secondary

<input type='submit' value='Equip Weapon' /></form>";
}
$h->endpage();
?>
Posted

Re: Weapon with stats

the way i did it on my game, is to add the extra stats on the item table. in the attack page you query for the weapon info and just add the extra stats to the $mydamage

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