• 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 Delay Before doRemoveCreature

VJ2354

New Member
Joined
Jan 17, 2013
Messages
39
Reaction score
0
Hello, I'm trying to edit this script so that instead of removing the creature it's set to remove straight away, it will do it after 10 seconds. I think I'm supposed to use the addevent function, but I'm not sure in what context to use it. Here is the script :-

Code:
function onStepIn(cid, item, pos)
 local from = {x = 33183, y = 32831, z = 9}
    local to = {x = 33232, y = 32863, z = 9}
    local monster = "Thief"
    for x = from.x, to.x do
        for y = from.y, to.y do
            for z = from.z, to.z do
                pos = {x = x, y = y, z = z, stackpos = 253}
                v = getThingfromPos(pos).uid
                if isMonster(v) and getCreatureName(v) == monster then
				   doRemoveCreature(v)
                end
            end
        end
    end
return true
end

Hopefully somebody will be able to edit it so that instead of removing the "Thief" straight away it will wait 10 seconds... Thanks for you time.
 
Code:
local function remove(cid)
   if isCreature(cid) then
      doRemoveCreature(cid)
   end
end

local timeToRemove = 10 --in seconds

function onStepIn(cid, item, pos)
 local from = {x = 33183, y = 32831, z = 9}
    local to = {x = 33232, y = 32863, z = 9}
    local monster = "Thief"
    for x = from.x, to.x do
        for y = from.y, to.y do
            for z = from.z, to.z do
                pos = {x = x, y = y, z = z, stackpos = 253}
                v = getThingfromPos(pos).uid
                if isMonster(v) and getCreatureName(v) == monster then
				   addEvent(remove, timeToRemove*1000, v)
                end
            end
        end
    end
return true
end
 
Thank you so much, it's working perfectly now. Would you also be able to help me with this? :-

Code:
function onStepIn(cid, item, pos)

local splash = {x=33186, y=32844, z=7}

    if item.uniqueid <= 65452 and item.uniqueid >= 65440 then
	    addEvent(doCreateMonster,2*1000,"thief", {x=33187, y=32851, z=9})
		doCreatureSay(cid, 'splash.', TALKTYPE_ORANGE_1)
		addEvent(doTeleportThing, 5*1000, cid, splash)
	end
end

However instead of the thief being summoned on a specific spot using the XYZ, I want it to be summoned 1 square infront of the player, hopefully that makes sense....
 
Lua:
function onStepIn(cid, item, pos)

local splash = {x=33186, y=32844, z=7}
local pos = getPlayerPosition(cid)

    if item.uniqueid <= 65452 and item.uniqueid >= 65440 then
	    addEvent(doCreateMonster,2*1000,"thief", {x=pos.x+1,y=pos.y-1, z=pos.z}}
		doCreatureSay(cid, 'splash.', TALKTYPE_ORANGE_1)
		addEvent(doTeleportThing, 5*1000, cid, splash)
	end
end
 
Back
Top