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

good script

Sir MoX

New Member
Joined
Jan 14, 2009
Messages
285
Reaction score
1
hi, I need some help to make a action that when you use a lever it appears a teleport and a statue move 1 place to make a stais where the statue where...
If I no were clear ask me, please help me =)
rep+
 
try this
LUA:
local cfg = {
	 tppos = {x=1000,y=1000,z=7},   ---place where tp be created
	 tpto = {x=1002,y=1000,z=7,stackpos = 1},   ---place where player be tped when enter tp
	 statuepos = {x=1005,y=998,z=7,stackpos = 1},   --place where statue is
	 statuetopos = {x=1003,y=998,z=7,stackpos = 1},  -- place where statue will go
	 tptime = 10,     --time where it will be removed(seconds)
	 statuetime = 15,    --time where it will be back to its place
	id = 3742      -- id of statue
	}

		
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local tp = getThingFromPos(cfg.tppos)
 local statue = getThingFromPos(cfg.statuetopos)
      if tp.itemid == 1387 and statue.itemid == cfg.id then
           doPlayerSendCancel(cid,"You can't use this yet!")
      else
	  doCreateTeleport(1387, cfg.tpto, cfg.tppos)
	  doRemoveItem(getThingFromPos(cfg.statuepos).uid)
	  doCreateItem(cfg.id,1,cfg.statuetopos)
	  addEvent(doCleanTile,cfg.tptime * 1000,cfg.tppos)
	   addEvent(creat,cfg.statuetime * 1000)
	 
    end

return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end

function creat()
local statue = getThingFromPos(cfg.statuetopos)
  doRemoveItem(statue.uid)
  doCreateItem(cfg.id,1,cfg.statuepos)
end

action.xml
Code:
<action actionid="XXX" event="script" value="xxxx.lua"/>

put action id on lever.
 
its all okay but the lever when I use it dont came back from 1946 to 1945 and the first statue dont dissapear, but the secind its created and is okay

here is it to not edit it again:

local cfg = {
tppos = {x=1005,y=856,z=3}, ---place where tp be created
tpto = {x=1053,y=855,z=7,stackpos = 1}, ---place where player be tped when enter tp
statuepos = {x=1050,y=855,z=7,stackpos = 1}, --place where statue is
statuetopos = {x=1050,y=856,z=7,stackpos = 1}, -- place where statue will go
tptime = 10, --time where it will be removed(seconds)
statuetime = 15, --time where it will be back to its place
id = 7825 -- id of statue
}


function onUse(cid, item, fromPosition, itemEx, toPosition)
local tp = getThingFromPos(cfg.tppos)
local statue = getThingFromPos(cfg.statuetopos)
if tp.itemid == 1387 and statue.itemid == cfg.id then
doPlayerSendCancel(cid,"You can't use this yet!")
else
doCreateTeleport(1387, cfg.tpto, cfg.tppos)
doRemoveItem(getThingFromPos(cfg.statuepos).uid)
doCreateItem(cfg.id,1,cfg.statuetopos)
addEvent(doCleanTile,cfg.tptime * 1000,cfg.tppos)
addEvent(creat,cfg.statuetime * 1000)

end

return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end

function creat()
local statue = getThingFromPos(cfg.statuetopos)
doRemoveItem(statue.uid)
doCreateItem(cfg.id,1,cfg.statuepos)
end
 
the problem is that when I first use it the lever not get from 1945 to 1946 and not returned to 1945 inmiedatly as I want
 
have put the aaction id in action.xml and put that action id on the lever????[you must add the aid on lever, dont put itemid in action.xml]
cause it should transform from 1945 to 1946 and then transfrom to 1945 etc...
~try to use this ~[tested]

LUA:
local cfg = {
	 tppos = {x=1000,y=1000,z=7},   ---place where tp be created
	 tpto = {x=1002,y=1000,z=7,stackpos = 1},   ---place where player be tped when enter tp
	 statuepos = {x=1005,y=998,z=7,stackpos = 1},   --place where statue is
	 statuetopos = {x=1003,y=998,z=7,stackpos = 1},  -- place where statue will go
	 tptime = 10,     --time where it will be removed(seconds)
	 statuetime = 15,    --time where it will be back to its place
	id = 3742 -- id of statue
	}
 
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
 local tp = getThingFromPos(cfg.tppos)
 local statue = getThingFromPos(cfg.statuetopos)
      if tp.itemid == 1387 or statue.itemid == cfg.id then
           doPlayerSendCancel(cid,"You can't use this yet!")
      else
	  doCreateTeleport(1387, cfg.tpto, cfg.tppos)
	  doRemoveItem(getThingFromPos(cfg.statuepos).uid)
	  doCreateItem(cfg.id,1,cfg.statuetopos)
	  addEvent(doCleanTile,cfg.tptime * 1000,cfg.tppos)
	   addEvent(creat,cfg.statuetime * 1000)
 
    end
 
return item.itemid == 1945 and doTransformItem(item.uid,1946) or doTransformItem(item.uid,1945)
end
 
function creat()
local statue = getThingFromPos(cfg.statuetopos)
  doRemoveItem(statue.uid)
  doCreateItem(cfg.id,1,cfg.statuepos)
end
 
Last edited:
Back
Top