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

Script needed

Spo teh pro

New Member
Joined
Jan 3, 2008
Messages
319
Reaction score
1
Could you give me following script please?

If you put ITEM ID 5527 on for example; X:1019, Y:944, Z:7,
You need to pull a lever and it removes the ITEM on X:1019, Y:944, Z:7 also it removes a wall at [X: 1017] [Y: 946] [Z: 11].

Could someone make a script for this?

im using tfs 0.3.2
 
Last edited:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local itemPos = {x=1019, y=944, z=7, stackpos=1}
local wallPos = {x=1017, y=946, z=7, stackpos=1}
local item = 5527
local getItem = getThingFromPos(itemPos)
local getWall = getThingFromPos(wallPos)

if item.uid == UNIQUE_ID and item.itemid == 1945 then
	if getItem.itemid == item then
		if getWall.itemid > 0 then

	doRemoveItem(getItem.uid, 1)
	doRemoveItem(getWall.uid, 1)
	doSendMagicEffect(wallPos, CONST_ME_POFF)
	doTransformItem(item.uid, item.itemid+1)
else
	doPlayerSendCancel(cid, "The wall already has been removed.")
	end
else
	doPlayerSendCancel(cid, "You need to put " .. getItemArticleById(item) .. " " .. getItemName(item) .. " in the correct place.")
	end
else
	doPlayerSendCancel(cid, "Sorry, not possible.")
	end

elseif item.uid == UNIQUE_ID and item.itemid == 1946 then
	doTransformItem(item.uid, item.itemid-1)
end

not tested
 
[13/04/2009 17:03:04] [Warning - Event::loadScript] Can not load script (data/actions/scripts/quests/script.lua)
[13/04/2009 17:03:04] data/actions/scripts/quests/script.lua:26: 'end' expected (to close 'function' at line 1) near 'elseif

btw the lever needs a unique id right?
not a action id
 
Using this script, the lever needs to have Unique ID set to 30000. You can change that by modifying local uniqueid = ""

PHP:
local itemPos = {x=1019, y=944, z=7, stackpos=1}
local wallPos = {x=1017, y=946, z=11, stackpos=1}
local item = 5527
local wall = ID OF WALL
local uniqueid = 30000 -- Unique ID used for the lever

function onUse(cid, item, fromPosition, itemEx, toPosition)

local getItem = getThingFromPos(itemPos)
local getWall = getThingFromPos(wallPos)

if item.uid == uniqueid and item.itemid == 1945 then
	if getItem.itemid == item then
		if getWall.itemid == wall then
			doRemoveItem(getItem.uid, 1)
			doRemoveItem(getWall.uid, 1)
			doSendMagicEffect(wallPos, CONST_ME_POFF)
			doTransformItem(item.uid, item.itemid+1)
		else
			doPlayerSendCancel(cid, "The wall already has been removed.")
		end
	else
		doPlayerSendCancel(cid, "You need to put " .. getItemArticleById(item) .. " " .. getItemName(item) .. " in the correct place.")
	end
else
	doPlayerSendCancel(cid, "Sorry, not possible.")
end

if item.uid == uniqueid and item.itemid == 1946 then
	doTransformItem(item.uid, item.itemid-1)
end

return true
end
 
Back
Top