• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action Item upgrade by Sawex! 0.3.x

sawex

Premium User
Premium User
Joined
Jan 31, 2009
Messages
43
Reaction score
6
This script will upgrade items in your ots.

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!
 
Back
Top Bottom