Siegh
Thronar Developer
Im trying to set up a quite simple but usefull system wich enables one to upgrade a weapon by using it with a hammer. This is just a pure luck based system, the chance values will not change and they are supposed to work only once (thats why I check for ExtraAttack == 0).
The problem is with the function getItemExtraAttack, wich is not working by some reason. I would like to ask if anyone could tell me if Im doing something wrong.
Distro: TFS 0.3.6
The problem is with the function getItemExtraAttack, wich is not working by some reason. I would like to ask if anyone could tell me if Im doing something wrong.
Distro: TFS 0.3.6
Code:
local config = {
weapons = {2406, 2385},
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
rand = math.random(1,100)
if(isInArray(config.weapons, itemEx.itemid)) then
if getItemExtraAttack(itemEx.itemid) == 0 then
if rand >= 85 then
doRemoveItem(itemEx.itemid, 1)
doSendMagicEffect((getPlayerPosition(cid)), 67)
doPlayerSendTextMessage(cid, 22, "Your weapon broke into pieces!")
elseif rand >= 40 and rand <= 84 then
setItemExtraAttack(itemEx.itemid, 1)
doSendMagicEffect((getPlayerPosition(cid)), 26)
doPlayerSendTextMessage(cid, 6, "You improved your weapon's attack by 1 point!")
elseif rand >= 20 and rand <= 39 then
setItemExtraAttack(itemEx.itemid, 2)
doSendMagicEffect((getPlayerPosition(cid)), 26)
doPlayerSendTextMessage(cid, 6, "You improved your weapon's attack by 2 point!")
elseif rand >= 7 and rand <= 19 then
setItemExtraAttack(itemEx.itemid, 3)
doSendMagicEffect((getPlayerPosition(cid)), 26)
doPlayerSendTextMessage(cid, 6, "You improved your weapon's attack by 3 point!")
elseif rand <= 6 then
setItemExtraAttack(itemEx.itemid, 4)
doSendMagicEffect((getPlayerPosition(cid)), 27)
doPlayerSendTextMessage(cid, 6, "You improved your weapon's attack by 4 point!")
end
end
end
return true
end