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

[Request] disappearing wall

zajacmp3

New Member
Joined
Jan 5, 2009
Messages
35
Reaction score
0
Location
Poland, Gdansk
Heya guys! First i will present u a code that is not working on my TFS 0.2 : < The code is supposed to work on evolution server...
Can this work on my?
With this first one i havent got any errors in console... it just didnt work in game.

PHP:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=1142, y=1102, z=6, stackpos=1}
getgate = getThingfromPos(gatepos)

if item.uid == 6001 and item.itemid == 1945 and getgate.itemid == 3519 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 6001 and item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(3519,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Niedziala :<")
end
return 1
end

I first tried with this code but i had only errors with it.

PHP:
function onUse(cid, item, frompos, item2, topos)
gatepos = {x=1093, y=963, z=7, stackpos=1}
getgate = getThingfromPos(gatepos)
if item.uid == 3001 and item.itemid == 1945 and getgate.itemid == 3361 then
doRemoveItem(getgate.uid,1)
doTransformItem(item.uid,item.itemid+1)
elseif item.uid == 3001 and item.itemid == 1946
and getgate.itemid == 0 then
doCreateItem(3361,1,gatepos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end


hmmm... can anyone help me?
 
Last edited:
This script will remove a wall (or any other item you define) when you use a lever. It will also make it appear again if you use the lever again.

removeWall.lua

PHP:
function onUse(cid, item, frompos, item2, topos)

local wallpos1	= {x=428, y=649, z=12, stackpos=1}   --- coordinates of the wall to be removed ---
local wall1	= getThingfromPos(wallpos1)
local wallID	= 1354 --- item id of the wall to be removed ---


	if item.itemid == 1945 then

		doRemoveItem(wall1.uid, 1)
		doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")


	elseif item.itemid == 1946 then

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

	end

end

All you have to do is assign a unique ID of your choice to a lever on your map (via a map editor) and then create a line for it in the actions.xml file.

Example:

PHP:
<action uniqueid="2222" script="quests/removeWall.lua"/>

Of course you also have to edit the coordinates and item ID of the wall you want to have removed.
 
THX its working but only one way : ) the wall doesnt appear back but the message does ; )
I have also this error in console after i want to get the wall back using the lever again.
PHP:
[03/02/2029  17:53:01] Lua Script Error: [Action Interface] 
[03/02/2029  17:53:01] data/actions/scripts/quests/removeWall.lua:onUse

[03/02/2029  17:53:01] luaDoRemoveItem(). Item not found

Maybe some modification : ) And can a single lever make remove more than one wall? (i need 3 : P )
Thanks again & REP + : )
 
PHP:
function onUse(cid, item, frompos, item2, topos)

local wallpos1    = {x=428, y=649, z=12, stackpos=1}
local wallpos2    = {x=428, y=649, z=12, stackpos=1}
local wallpos3    = {x=428, y=649, z=12, stackpos=1}
local wall1    = getThingfromPos(wallpos1)
local wall2    = getThingfromPos(wallpos2)
local wall3    = getThingfromPos(wallpos3)
local wallID    = 1354 --- item id of the wall to be removed ---


    if item.itemid == 1945 then

        doRemoveItem(wall1.uid, 1)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")


    elseif item.itemid == 1946 then

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

    end

    if item.itemid == 1945 then

        doRemoveItem(wall2.uid, 2)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")


    elseif item.itemid == 1946 then

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

    end

    if item.itemid == 1945 then

        doRemoveItem(wall3.uid, 3)
        doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")


    elseif item.itemid == 1946 then

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

    end

end
 
No need for several if cases, this works, too (for as many walls as you like).

PHP:
function onUse(cid, item, frompos, item2, topos)

local wallpos1    = {x=428, y=649, z=12, stackpos=1}   --- coordinates of the wall to be removed ---
local wallpos2    = {x=427, y=649, z=12, stackpos=1}
local wallpos3    = {x=426, y=649, z=12, stackpos=1}
local wall1    = getThingfromPos(wallpos1)
local wall2    = getThingfromPos(wallpos2)
local wall3    = getThingfromPos(wallpos3)
local wallID    = 1354 --- 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 == 1946 then

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

    end

end

You need to place the lever 1945 with a unique ID of your choice on your map. For WallID you have to enter the item ID of the wall you want to have removed/reappeared. The coordinates are of course the walls coordinates on the map.
 
Yey! THX! REP+ too !
But it didnt work on 100% cause the lever did not change from 1945 to 1946 ID so temporary i have 2 levers ; )
One 1945 and one 1946 : )
At first open only Wallpos1 is removed but after using it second time i work properly in both ways!
Thanks a lot guys!
This forum is great :D
 
Actually when you use lever 1945 it should remove 3 walls and transform to lever 1946. If you use lever 1946 it should add 3 walls and transform to lever 1945. Atleast that's how it works on my TFS0.3b3.
 
I have the older version of TFS maybe this is the problem : )
I have a question with the TFS0.3b3. Is there many crashes or bugs in it? Cause there are 3 beta versions. I had first but it was disappointing...
 
Oh I meant beta2 not beta3.

Anyway, I've been messing around with the second beta for quite a while and had no crashes or alike.
 
Back
Top