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

Stone desappear after X time

arturhaddad

Member
Joined
Aug 14, 2010
Messages
217
Reaction score
8
Hello i need a script that do it:
*Player steps in a tile, stone appears.
*After x time stone automaticly desappears.

I have the on step create wall script:
LUA:
function onStepIn(cid, item, frompos, item2, topos) 
	wall1 = {x=32946, y=32103, z=7, stackpos=1}
	getwall1 = getThingfromPos(wall1)

	if item.uid == 14987 then
		doCreateItem(1355,1,wall1)
end
end


And the on step stone disappear timer script:
LUA:
function onStepIn(cid, item, fromPosition, itemEx, toPosition)
	local time
	local stone, stone_pos = 1355, { x = 32946, y = 32103, z = 7 }
	time = 10 -- Seconds until stone is removed.
	return addEvent(function() doRemoveItem(getTileItemById(stone_pos, stone).uid) end, time * 1000)
end


I wish to combine them, or if someone have a better script post it please.
Thanks


EDIT
SOLUTION, credits: tosuxo

LUA:
local seconds = 1 --how long after standing in until it removes the rock
local stonepos = {x = 32946, y = 32103, z = 7, stackpos=1}

function onStepIn(cid, item, frompos, item2, topos) 
    local getwall1 = getThingfromPos(stonepos)
 
    if item.uid == 14987 then
        doCreateItem(1355,1,stonepos)
                addEvent(removerock, seconds * 1000)
        end
end

function removerock()
     doRemoveItem(getThingFromPos(stonepos,1).uid,1)
end
 
Last edited:
Code:
local seconds = 1 --how long after standing in until it removes the rock
local stonepos = {x = 32946, y = 32103, z = 7, stackpos=1}

function onStepIn(cid, item, frompos, item2, topos) 
	local getwall1 = getThingfromPos(stonepos)
 
	if item.uid == 14987 then
		doCreateItem(1355,1,stonepos)
                addEvent(removerock, seconds * 1000)
        end
end

function removerock()
     doRemoveItem(getThingFromPos(stonepos,1)
end

or something along them lines
 
Last edited:
It creates but it doesn't removes the stone.
Console error:
(luaDoRemoveItem) Item not found

I think that must have a delay between function onStepIn and function removerock (don't know if it's possible).

also mini error:

function removerock()
doRemoveItem(getThingFromPos(stonepos,1))
end


forgot )
 
Code:
local seconds = 1 --how long after standing in until it removes the rock
local stonepos = {x = 32946, y = 32103, z = 7, stackpos=1}

function onStepIn(cid, item, frompos, item2, topos) 
	local getwall1 = getThingfromPos(stonepos)
 
	if item.uid == 14987 then
		doCreateItem(1355,1,stonepos)
                addEvent(removerock, seconds * 1000)
        end
end

function removerock()
     doRemoveItem(getThingFromPos(stonepos,1).uid,1)
end
attempt 2 lol
there's already a delay, the "addEvent" delays it by X seconds (set at top)
 
Good job :D
It works, i'll edit my post and give u credits.
i rep+ you

Also, i would like to learn about lua programation, how did u learn?
Sometimes I have little problems and don't know how to solve..
thanks
 
Good job :D
It works, i'll edit my post and give u credits.
i rep+ you

Also, i would like to learn about lua programation, how did u learn?
Sometimes I have little problems and don't know how to solve..
thanks

awesome, no problem :)

just read tutorials, but don't copy-paste anything, type everything out yourself, you'll get the hang of it in no time at all
start with basic stuff like a lever that gives you 1,000 exp, then a lever that tells you you got 1000 exp and gives you it, then one that lets you use it once or tells you that you already got the exp

basically: learn basic stuff, add more to it until you get the hang of it :)
 
Back
Top