• 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: Lever+RemoveItem+Time

krotus

New Member
Joined
Jul 15, 2009
Messages
65
Reaction score
3
First request : I would like a script which with a lever that removes a specific itemId as wall/s or something like that by few seconds or minutes.
Second request: It's similar than the first but I'd like removes that specific wall killing a monster.

This scripts would be useful get them, because if someone wanted to make a quest and the hunter needs to click the lever to advance his way forward. Or kill a monster to continues the way and if you don't kill it, you don't follow.

I think that is from action folder and I need to configure there....

Someone gives me a hand, help??

Thanks!

pd: I'm currently working on 0.4 and 0.3.6 version server.
 
Lua:
local pinkstonepos1 = {x=967, y=1097, z=14}        -- Blocking stone position.
local LeverPos      = { x = 983, y = 1096, z = 14} -- Lever Position
local timeToRemove  = 10 -- Time before quest reset

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

local pinkstone1 = getTileItemById(pinkstonepos1, 9533) -- You can change the ID to any other kind of blocking item

        if item.itemid == 1945 then

            doRemoveItem(pinkstone1.uid, 1)
            doPlayerSendTextMessage(cid,22,"The gate is removed for 15 seconds.") -- Message when the lever is pulled
            addEvent(doRemoveTeleport, timeToRemove * 1000)

    else if item.itemid == 1946 then

        doPlayerSendCancel(cid,"Sorry, not possible.") -- message if the lever is pulled again.

    return 1

    end
end  

end

function doRemoveTeleport()

local Lever = getTileItemById(LeverPos, 1946)
		doCreateItem(9533, 1, pinkstonepos1)
        doTransformItem(Lever.uid, 1945)
		end

This is for my demon helmet quest, the pink stone can be changed to any item, just change 9533 to the item you want.
Also, the time can be changed.
 
Oh thanks you a lot! But this Lua Code where I've to copy? And how? Rep++ :)

create a .lua file in Actions, then copy and paste my script into that file.
then add this to actions.xml
XML:
	<action uniqueid="30016" event="script" value="demonhelmet.lua"/>
Then you have to put unique id 30016 on the lever/switch. You can change the 30016 number to whatever you want.
 
Yeah It works fine!
Now I need the same script but with a monster/mob which it dead, you can continue the way, like the first script.
 
Lua:
local config = {
	tile = {x=1369, y=1113, z=7},
	corpse_id = 5527,
	wall_pos = {x=1372, y=1112, z=7},
	wall_id = 9485,
	delay = 60,
	message = "You have 1 minute to enter the teleport before the gate closes."
}
function leaverBack(pos, id, new)
	return doTransformItem(getTileItemById(pos, id).uid, new)
end


function onUse(cid, item, fromPosition, itemEx, toPosition)
	local corpse = getTileItemById(config.tile, config.corpse_id)
	if item.itemid ~= 1945 then return doPlayerSendCancel(cid, "Sorry not possible.") end
	if not(corpse.uid > 0) then
		return doPlayerSendCancel(cid, "Place the dead corpse on the tile.")
	end
	local wall = getTileItemById(config.wall_pos, config.wall_id)	
	doRemoveItem(wall.uid)
	doRemoveItem(corpse.uid,1)
	doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)	
	doTransformItem(item.uid, 1946)
	addEvent(doCreateItem, config.delay*1000, config.wall_id, 1, config.wall_pos)
	addEvent(leaverBack, config.delay*1000, getThingPos(item.uid), 1946, 1945)
	return true
end

Hope you like it.
 
Thx bro! Nice idea using the corpse of the monster to demostrate that it is dead!
Everything of script works correctly!
Thanks you so much! :D

- - - Updated - - -

The two scripts works really good, but now i've a problem...
I've tried to do clones to levers script and they ingame work fine but the time that in theory it has, doesn't work.
Namely, the block stone doesn't appears again and the way/road still free.

When this happened I saw log messages and it said:
In timer event called from: {the PATH of my lua script}:eek:nUse
Description:
<luaDoTransformItem> Item not found.

Could you tell me how configure it to have two or more script like the first and second?
When there is only one, it works fine!

Thanks!
 
Last edited:
hmm i have done this but it doesn't remove the stone it just says the message
Says the message?
I'm going to assume here, that your using the first script.
Make sure that the 'pink stone' ID is correct, and that the position is correct for both the lever and the stone.
Code:
local pinkstone1 = getTileItemById(pinkstonepos1, 9533) -- You can change the ID to any other kind of blocking item
.
.
.
doCreateItem(9533, 1, pinkstonepos1)
 
Back
Top