• 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 Lever/Switch Remove magicwall

absorc

Ask-her
Joined
Oct 7, 2013
Messages
57
Reaction score
4
Location
Sweden
Hello.
I've been following tutorials on Lua scripting and made some of my own with no problems like removing 3 walls with movements.lua and some advanced quests. Anyways..

Failed many many times when trying to make one specific action using a lever/switch.

What I need is a script like this.

You pull a lever.
A magicwall removes and a ladder appears so you can go down.
When you pull it again it add a tile id 407 and put magicwall back to the same place.

Lua:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x = 32266, y = 31860, z = 11, stackpos = 1}
getgate = getThingfromPos(gatepos)

if item.uid == 9008 and item.itemid == 1945 and getgate.itemid == 1498 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 9008 and item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(1498,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Not Possible")
end
return TRUE
end

This is the default script but I want you guys to add ladder id 428 and when you remove ladder i want tile id 407 to appear or the magicwall will fall down in the ladder hole.
 
First Of All:
this is action/Movement/Talkaction not requests
2nd:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {X=XXX, Y=YYY, Z=ZZZ} -- The Pos [EDIT HERE][Example: X=1000, Y=1000, Z=7]
local stone = 1498-- ID of the stone [DO NOT EDIT]
local stoneFromPos = getThingfromPos(pos)  -- It get item uid

if item.itemid == 1945 then
doRemoveItem(stoneFromPos.uid, 1) 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You removed the Stone.") -- DO NOT EDIT
doTransformItem(item.uid, 1946) 
elseif item.itemid == 1946 then
doCreateItem(1498, 1, pos)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You added a Lever.")
doTransformItem(item.uid, 1945)  -- It transform switch to id 1945
end
end

not 100% working i just copied it. you can edit this one
 
I already made this script V
Yes, but I had a problem with the magicwall. When you used the lever again the magicwall would fall down one floor because it is placed on the ladders hole. But I managed to fix it later on with movement.lua and some help.
 
Yes, but I had a problem with the magicwall. When you used the lever again the magicwall would fall down one floor because it is placed on the ladders hole. But I managed to fix it later on with movement.lua and some help.
Did you tried with doCreateTile?
 

Similar threads

Back
Top