• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Lua - Movement] Levers+teleport

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
I'm requesting a script that should do the following:

There is 8 levers, when you have pulled them all, you shall be able to go through a teleport, if not every lever is pulled you should not be able to go through the teleport.

Also, the levers shall be changed back to their first state (id:1945) after 4 minutes, when they have changed back, the teleport should not be able to go through, which means you have to pull all levers once again.

Thanks in advance!
 
This is an old one I made, ehm, I dunno if it got errors though, never tested it.
LUA:
local levers = {{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1},{x=EDIT, y=EDIT, z=EDIT, stackpos = 1}}
function onUse(cid, item, fromPosition, itemEx, toPosition)
   if getGlobalStorageValue(5900) < 0 then
      setGlobalStorageValue(5900,1)
	  doTransformItem(item.uid, item.itemid+1)
      addEvent(setGlobalStorageValue, 1000*60*4, 5900, -1)
	  for i = 1, #levers do
		addEvent(doTransformItem, 1000*60*4, getThingfromPos(levers[i]).uid, 1945) 
      end
   elseif getGlobalStorageValue(5900) >= 1 then
       setGlobalStorageValue(getGlobalStorageValue(5900)+1)
	   doTransformItem(item.uid, item.itemid+1)
   end
return true
end

Oh, you need storage 8 to pass tp
 
LUA:
local reset, t = function(p)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end, {}

function onUse(cid, item, frompos, item2, topos)
	if item.itemid == 1945 then
		doTransformItem(item.uid, 1946)
		t[item.uid] = addEvent(reset, 4 * 60000, frompos)
	else
		stopEvent(t[item.uid])
		t[item.uid] = nil
		doTransformItem(item.uid, 1945)
	end
	return TRUE
end
All levers should have uids, and the teleport should check if they're all pulled
 
It can't add storage, it's like your friend should be able to pull it, and you yourself able to enter the teleport~

I made one but it don't work, here it is:

LUA:
function ChangeBack(cid)
doTransformItem(getThingfromPos({x=33382, y=32786, z=14, stackpos=1}).uid, 1945)
end

function onUse(cid, item, item2, topos, frompos)
if item.actionid == 999 and item.itemid == 1945 then
doTransformItem(getThingfromPos({x=33382, y=32786, z=14, stackpos=1}).uid, 1946)
addEvent(ChangeBack, 15000, cid)
elseif item.actionid == 999 and item.itemid == 1946 then
doTransformItem(getThingfromPos({x=33382, y=32786, z=14, stackpos=1}).uid, 1945)
end
return 1
end

And the console error:

Code:
Lua Script Error: [Action Interface]
in a timer event called from:
data/actions/scripts/ankrahmun/script.lua:onUse

luaDoRemoveItem(). Item not found
 
it doesnt work for me, what should i add more to cykotitan's script to make it work? i gave uid's to all levers and added
<action uniqueid="6003" event="script" value="leversteleport.lua"/>
but i dont know how can i script the teleport?
 
You should add like this:
Code:
1. Lever: <action uniqueid="6001" event="script" value="leversteleport.lua"/>
2. Lever: <action uniqueid="6002" event="script" value="leversteleport.lua"/>
3. Lever: <action uniqueid="6003" event="script" value="leversteleport.lua"/>
4. Lever: <action uniqueid="6004" event="script" value="leversteleport.lua"/>
5. Lever: <action uniqueid="6005" event="script" value="leversteleport.lua"/>
6. Lever: <action uniqueid="6006" event="script" value="leversteleport.lua"/>
7. Lever: <action uniqueid="6007" event="script" value="leversteleport.lua"/>
8. Lever: <action uniqueid="6008" event="script" value="leversteleport.lua"/>
 
You should add like this:
Code:
1. Lever: <action uniqueid="6001" event="script" value="leversteleport.lua"/>
2. Lever: <action uniqueid="6002" event="script" value="leversteleport.lua"/>
3. Lever: <action uniqueid="6003" event="script" value="leversteleport.lua"/>
4. Lever: <action uniqueid="6004" event="script" value="leversteleport.lua"/>
5. Lever: <action uniqueid="6005" event="script" value="leversteleport.lua"/>
6. Lever: <action uniqueid="6006" event="script" value="leversteleport.lua"/>
7. Lever: <action uniqueid="6007" event="script" value="leversteleport.lua"/>
8. Lever: <action uniqueid="6008" event="script" value="leversteleport.lua"/>

I did it and nothing happened. Because i dont know what should i make with teleport? What uid should i give to teleport?
 
look... i dont even know what should I do with a teleport, how is it combined with the levers? What ui'd should it has? Because I scripted the levers, they transform and so. The levers work, but i can enter the teleport even without moving the levers. Do i need to script the teleport also? How then.
 
You should add like this:
Code:
1. Lever: <action uniqueid="6001" event="script" value="leversteleport.lua"/>
2. Lever: <action uniqueid="6002" event="script" value="leversteleport.lua"/>
3. Lever: <action uniqueid="6003" event="script" value="leversteleport.lua"/>
4. Lever: <action uniqueid="6004" event="script" value="leversteleport.lua"/>
5. Lever: <action uniqueid="6005" event="script" value="leversteleport.lua"/>
6. Lever: <action uniqueid="6006" event="script" value="leversteleport.lua"/>
7. Lever: <action uniqueid="6007" event="script" value="leversteleport.lua"/>
8. Lever: <action uniqueid="6008" event="script" value="leversteleport.lua"/>

Code:
<action uniqueid="6001-6008" event="script" value="leversteleport.lua"/>
 
Back
Top