jestemPolakiem
New Member
StrengthofWeapons
created by jestemPolakiem
created by jestemPolakiem
Introduction
Welcome all members of this forum! I would like to give you my newly-created script.
However, before I do I want to emphasize that all the errors in my posts are due to incorrect translation. Any post that is explained, will include the icon at the top, right corner.
Description
As for the script itself It can also be added to each item attacking strength. If she is going to end weapons destruction. Weapons of newly purchased and newly-acquired, which is not yet in use has no description - only when activation is added - the maximum strength is calculated with the following formula
PHP:
math.floor((getItemInfo(weapon.itemid).attack * getItemInfo(weapon.itemid).defense) / 13)
Changelog
- improve the problem of checking whether the player uses this function - thanks to Cykotitan
- checking whether the improved strength does not cross the border - thanks to Cykotitan
Install
data/creaturescripts/creaturescripts.xml
PHP:
<event type="attack" name="JPAxC001" event="script" value="JPAxC001.lua" />
data/creaturescripts/script/login.lua
PHP:
registerCreatureEvent(cid, "JPAxC001")
data/creaturescripts/script/JPAxC001.lua
PHP:
function onAttack(cid, target)
local weapon, desc = getPlayerWeapon(cid, true), ""
if (not isPlayer(cid)) then
return true
end
local weapon_strength = math.min(1000, math.floor((getItemInfo(weapon.itemid).attack * getItemInfo(weapon.itemid).defense) / 13))
if (not getItemAttribute(weapon.uid, "aid")) then
doItemSetAttribute(weapon.uid, "aid", 1000 + weapon_strength)
end
doItemSetAttribute(weapon.uid, "aid", getItemAttribute(weapon.uid, "aid") - 1)
doItemSetAttribute(weapon.uid, "description", "\nStrength of your arms is "..(getItemAttribute(weapon.uid, "aid")-1000).." attackable.")
if ((getItemAttribute(weapon.uid, 'aid')-1000) == 1) then
doRemoveItem(weapon.uid, 1)
end
return true
end
Termination
I greet all
jestemPolakiem
Last edited: