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

Switch

allashal

New Member
Joined
Oct 28, 2009
Messages
16
Reaction score
0
Hello! Mabye a litte nobbie question but.
How do i make a switch that if i pull the switch it will move a squere of a wall?
 
Use search Function?
Save as: wall1.lua (Can be renamed!)
PHP:
-- Script made by Tosse12
-- Works only with levers with id 1946 or 1945!

-- Change this! --
local lever = xxx -- Unique ID at Lever (change unique id to yours)
local wallid1 = xxxx -- ID at wall (which id your wall have)

-- Change Pos at your wall here! (Do not change Stackpos)
local W1 = {x=1000, y=1000, z=7, stackpos = 255} -- Wall pos!

-- DO NOT CHANGE!
local getw1 = getThingFromPos(w1)

function onUse(cid, item, frompos, item2, topos)
	if item.itemid == 1945 and item.uid == lever then
		doRemoveItem(wallid1, getw1)
		doTransformItem(item.uid, item.itemid+1)

	elseif item.itemid == 1946 and item.uid == lever then
		doCreateItem(wallid1, getw1)
		doTransformItem(item.uid, item.itemid-1)
end
return 1
end

In your action.xml file add following:
PHP:
<action uniqueid="xxx" event="script" value="wall1.lua"/>
Change uniqueid to the id u set in mapeditor
 
Last edited:
Error

i get this error

[Warning - Event::loadScript] Cannot load script (data/actions/scripts/wall.lua)

Script


local lever = 2000 -- Unique ID at Lever (change unique id to yours)
local wallid1 = 5010 -- ID at wall (which id your wall have)


local W1 = {x=1054, y=1034, z=6, stackpos = 255} -- Wall pos!

local getw1 = getThingFromPos(w1)

function onUse(cid, item, frompos, item2, topos)
if item.itemid == 1945 and item.uid == lever then
doRemoveItem(wallid1, getw1)
doTransformItem(item.uid, item.itemid+1)

elseif item.itemid == 1946 and item.uid == lever then
doCreateItem(wallid1, getw1)
doTransformItem(item.uid, item.itemid-1)
end
return 1
end

Actions
<action uniqueid="2000" event="script" value="wall.lua"/>
 
Back
Top