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

Switch and remove stone..

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
i have search but i cant find a working script for this
when u pull a "lever" it will remove a stone and come up a msg like "the stone will be removed for 10 sec" and after 10 sec the stone come back and u need to pull the "lever" to remove it again
tfs 0.3.5/0.3.6
 
LUA:
local config = {
lever_used = 9828 -- Id for the lever when used
lever = 9824, -- Id for lever
stoneID = 1359, -- Obviously id for the stone your using
resetTime = 30, -- Minutes for the stone to reset its position.
stonePosition = {x=596, y=850, z=12,stackpos=1}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
function resetEntrance(cid)
if getThingFromPos(config.stonePosition).itemid > config.stoneID or getThingFromPos(config.stonePosition).itemid < config.stoneID then
doCreateItem(config.stoneID,1,config.stonePosition)
doTransformItem(lever_used,lever)
else
stopEvent(resetEntrance,cid)
end
end
  
if item.itemid == lever then
	addEvent(resetEntrance,config.resetTime*60*1000,cid)
	doTransformItem(lever,lever_used+1)
	doSendMagicEffect(config.stonePosition,44)
	doRemoveItem(getThingFromPos(config.stonePosition).uid,1)
end
return true
end

Go ahead and try that. Rep me if i helped.

Edited..

LUA:
local config = {
lever_used = 9828 -- Id for the lever when used
lever = 9824, -- Id for lever
stoneID = 1359, -- Obviously id for the stone your using
resetTime = 30, -- Minutes for the stone to reset its position.
stonePosition = {x=596, y=850, z=12,stackpos=1}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
function resetEntrance(cid)
if getThingFromPos(config.stonePosition).itemid > config.stoneID or getThingFromPos(config.stonePosition).itemid < config.stoneID then
doCreateItem(config.stoneID,1,config.stonePosition)
doTransformItem(lever_used,lever)
else
stopEvent(resetEntrance,cid)
end
end
  
if item.itemid == lever then
	addEvent(resetEntrance,config.resetTime*60*1000,cid)
	doTransformItem(lever,lever_used+1)
	doSendAnimatedText(fromPosition,"You have 10 seconds before the stone returns!", 192)
	doSendMagicEffect(config.stonePosition,44)
	doRemoveItem(getThingFromPos(config.stonePosition).uid,1)
end
return true
end

I edited in the Message "You have 10 seconds before the stone returns!"
 
XML:
	<action actionid="XXXX" event="script" value="removeStone.lua"/>

XXXX - lever's actionid


LUA:
local config = {
	stoneId = 3361,
	pos = {x=99, y=117, z=7},
	time = 5, -- seconds
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		if getTileItemById(config.pos, config.stoneId).uid > 0 then
			doRemoveItem(getTileItemById(config.pos, config.stoneId).uid)
			doCreatureSay(cid, 'The stone will be removed for '..config.time..' sec', TALKTYPE_MONSTER)
			addEvent(doCreateItem, config.time * 1000, config.stoneId, 1, config.pos)
		else
			doPlayerSendCancel(cid, 'The stone is removed already.')
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top