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

Action RookGard Rats Lever

QuaS

Cykotitan Pwned =/
Joined
Sep 11, 2008
Messages
838
Reaction score
28
Location
Poland/ Wroclaw
Relasing cuz i am bored. And this clock in windows mineswepper reaches 999, i just suck.

rats.lua
Lua:
  -- rook lever by QuaS~
local posi3 = {x=301, y=287, z=8} --
poss = {
[1] = {x=159, y=108, z=7},
[2] = {x=160, y=108, z=7},
[3] = {x=161, y=108, z=7}
}

local lever = {
[1] = {x=158, y=107, z=7},
[2] = {x=164, y=107, z=7}
}
local itemids = 5770
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.itemid == 1945 then
                doCreateItem(itemids,poss[2])
                if getTileItemById(poss[1],4645).itemid ~= nil then
                        doTransformItem(getTileItemById(poss[1],4645).uid,itemids)
                end
                if getTileItemById(poss[3],4647).itemid > 0 then
                        doTransformItem(getTileItemById(poss[3],4647).uid,itemids)
                end
                for i=1,#lever do
                        if lever[i].x == fromPosition.x then
                                o = i
                        end
                end
                if o == 1 then
                        b = 2
                else
                        b = 1
                end
                doTransformItem(item.uid,item.itemid+1)
                doTransformItem(getTileItemById(lever[b],1945).uid,1946)
        elseif item.itemid == 1946 then
                for p = 1,#poss do
                doRelocate(poss[p], posi3)
                end
                for z =1,#poss do
                                poss[z].stackpos = 254
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end
                                poss[z].stackpos = 1
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end

                end
                for i=1,#lever do
                        if lever[i].x == toPosition.x then
                                o = i
                        end
                end
                if o == 1 then
                        b = 2
                else
                        b = 1
                end
                doCreateItem(4616,poss[2])
                doCreateItem(351,poss[1])
                doCreateItem(351,poss[3])
                doCreateItem(4645,poss[1])
                doCreateItem(4647,poss[3])
                doTransformItem(item.uid,item.itemid-1)
                doTransformItem(getTileItemById(lever[b],1946).uid,1945)
        end
        return TRUE
end

actions.xml:
PHP:
<action actionid="Action" event="script" value="rats.lua" />
config:
314otoi.png


//QuaS~
 
Last edited:
And don't forgot to give rep. point for Quas :>
 
thx im working with one 100% rl tibia =)

ot..

but i need to script the things and atm im tracking rl map..
thx for helping im repping u..
 
PHP:
[25/02/2010 16:42:25] [Error - Action Interface] 
[25/02/2010 16:42:25] data/actions/scripts/tools/rats.lua:onUse
[25/02/2010 16:42:25] Description: 
[25/02/2010 16:42:25] attempt to index a nil value
[25/02/2010 16:42:25] stack traceback:
[25/02/2010 16:42:25] 	[C]: in function 'getTileItemById'
[25/02/2010 16:42:25] 	data/actions/scripts/tools/rats.lua:29: in function <data/actions/scripts/tools/rats.lua:12>

Que esta mal?? :/ plz diganme u.u
la estoy usando para un quest :p
otra cosa...si fuera posible que
el puente desaparesca cuando el
jugagor pase por el, para que los
otros tengan que hacer todo el camino
de vuelta... se puede?? sino me quedo
con lo que tengo xDD gracias a todos ^^

-------------english------------
what's wrong? D: plz tell me xd
i'm using for a quest :D i want
the bridge disappear after the player walk
on it...understand me?? :/ if you don't
understand me use a translate xDD
 
Last edited:
my problem is the bridge :S
first, i use the lever, ok
go to tp, i stay in front of
bridge and when i go to use
the lever again, the bridge
no disappear D: why u.u if i post
a picture of the place can you help me??

ratlever.png


ok look...
poss1= itemid:9144 (x:414,y:20,z:7)
poss2= itemid:410 (x:415,y:20,z:7)
lever1= actionid:3255 (x:413,y:40,z:8)

the yellow square is possi3 :p i forgot this n.nU

i must put a lever2? :S
can you make the script for my coordinates?
plz ^^ thx for all :)
 
Last edited:
PHP:
[25/02/2010 16:42:25] [Error - Action Interface] 
[25/02/2010 16:42:25] data/actions/scripts/tools/rats.lua:onUse
[25/02/2010 16:42:25] Description: 
[25/02/2010 16:42:25] attempt to index a nil value
[25/02/2010 16:42:25] stack traceback:
[25/02/2010 16:42:25] 	[C]: in function 'getTileItemById'
[25/02/2010 16:42:25] 	data/actions/scripts/tools/rats.lua:29: in function <data/actions/scripts/tools/rats.lua:12>

Que esta mal?? :/ plz diganme u.u
la estoy usando para un quest :p
otra cosa...si fuera posible que
el puente desaparesca cuando el
jugagor pase por el, para que los
otros tengan que hacer todo el camino
de vuelta... se puede?? sino me quedo
con lo que tengo xDD gracias a todos ^^

-------------english------------
what's wrong? D: plz tell me xd
i'm using for a quest :D i want
the bridge disappear after the player walk
on it...understand me?? :/ if you don't
understand me use a translate xDD
PHP:
local poss = {
[1] = {x=32100, y=32205, z=8},
[2] = {x=32099, y=32205, z=8},
[3] = {x=32101, y=32205, z=8}
}

local lever = {
[1] = {x=32098, y=32204, z=8},
[2] = {x=32104, y=32204, z=8}
}
local posi3 = {x=32102, y=32205, z=8}
local itemids = 5770
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if item.itemid == 1945 then
		doTransformItem(getTileItemById(poss[2],355).uid,5770)
		doTransformItem(getTileItemById(poss[3],355).uid,5770)
		doRemoveItem(getTileItemById(poss[1],4608).uid)
		doRemoveItem(getTileItemById(poss[2],4645).uid)
		doRemoveItem(getTileItemById(poss[3],4647).uid)

                if getTileItemById(poss[1],4608).itemid ~= nil then
			doCreateItem(5770,poss[1])
                end
                if getTileItemById(poss[1],4608).itemid > 0 then
			doCreateItem(5770,poss[1])
                end

                for i=1,#lever do
                        if lever[i].x == fromPosition.x then
                                o = i
                        end
                end
                if o == 1 then
                        b = 2
                else 
                        b = 1
                end


                doTransformItem(item.uid,item.itemid+1)
                doTransformItem(getTileItemById(lever[b],1945).uid,1946)
        elseif item.itemid == 1946 then
                for p = 1,#poss do
                doRelocate(poss[p], posi3)
                end
                for z =1,#poss do
                                poss[z].stackpos = 254
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end
                                poss[z].stackpos = 1
                                if getThingFromPos(poss[z]).itemid > 1000 then
                                        doRemoveItem(getThingFromPos(poss[z]).uid)
                                end

                end
                for i=1,#lever do
                        if lever[i].x == toPosition.x then
                                o = i 
                        end
                end
                if o == 1 then
                        b = 2
                else 
                        b = 1
                end
		doRemoveItem(getTileItemById(poss[1],5770).uid)
                doCreateItem(4608,poss[1])
		doTransformItem(getTileItemById(poss[2],5770).uid,355)
		doTransformItem(getTileItemById(poss[3],5770).uid,355)
                doCreateItem(4645,poss[2])
                doCreateItem(4647,poss[3])
                doTransformItem(item.uid,item.itemid-1)
                doTransformItem(getTileItemById(lever[b],1946).uid,1945)
        end
        return TRUE
end
Intenta con este codigo...
Ami asi me funciono
---
Try with this
 
very nice
Code:
local cfg = {
	{x=32099, y=32205, z=8, stackpos=0},
	{x=32100, y=32205, z=8, stackpos=0},
	{x=32101, y=32205, z=8, stackpos=0}
} -- 60137 and 60138 are lever UIDs! :p
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		for i = 60137, 60138 do
			doTransformItem(i, 1946)
		end
		for i = 1, 3 do
			doRelocate(cfg[i], {x=32102, y=32205, z=8})
			doTransformItem(getThingfromPos(cfg[i]).uid, i == 2 and 4619 or 351)
		end
		doCreateItem(4645, 1, {x=32099, y=32205, z=8})
		doCreateItem(4647, 1, {x=32101, y=32205, z=8})
	elseif item.itemid == 1946 then
		for i = 60137, 60138 do
			doTransformItem(i, 1945)
		end
		doRemoveItem(getTileItemById({x=32099, y=32205, z=8}, 4645).uid)
		doRemoveItem(getTileItemById({x=32101, y=32205, z=8}, 4647).uid)
		for i = 1, 3 do
			doTransformItem(getThingfromPos(cfg[i]).uid, 5770)
		end
	end
	return true
end
 
Back
Top