• 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!

Upgrade Your Items!

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
55
Location
Switzerland
How do i made a script whenever you use a certain object on a weapon or piece of armor then it's stats change? Like this..

Step 1. Kira used a 2.5x Speed Blazer on The Avenger.
Step 2. The Avenger's Speed has changed to 2.5x faster.

I want it like that, but except i can change any stat for anythng. o.o


EDIT : This should be in Requests right?
 
data/actions/actions.xml
Code:
<action itemid="[COLOR="red"][B]ITEM_HERE[/B][/COLOR]" event="script" value="[COLOR="blue"]script.lua[/COLOR]"/>
 
Last edited:
Whenever i use 1 Ruby on the sword it says "Sorry, not possible"
Whenever i use 2 or more Rubies on the sword it says "You do not have enough mana"

What does this mean? o.0
 
Your rubies are conflicting with your "enchant" script. <_<
Use a different item. ^_^
 
Last edited:
Code:
local function itemAttackSpeed(uid)
	return getItemAttribute(uid, "attackspeed")
end

local function isWeapon(uid)
	uid = uid or 0
	if isInArray({1, 2, 3, 4}, getItemWeaponType(uid)) then
		return true
	end
	
	return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isWeapon(itemEx.uid) then
		if itemAttackSpeed(itemEx.uid) >= 1000 then
			doItemSetAttribute(itemEx.uid, "attackspeed", itemAttackSpeed(itemEx.uid) - (itemAttackSpeed(itemEx.uid) / 2))
			doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
			doRemoveItem(item.uid, 1)
		else
			doPlayerSendCancel(cid, "Sorry, the weapon cannot attack faster.")
		end
	else
		doPlayerSendCancel(cid, "Sorry, you can only use this on weapons.")
	end
	
	return true
end
 
Last edited:
:( Still does not work for me. saying "You cannot use that object"

Error :

6rh3qw.jpg
 
Last edited:
Code:
local function speed(uid)
	return getItemAttribute(uid, "attackspeed")
end

local function isWeapon(uid)
	uid = uid or 0
	if isInArray({1, 2, 3, 4}, getItemWeaponType(uid)) then
		return true
	end
	
	return false
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	return isWeapon(itemEx.uid) and doItemSetAttribute(itemEx.uid, "attackspeed", speed(itemEx.uid) - (speed(itemEx.uid) / 2)) and doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE) and doRemoveItem(item.uid, 1) or doPlayerSendCancel(cid, "Sorry, not possible.") and doSendMagicEffect(toPosition, CONST_ME_POFF)
end
 
Back
Top