Lever Remove Wall [REQUEST]

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
Close

Close
 
Last edited:
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
Bump~~
 
Last edited:

Zoriath

New Member
Joined
Mar 26, 2008
Messages
1,496
Best answers
0
Reaction score
3
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
 

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
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:
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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>'
 
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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 '=='
 
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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++.
 

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
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.
 
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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.
 
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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]
 

Pitufo™

InfinityOT.com
Joined
Feb 14, 2008
Messages
1,438
Best answers
0
Reaction score
7
Location
Mexico, Cuernavaca
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
 

Mummrik

Hey!
Joined
Oct 22, 2007
Messages
680
Best answers
25
Reaction score
108
Location
Sweden
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:
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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)
 

Azi

Banned User
Joined
Aug 12, 2007
Messages
1,167
Best answers
0
Reaction score
51
Location
Włocławek
#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. : )
 

Piotrek1447

Member
Joined
Jun 1, 2007
Messages
658
Best answers
0
Reaction score
16
Location
Rzeszów, Poland
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
 
OP
Evil Mark

Evil Mark

Active Member
Joined
Nov 23, 2008
Messages
1,681
Best answers
0
Reaction score
28
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.
 
Top