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

Attribute

AnarchGov

Member
Joined
Oct 3, 2011
Messages
263
Reaction score
6
Does anyone know the attribute for attackSpeed for 9.31 servers? Or does it have to be a lua script now? If it has to be a lua script does anyone have one?
REP++
 
Last edited:
Does anyone know the attribute for attackSpeed for 9.31 servers? Or does it have to be a lua script now? If it has to be a lua script does anyone have one?

Now how would i do that? Make a new lua script for the weapon to run off of? Then once i do that set the attribute?
 
You could make an item, to use on the weapon (e.g. star wand). After using the wand on the item, it will change the attack speed.

That would be amazing. Now to do that, use the scrupt above on the item i would like to use on the weapon? Where would i put the value in that function? Like how fastt he attack should be.
 
data/actions/actions.xml

Code:
<action itemid="[COLOR="#FF0000"]WAND_ID[/COLOR]" event="script" value="[COLOR="#FF0000"]script.lua[/COLOR]"/>

data/actions/scripts/script.lua

LUA:
local t = {
	[WEAPON_ID] = {1500} -- 2000 = default, tibia speed
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k = t[itemEx.itemid]
	if k then
		doItemSetAttribute(itemEx.uid, 'attackspeed', k[1])
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		doRemoveItem(item.uid, 1)
	else
		doPlayerSendCancel(cid, "You cannot use this object.")
	end
	return true
end
 
Last edited:
actions.xml

Code:
<action itemid="[COLOR="#FF0000"]WAND_ID[/COLOR]" event="script" value="[COLOR="#FF0000"]script.lua[/COLOR]"/>

script.lua

LUA:
local t = {
	[WEAPON_ID] = 500 -- speed // 2000 - 500 = 1500 // faster
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k = t[itemEx.itemid]
	if k then
		doItemSetAttribute(itemEx.uid, 'attackspeed', (getItemAttackSpeed(itemEx.uid) - k))
		doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
		doRemoveItem(item.uid, 1)
	else
		return doPlayerSendCancel(cid, "You cannot use this object.")
	end
	return true
end

Where exactly do i put this code?
 
Ok it is saying the same thing. This is exactly what i'm doing maybe im the problem. I saved the script as script.lua under data/actions/other/scripts.

I put it in actions.xml as follows: itemid="" script="other/script.lua"

Under the "other" sections. It is written the same as everything else in that section.

I also now tried to put it in actions the way you suggested. Again it seems to able to read the script. But it does not affect the attack speed of the weapons.
 
Last edited:
Back
Top