- Joined
- Jan 31, 2009
- Messages
- 43
- Reaction score
- 6
This script will upgrade items in your ots.
First scripts can upgrade extraattack in weapons:
2. This scripts is upgrading extradefense in weapons or shields.
Now in actions.xml write:
<action itemid="2149" script="attack.lua"/>
<action itemid="2150" script="def.lua"/>
Now we can upgrade items!
First scripts can upgrade extraattack in weapons:
Code:
-- Simple upgrade by Sawex
function onUse(cid, item, frompos, item2, topos)
if(isInArray({1,2,3}, getItemWeaponType(item2.uid)) == TRUE) then
if getItemExtraAttack(item2.uid) < 10 then
if math.random(1,100) >= (getItemExtraAttack(item2.uid)*10) then
setItemExtraAttack(item2.uid, (getItemExtraAttack(item2.uid) + 1))
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item upgrade done.")
return TRUE
else
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Upgrade failed.")
end
else
doPlayerSendCancel(cid, "Item is already upgraded!")
end
else
doPlayerSendCancel(cid, "This item can not be upgrade!")
end
return 1
end
2. This scripts is upgrading extradefense in weapons or shields.
Code:
-- Simple upgrade by Sawex
function onUse(cid, item, frompos, item2, topos)
if getItemWeaponType(item2.uid) ~= 0 then
if getItemExtraDefense(item2.uid) < 10 then
if math.random(1,100) >= (getItemExtraDefense(item2.uid)*10) then
setItemExtraDefense(item2.uid, (getItemExtraDefense(item2.uid) + 1))
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item upgrade done.")
return TRUE
else
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Upgrade failed.")
end
else
doPlayerSendCancel(cid, "Item is already upgraded!")
end
else
doPlayerSendCancel(cid, "This item can not be upgrade!")
end
return 1
end
Now in actions.xml write:
<action itemid="2149" script="attack.lua"/>
<action itemid="2150" script="def.lua"/>
Now we can upgrade items!