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

Lever Remove Wall [REQUEST]

You added onStepIn with a table? o_O
PHP:
function onUse(cid, item, frompos, item2, topos)

local wallpos1    = {x=420, y=791, z=7, stackpos=1}   --- coordinates of the wall to be removed ---
local wallpos2    = {x=421, y=791, z=7, stackpos=1}
local wallpos3    = {x=422, y=791, z=7, stackpos=1}
local wall1    = getThingfromPos(wallpos1)
local wall2    = getThingfromPos(wallpos2)
local wall3    = getThingfromPos(wallpos3)
local wallID    = 9485 --- item id of the wall to be removed ---


    if item.itemid == 1945 then

        doRemoveItem(wall1.uid, 1)
        doRemoveItem(wall2.uid, 1)
        doRemoveItem(wall3.uid, 1)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")
        
    elseif item.itemid == 1945 then

        doCreateItem(wallID, 1, wallpos1)
        doCreateItem(wallID, 1, wallpos2)
        doCreateItem(wallID, 1, wallpos3)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")

    end
    return TRUE
end
 
should work:
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
	if isWallRemoved == FALSE then
		for i=1,#walls do
			doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
		end
		isWallRemoved = TRUE
	else
		for i=1,#walls do
			doCreateItem(walls[i][2], 1, walls[i][1])
		isWallRemoved == FALSE
		end
	end
	doPlayerSendTextMessage(cid,22, str) 
end

add in actions by uniqueid. ; )
 
Last edited:
You added onStepIn with a table? o_O
PHP:
function onUse(cid, item, frompos, item2, topos)

local wallpos1    = {x=420, y=791, z=7, stackpos=1}   --- coordinates of the wall to be removed ---
local wallpos2    = {x=421, y=791, z=7, stackpos=1}
local wallpos3    = {x=422, y=791, z=7, stackpos=1}
local wall1    = getThingfromPos(wallpos1)
local wall2    = getThingfromPos(wallpos2)
local wall3    = getThingfromPos(wallpos3)
local wallID    = 9485 --- item id of the wall to be removed ---


    if item.itemid == 1945 then

        doRemoveItem(wall1.uid, 1)
        doRemoveItem(wall2.uid, 1)
        doRemoveItem(wall3.uid, 1)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")
        
    elseif item.itemid == 1945 then

        doCreateItem(wallID, 1, wallpos1)
        doCreateItem(wallID, 1, wallpos2)
        doCreateItem(wallID, 1, wallpos3)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")

    end
    return TRUE
end

[27/02/2009 22:52:43] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/removeWall.lua
[27/02/2009 22:52:43] data/actions/scripts/quests/removeWall.lua:26: 'end' expected (to close 'function' at line 1) near '<eof>'
 
should work:
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
	if isWallRemoved == FALSE then
		for i=1,#walls do
			doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
		end
		isWallRemoved = TRUE
	else
		for i=1,#walls do
			doCreateItem(walls[i][2], 1, walls[i][1])
		isWallRemoved == FALSE
		end
	end
	doPlayerSendTextMessage(cid,22, str) 
    return TRUE
end

add in actions by uniqueid. ; )

[27/02/2009 22:52:20] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/removeWall.lua
[27/02/2009 22:52:20] data/actions/scripts/quests/removeWall.lua:17: '=' expected near '=='
 
tHE WALL I Want to appear back again, is the same wall ID that dissapears,

WALLID: 9485

now please help me with finnishing this script, Rep++.
 
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
    if isWallRemoved == FALSE then
        for i=1,#walls do
            doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
        end
        isWallRemoved = TRUE
    else
        for i=1,#walls do
            doCreateItem(walls[i][2], 1, walls[i][1])
        isWallRemoved = FALSE
        end
    end
    doPlayerSendTextMessage(cid,22, str) 
    return TRUE
end
Look now, i miss put twice "=" should be once.
 
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
    if isWallRemoved == FALSE then
        for i=1,#walls do
            doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
        end
        isWallRemoved = TRUE
    else
        for i=1,#walls do
            doCreateItem(walls[i][2], 1, walls[i][1])
        isWallRemoved = FALSE
        end
    end
    doPlayerSendTextMessage(cid,22, str) 
    return TRUE
end
Look now, i miss put twice "=" should be once.


You did something wrong, can't even pull the lever now.
 
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
    if isWallRemoved == FALSE then
        for i=1,#walls do
            doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
        end
        isWallRemoved = TRUE
    else
        for i=1,#walls do
            doCreateItem(walls[i][2], 1, walls[i][1])
        isWallRemoved = FALSE
        end
    end
    doPlayerSendTextMessage(cid,22, str) 
    return TRUE
end
Look now, i miss put twice "=" should be once.


Bump~~ Everything worked, u just forgot to add the lever
[ID 1945] And when pulled [1946]
 
PHP:
local walls = {
{{x=420, y=791, z=7, stackpos=1},9485},
{{x=421, y=791, z=7, stackpos=1},9485},
{{x=422, y=791, z=7, stackpos=1},9485},
}
local str = "Something has moved not too far away."
isWallRemoved = FALSE
function onUse(cid, item, frompos, item2, topos)
	if item.itemid == 1945 then
		if isWallRemoved == FALSE then
			for i=1,#walls do
				doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
			end
				isWallRemoved = TRUE
			else
			for i=1,#walls do
				doCreateItem(walls[i][2], 1, walls[i][1])
			isWallRemoved = FALSE
			end
		end
		doTransformItem(item.uid, item.itemid+1)
		doPlayerSendTextMessage(cid,22, str)
	elseif item.itemid === 1946 then
		doTransformItem(item.uid, item.itemid-1)
end
    return TRUE
end
 
this script should work also remember to put UID:9485 on the switch in the mapeditor

PHP:
function onUse(cid, item, frompos, item2, topos)
		gatepos1 = {x=420, y=791, z=7, stackpos=1}
		gatepos2 = {x=421, y=791, z=7, stackpos=1}
		gatepos3 = {x=422, y=791, z=7, stackpos=1}

	if item.uid == 9485 and item.itemid == 1945 then
		doRemoveItem(9485,1,gatepos1)
		doRemoveItem(9485,1,gatepos2)
		doRemoveItem(9485,1,gatepos3)
	doTransformItem(item.uid,item.itemid+1)

elseif item.uid == 9485 and item.itemid == 1946 then
	doCreateItem(9485,1,gatepos1)
	doCreateItem(9485,1,gatepos2)
	doCreateItem(9485,1,gatepos3)
	doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
		end
  	return 1
  	end
  return 1
  end
end
 
Last edited:
this script should work also remember to put UID:9485 on the switch in the mapeditor

PHP:
function onUse(cid, item, frompos, item2, topos)
		gatepos1 = {x=420, y=791, z=7, stackpos=1}
		gatepos2 = {x=421, y=791, z=7, stackpos=1}
		gatepos3 = {x=422, y=791, z=7, stackpos=1}

	if item.uid == 9485 and item.itemid == 1945 then
		doRemoveItem(9485,1,gatepos1)
		doRemoveItem(9485,1,gatepos1)
		doRemoveItem(9485,1,gatepos1)
	doTransformItem(item.uid,item.itemid+1)

elseif item.uid == 9485 and item.itemid == 1946 then
	doCreateItem(9485,1,gatepos1)
	doCreateItem(9485,1,gatepos2)
	doCreateItem(9485,1,gatepos3)
	doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry not possible.")
		end
  	return 1
  	end
  return 1
  end

The walls that's being removed is ID 9485... The levers ID are 1945 and 1946, and your script didn't work anyway.

[28/02/2009 07:38:05] Warning: [Event::loadScript] Can not load script. data/actions/scripts/quests/removeWall.lua
[28/02/2009 07:38:05] data/actions/scripts/quests/removeWall.lua:23: '<eof>' expected near 'end'

-Also a reminder, I'm using TFS 0.2 (Mystic Spirit)
 
#Pitufo
You no need looking for lever id, because swich.lua is script which push it, and in global veriable save data with wall removed or no. : )
 
plx.
Code:
local walls = 
{
    {{x=420, y=791, z=7, stackpos=1}, 9485},
    {{x=421, y=791, z=7, stackpos=1}, 9485},
    {{x=422, y=791, z=7, stackpos=1}, 9485}
}
local str = "Something has moved not too far away."
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1945) then
        for i = 1, table.maxn(walls) do
            doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
        end
        doTransformItem(item.uid, 1946)
    elseif(item.itemid == 1946) then
        for i = 1, table.maxn(walls) do
            doCreateItem(walls[i][2], 1, walls[i][1])
        end
        doTransformItem(item.uid, 1945)
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) 
    return TRUE
end
 
plx.
Code:
local walls = 
{
    {{x=420, y=791, z=7, stackpos=1}, 9485},
    {{x=421, y=791, z=7, stackpos=1}, 9485},
    {{x=422, y=791, z=7, stackpos=1}, 9485}
}
local str = "Something has moved not too far away."
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(item.itemid == 1945) then
        for i = 1, table.maxn(walls) do
            doRemoveItem(getThingFromPos(walls[i][1]).uid, 1)
        end
        doTransformItem(item.uid, 1946)
    elseif(item.itemid == 1946) then
        for i = 1, table.maxn(walls) do
            doCreateItem(walls[i][2], 1, walls[i][1])
        end
        doTransformItem(item.uid, 1945)
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) 
    return TRUE
end

Guys, now help me make a script for client version TFS 0.2 Mystic spirit ok???? This isn't the Crying damson or something..

I Cant even pull the lever with ur script.
 
Back
Top