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

Some Scripts Reuqest.

Lbtg

Advanced OT User
Joined
Nov 22, 2008
Messages
2,398
Reaction score
165
ello i wonder for 2 nice scripts i using 0.3.6

1.ant item that can by eated and when player eats it he gain 25% faster attack speed for 2 minutes. and when it ends he can eat another one .


2.is posible to make Clone ? i want when player cast 1 spell he make a clone of heself same name/outfit/hp/name , and that clone will do same as summoner do , attack/heal/spell attack/ but he cant follow where he gonna be summoned in that place he gonna stand all the time. and after 1 minute from this clone start the clone should die, and to cast this spell you need to have 10 crystal coins and the spell has 30 minutes exaust


sorry for me poor english.
 
this is action right ?

edit: added to actions . when i tryed eat it me client got crashed , and that item didint dissapear and didint give any speed attack.
[14/06/2011 11:43:05] [Error - Action Interface]
[14/06/2011 11:43:05] data/actions/scripts/speed.lua:onUse
[14/06/2011 11:43:05] Description:
[14/06/2011 11:43:05] data/actions/scripts/speed.lua:31: attempt to compare number with table
[14/06/2011 11:43:05] stack traceback:
[14/06/2011 11:43:05] data/actions/scripts/speed.lua:31: in function 'searchCheckWeapon'
[14/06/2011 11:43:05] data/actions/scripts/speed.lua:53: in function <data/actions/scripts/speed.lua:49>
 
Update the script:
LUA:
--Touch
local RStorage = 857365783
local extraPercent = 25
local timeCond = 20 -- seconds
local msgOnEat = "Hummmm..."
-------------------
	local loop = {
	[1] = {"head"},
	[2] = {"necklace"},
	[3] = {"backpack"},
	[4] = {"armor"},
	[5] = {"right hand"},
	[6] = {"left hand"},
	[7] = {"legs"},
	[8] = {"feet"},
	[9] = {"ring"},
	[10] = {"ammo"}
	}
	function getPlayerItemSlotPosition(cid, item)
	local slot = "no slot"
		for i = 1,10 do
			local value = loop[i][1]
			if getPlayerSlotItem(cid, i).uid == item.uid then
				slot = value
			end
		end
		return slot 
	end
	function searchCheckWeapon(cid)
		local getP = getPlayerWeapon(cid)
		if getP > 0 then
			local lastWeaponUID = getPlayerStorageValue(cid, RStorage)
			local itemSpeed = getItemAttackSpeed(getP)
			local valuePercent = "[".. extraPercent .."%]"
			local lastName = getItemAttribute(lastWeaponUID, "name")
			local nowName = getItemAttribute(getP.uid, "name")
			if string.sub(nowName, string.len(valuePercent)) ~= valuePercent then
				if getP.uid ~= lastWeaponUID then
					doItemSetAttribute(lastWeaponUID, "name", string.sub(lastName, -(string.len(lastName)), string.len(lastName)-string.len(valuePercent))
					setItemAttackSpeed(lastWeaponUID, itemSpeed-itemSpeed/extraPercent)
					doItemSetAttribute(getP.uid, "name", nowName .." [".. extraPercent .."%]")
					setItemAttackSpeed(getP.uid, itemSpeed+itemSpeed/extraPercent)
					doSendMagicEffect(getThingPos(cid), 12)
					addEvent(setPlayerStorageValue, 1, cid, RStorage, getP)
				end
			end
		end
		if i == timeCond then
			setPlayerStorageValue(cid, storage, -1)
		end
		for i = 1, timeCond do
			addEvent(searchCheckWeapon, i * 1000, cid)
		end
		return true
	end
------------------
local storage = 332842747
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local gStorage = getPlayerStorageValue(cid, storage)
	if gStorage == -1 then
		doCreatureSay(cid, msgOnEat, TALKTYPE_ORANGE)
		searchCheckWeapon(cid)
		setPlayerStorageValue(cid, storage, 1)
	end
	return true
end
 
now i can't eat item .
console error
[14/06/2011 16:50:46] [Error - LuaScriptInterface::loadFile] data/actions/scripts/speed.lua:40: ')' expected (to close '(' at line 39) near 'setItemAttackSpeed'
[14/06/2011 16:50:46] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/speed.lua)
[14/06/2011 16:50:46] data/actions/scripts/speed.lua:40: ')' expected (to close '(' at line 39) near 'setItemAttackSpeed'
 
does 0.3.6 even have getItemAttackSpeed? i think getItemAttribute should be used

and you're missing one bracket at the end of line 39
 
welli not scripter so i can't understand anything in this... meyby Cyk can you fix hes script ? or not posible to make it work on 0.3.6 ?
 
Try with this now:
LUA:
--Touch
local RStorage = 857365783
local extraPercent = 25
local timeCond = 20 -- seconds
local msgOnEat = "Hummmm..."
-------------------
	local loop = {
	[1] = {"head"},
	[2] = {"necklace"},
	[3] = {"backpack"},
	[4] = {"armor"},
	[5] = {"right hand"},
	[6] = {"left hand"},
	[7] = {"legs"},
	[8] = {"feet"},
	[9] = {"ring"},
	[10] = {"ammo"}
	}
	function getPlayerItemSlotPosition(cid, item)
	local slot = "no slot"
		for i = 1,10 do
			local value = loop[i][1]
			if getPlayerSlotItem(cid, i).uid == item.uid then
				slot = value
			end
		end
		return slot 
	end
	function searchCheckWeapon(cid)
		local getP = getPlayerWeapon(cid)
		if getP > 0 then
			local lastWeaponUID = getPlayerStorageValue(cid, RStorage)
			local itemSpeed = getItemAttackSpeed(getP)
			local valuePercent = "[".. extraPercent .."%]"
			local lastName = getItemAttribute(lastWeaponUID, "name")
			local nowName = getItemAttribute(getP.uid, "name")
			if string.sub(nowName, string.len(valuePercent)) ~= valuePercent then
				if getP.uid ~= lastWeaponUID then
					doItemSetAttribute(lastWeaponUID, "name", string.sub(lastName, -(string.len(lastName)), string.len(lastName)-string.len(valuePercent)))
					setItemAttackSpeed(lastWeaponUID, itemSpeed-itemSpeed/extraPercent)
					doItemSetAttribute(getP.uid, "name", nowName .." [".. extraPercent .."%]")
					setItemAttackSpeed(getP.uid, itemSpeed+itemSpeed/extraPercent)
					doSendMagicEffect(getThingPos(cid), 12)
					addEvent(setPlayerStorageValue, 1, cid, RStorage, getP)
				end
			end
		end
		if i == timeCond then
			setPlayerStorageValue(cid, storage, -1)
		end
		for i = 1, timeCond do
			addEvent(searchCheckWeapon, i * 1000, cid)
		end
		return true
	end
-----------------
local storage = 332842747
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local gStorage = getPlayerStorageValue(cid, storage)
	if gStorage == -1 then
		doCreatureSay(cid, msgOnEat, TALKTYPE_ORANGE)
		searchCheckWeapon(cid)
		setPlayerStorageValue(cid, storage, 1)
	end
	return true
end
 
doesnt work when i clicked on item me tibia client crashed

error:
[22/06/2011 14:12:51] [Error - Action Interface]
[22/06/2011 14:12:51] data/actions/scripts/speed.lua:onUse
[22/06/2011 14:12:51] Description:
[22/06/2011 14:12:51] data/actions/scripts/speed.lua:31: attempt to compare number with table
[22/06/2011 14:12:51] stack traceback:
[22/06/2011 14:12:51] data/actions/scripts/speed.lua:31: in function 'searchCheckWeapon'
[22/06/2011 14:12:51] data/actions/scripts/speed.lua:62: in function <data/actions/scripts/speed.lua:58>
 
Code:
--Touch
local RStorage = 34
local extraPercent = 25
local timeCond = 20 -- seconds
local msgOnEat = 'Hummmm...'
-------------------
local loop = {
	[1] = {'head'},
	[2] = {'necklace'},
	[3] = {'backpack'},
	[4] = {'armor'},
	[5] = {'right hand'},
	[6] = {'left hand'},
	[7] = {'legs'},
	[8] = {'feet'},
	[9] = {'ring'},
	[10] = {'ammo'}
}

function getPlayerItemSlotPosition(cid, item)
	local slot = 'no slot'
	for i = 1,10 do
		if getPlayerSlotItem(cid, i).uid == item.uid then
			slot = loop[i][1]
			break
		end
	end
	return slot
end

function searchCheckWeapon(cid)
	local getP = getPlayerWeapon(cid).uid
	if getP ~= 0 then
		local lastWeaponUID = getCreatureStorage(cid, RStorage)
		local itemSpeed = getItemAttribute(getP, 'attackSpeed') or getVocationInfo(getPlayerVocation(cid)).attackSpeed
		local valuePercent = '['.. extraPercent ..'%]'
		local lastName = getItemAttribute(lastWeaponUID, 'name')
		local nowName = getItemAttribute(getP, 'name')
		if nowName:sub(valuePercent:len()) ~= valuePercent then
			if getP ~= lastWeaponUID then
				doItemSetAttribute(lastWeaponUID, 'name', string.sub(lastName, -(string.len(lastName)), string.len(lastName)-string.len(valuePercent)))
				doItemSetAttribute(lastWeaponUID, 'attackSpeed', itemSpeed-itemSpeed/extraPercent)
				doItemSetAttribute(getP, 'name', nowName ..' ['.. extraPercent ..'%]')
				doItemSetAttribute(getP, 'attackSpeed', itemSpeed+itemSpeed/extraPercent)
				doSendMagicEffect(getThingPos(cid), 12)
				addEvent(doCreatureSetStorage, 1, cid, RStorage, getP)
			end
		end
	end
	if i == timeCond then
		doCreatureSetStorage(cid, storage, -1)
	end
	for i = 1, timeCond do
		addEvent(searchCheckWeapon, i * 1000, cid)
	end
	return true
end
-----------------
local storage = 33

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local gStorage = getCreatureStorage(cid, storage)
	if gStorage == -1 then
		doCreatureSay(cid, msgOnEat, TALKTYPE_ORANGE_1)
		searchCheckWeapon(cid)
		doCreatureSetStorage(cid, storage, 1)
	end
	return true
end
 
when i eated item it was like it working after 10 seconds me console whent crazy xD

edit: tryed it again and seems attack speed has been added , but item didint disapear on eat.
also after eat 10-15 secs server went again crash console was spamming errors.

i saw something with not enought memory
 
Last edited:
Try this one:
LUA:
--Touch
local RStorage = 857365783
local extraPercent = 25
local timeCond = 20 -- seconds
local msgOnEat = "Hummmm..."
--- dont touch
local c = 0
-------------------
	local loop = {
	[1] = {"head"},
	[2] = {"necklace"},
	[3] = {"backpack"},
	[4] = {"armor"},
	[5] = {"right hand"},
	[6] = {"left hand"},
	[7] = {"legs"},
	[8] = {"feet"},
	[9] = {"ring"},
	[10] = {"ammo"}
	}
	function getPlayerItemSlotPosition(cid, item)
	local slot = "no slot"
		for i = 1,10 do
			local value = loop[i][1]
			if getPlayerSlotItem(cid, i).uid == item.uid then
				slot = value
			end
		end
		return slot 
	end
	function searchCheckWeapon(cid)
		local getP = getPlayerWeapon(cid)
		if getP.uid > 0 then
			local lastWeaponUID = getPlayerStorageValue(cid, RStorage)
			local itemSpeed = getItemAttackSpeed(getP.uid)
			local valuePercent = "[".. extraPercent .."%]"
			local lastName = getItemAttribute(lastWeaponUID, "name")
			local nowName = getItemAttribute(getP.uid, "name")
			if string.sub(nowName, string.len(valuePercent)) ~= valuePercent then
				if getP.uid ~= lastWeaponUID then
					doItemSetAttribute(lastWeaponUID, "name", string.sub(lastName, -(string.len(lastName)), string.len(lastName)-string.len(valuePercent)))
					setItemAttackSpeed(lastWeaponUID, itemSpeed-(itemSpeed/extraPercent))
					doItemSetAttribute(getP.uid, "name", nowName .." [".. extraPercent .."%]")
					setItemAttackSpeed(getP.uid, itemSpeed+(itemSpeed/extraPercent))
					doSendMagicEffect(getThingPos(cid), 12)
					addEvent(setPlayerStorageValue, 1, cid, RStorage, getP.uid)
				end
			end
		end
		for i = 1, timeCond do
			c = c + 1
			addEvent(searchCheckWeapon, i * 1000, cid)
		end
		if c == timeCond then
			c = 0
			setPlayerStorageValue(cid, storage, -1)
		end
		return true
	end
-----------------
local storage = 33

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local gStorage = getCreatureStorage(cid, storage)
	if gStorage == -1 then
		doCreatureSay(cid, msgOnEat, TALKTYPE_ORANGE_1)
		searchCheckWeapon(cid)
                doRemoveItem(item.uid)
		doCreatureSetStorage(cid, storage, 1)
	end
	return true
end
 
Last edited:
eated item and seems that it worked after 10 seconds +- console get crazy.....

also i want that item on eat disapear.
 
Back
Top