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

put scarab coin on coal basin > push lever > teleport player

xexam

New Member
Joined
Aug 3, 2010
Messages
172
Reaction score
1
Hello, can anyone make such a script? Player puts scarab coin on empty coal basin, player push lever, player get teleporter and the scarab coin removes from coal basin
when there's any scarab coin on the coal basin it should say "you need a scarab coin"
 
Code:
function leverBack()
doTransformItem(getTileItemById({x=XX,y=YY,z=ZZ},1946).uid,1945) -- lever pos
end

function onUse(cid, item, frompos, item2, topos)
local teleport = {x=XXX,y=XXX,z=XXX}  --teleport position
   
	if item.itemid == 1945 then
		if getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).itemid >= 1 then  --scarab coin pos
		   doTransformItem(item.uid,1946) --transform lever to 1946
		   doSendMagicEffect(topos,13) -- the magic effect that apears on the lever
		   doTeleportThing(cid, teleport) --teleport player position
		   doSendMagicEffect(teleport, CONST_ME_TELEPORT) -- magic effect...
		   doSendMagicEffect(frompos,CONST_ME_TELEPORT) -- magic effect...
		   doRemoveItem(getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).uid,1) --scarab coin pos
		   addEvent(leverBack,2 * 1000) --addevent to lever return to id 1945
		else
			doCreatureSay(cid, "You need a scarab coin to pass!", TALKTYPE_ORANGE_1, false, 0, topos)
		end
	else
	  doPlayerSendCancel(cid,"Sorry, not possible.")
	end
end

Didnt tested it! hope it works. :D
 
it works good, but when there is no scarab coin you can move lever... how to do that the lever cant be moved when there is no scarab coin?

and how to add exhaust (like 2 seconds) for executing this script?
 
Lua:
local function f(p)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

local teleport = {x=xxx, y=yyy, z=z}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doTransformItem(item.uid, 1946)
		addEvent(f, 2000, fromPosition)
		local v = getThingfromPos({x=xxx, y=yyy, z=z, stackpos=1})
		if v.itemid == 2159 then
			doRemoveItem(v.uid, 1)
			doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
			doTeleportThing(cid, teleport)
			doSendMagicEffect(teleport, CONST_ME_TELEPORT)
		else
			doCreatureSay(cid, 'You need a scarab coin to pass!', TALKTYPE_ORANGE_1, false, cid, fromPosition)
		end
	else
		doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT)
	end
	return true
end
 
Last edited:
Its weird, in my ot the script I sent you worked fine ;O
Try this now!
Lua:
function leverBack()
doTransformItem(getTileItemById({x=XX,y=YY,z=ZZ},1946).uid,1945) -- lever pos
end

function onUse(cid, item, frompos, item2, topos)
local teleport = {x=XXX,y=XXX,z=XXX}  --teleport position
   
	if item.itemid == 1945 and getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).itemid >= 1 then  --scarab coin pos
		   doTransformItem(item.uid,1946) --transform lever to 1946
		   doSendMagicEffect(topos,13) -- the magic effect that apears on the lever
		   doTeleportThing(cid, teleport) --teleport player position
		   doSendMagicEffect(teleport, CONST_ME_TELEPORT) -- magic effect...
		   doSendMagicEffect(frompos,CONST_ME_TELEPORT) -- magic effect...
		   doRemoveItem(getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).uid,1) --scarab coin pos
		   addEvent(leverBack,2 * 1000) --addevent to lever return to id 1945
		else
			doCreatureSay(cid, "You need a scarab coin to pass!", TALKTYPE_ORANGE_1, false, 0, topos)
		end

	if item.itemid == 1946 then
	  doPlayerSendCancel(cid,"Sorry, not possible.")
	end
	return true
end
 
ee why you use getTileItemById? it can be abused to lag it massively if they put 999999 items on tile :p:p there isn't even exhaust :p
 
Its weird, in my ot the script I sent you worked fine ;O
Try this now!
Lua:
function leverBack()
doTransformItem(getTileItemById({x=XX,y=YY,z=ZZ},1946).uid,1945) -- lever pos
end

function onUse(cid, item, frompos, item2, topos)
local teleport = {x=XXX,y=XXX,z=XXX}  --teleport position
  
    if item.itemid == 1945 and getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).itemid >= 1 then  --scarab coin pos
           doTransformItem(item.uid,1946) --transform lever to 1946
           doSendMagicEffect(topos,13) -- the magic effect that apears on the lever
           doTeleportThing(cid, teleport) --teleport player position
           doSendMagicEffect(teleport, CONST_ME_TELEPORT) -- magic effect...
           doSendMagicEffect(frompos,CONST_ME_TELEPORT) -- magic effect...
           doRemoveItem(getTileItemById({x=XXX,y=YYY,z=ZZZ},2159).uid,1) --scarab coin pos
           addEvent(leverBack,2 * 1000) --addevent to lever return to id 1945
        else
            doCreatureSay(cid, "You need a scarab coin to pass!", TALKTYPE_ORANGE_1, false, 0, topos)
        end

    if item.itemid == 1946 then
      doPlayerSendCancel(cid,"Sorry, not possible.")
    end
    return true
end


Hello, how to use it on ots?

I'm green in this case :(
 
Hello, how to use it on ots?

I'm green in this case :(
You add this script into data/actions/scripts
You add a line for AID/actionid in data/actions/actions.xml
In map editor, you put a lever down, and give it the actionid from actions.xml
 
Back
Top