• 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 poi oil lever

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
707
Solutions
28
Reaction score
126
Location
Sweden
This is my script i use for "poi oil lever"

oil_lever.lua
Code:
function onUse(cid, item, frompos, item2, topos)
wall1 = {x=32801, y=32336, z=11, stackpos=1}
getwall1 = getThingfromPos(wall1) 
splash = {x=32800, y=32339, z=11, stackpos=1}
oil = getThingfromPos(splash)

if item.uid == 3040 and item.itemid == 1945 and oil.itemid == 2016 and oil.type == 11 and getwall1.uid == 0 then
  	 doCreateItem(5770,1,wall1)
   	doSendMagicEffect(splash,13)
   doTransformItem(item.uid,item.itemid+1)

elseif item.uid == 3040 and item.itemid == 1946 and oil.itemid == 2016 and oil.type == 11 and getwall1.uid == 0  then
   doTransformItem(item.uid,item.itemid-1)
else
doCreatureSay(cid, "The lever is creaking and rusty.", 19)
end
end

Tutorial part:

How do i change the splat to an other type? (e.g. blood)
its simple just edit this
Code:
oil.type == [B]11[/B]
to
Code:
oil.type == [B]2[/B]
you can change the nr to any other type will be usefull for custom scripts

What is wall1 = {x=32801, y=32336, z=11, stackpos=1}?
wall1 is the bridge that will be summoned (i know it should stand something else but i did just copy an old wall summon script)

What is splash = {x=32800, y=32339, z=11, stackpos=1}?

that is where the splat should be in this script you should put it where the lever is located (that is how its working on real tibia) but remmember if you want to make a hard quest you maybe want the splat to be far away from the lever to make it hard for the player/team that is going to enter the area

that is pretty much what i need to tell you if you know anything about lua scripting you can edit the rest by yourself
this script has been tested on TFS 0.3.2 and it did work good (it could be improved)
 
Thanks a Lot i was seeking for it!!

But can you post table of "fluidType" ?

2 = blood
11 = oil

etc.
 
For tfs 0.3.4

work perfect,see the buy i want it to last 1 minutes disappears again.thz


PHP:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=358, y=450, z=9, stackpos=1}
getgate = getThingfromPos(gatepos) 
splash = {x=352, y=451, z=9, stackpos=1}
oil = getThingfromPos(splash)

if item.uid == 3040 and item.itemid == 1945 and oil.itemid == 2016 and oil.type == 11 and getgate.uid == 0 then
  	 doCreateItem(5770,1,gatepos)
   	doSendMagicEffect(splash,13)
   doTransformItem(item.uid,item.itemid+1)

elseif item.uid == 3040 and item.itemid == 1946 and oil.itemid == 2016 and oil.type == 11 and getgate.uid == 0  then
   doTransformItem(item.uid,item.itemid-1)
else
doCreatureSay(cid, "The lever is creaking and rusty.", 19)
end
end

PHP:
<action uniqueid="3040" script="oilpoiquest2.lua" />
 
Last edited:
Thanks a Lot i was seeking for it!!

But can you post table of "fluidType" ?

2 = blood
11 = oil

etc.

you can find it in tfs folder/doc/LIQUIDS
anyway here is the full list of the types
Code:
[ FLUIDTYPE		NAME			COLOR
	2	blood			RED
	10	lifefluid		RED
	26	lava			RED

	3	beer			BROWN
	11	oil			BROWN
	19	mud			BROWN
	27	rum			BROWN

	4	slime			GREEN

	5	lemonade		YELLOW
	13	urine			YELLOW
	21	fruit juice		YELLOW

	6	milk			WHITE
	14	coconut milk		WHITE

	7	manafluid		PURPLE
	15	wine			PURPLE

	1	water			BLUE
]

work perfect,see the buy i want it to last 1 minutes disappears again.thz


PHP:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=358, y=450, z=9, stackpos=1}
getgate = getThingfromPos(gatepos) 
splash = {x=352, y=451, z=9, stackpos=1}
oil = getThingfromPos(splash)

if item.uid == 3040 and item.itemid == 1945 and oil.itemid == 2016 and oil.type == 11 and getgate.uid == 0 then
  	 doCreateItem(5770,1,gatepos)
   	doSendMagicEffect(splash,13)
   doTransformItem(item.uid,item.itemid+1)

elseif item.uid == 3040 and item.itemid == 1946 and oil.itemid == 2016 and oil.type == 11 and getgate.uid == 0  then
   doTransformItem(item.uid,item.itemid-1)
else
doCreatureSay(cid, "The lever is creaking and rusty.", 19)
end
end

PHP:
<action uniqueid="3040" script="oilpoiquest2.lua" />
then you have to add some kind of time in the script see the thread where someone explain how to add time in scripts (im not that good at makeing advanced scripts)


Edit:
something like this should make it transform back (not tested)
Code:
addEvent(transformBack, 60*1000, {item, TRANSFORM_BACK_ITEM_ID},gatepos)
 
Last edited:
Lua:
local bridgepos = {x=358, y=450, z=9, stackpos=0} -- Position of the bridge tile
local splash = {x=352, y=451, z=9, stackpos=1} -- Position of the liquid pool

local leverUID = 3040 -- Unique ID of the lever
local liquidId = 2016 -- Item ID of the liquid pool
local liquidType = 11 -- Subtype of the liquid pool

function onUse(cid, item, frompos, item2, topos)

local bridge = getThingfromPos(bridgepos) 
local liquid = getThingfromPos(splash)

	if item.uid == leverUID and item.itemid == 1945 and liquid.itemid == liquidId and liquid.type == liquidType and bridge.itemid == 493 then
		doTransformItem(bridge.uid, 5770)
		doSendMagicEffect(splash, CONST_ME_MAGIC_RED)
		doTransformItem(item.uid, 1946)

	elseif item.uid == leverUID and item.itemid == 1946 and liquid.itemid == 2016 and liquid.type == 11 and bridge.itemid == 5770 then
		doTransformItem(bridge.uid, 493)
		doTransformItem(item.uid, 1945)
	else
		doCreatureSay(cid, "The lever is creaking and rusty.", TALKTYPE_ORANGE_1)
	end
	
	return TRUE
end
 
Back
Top