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

2min delay and then create teleport? how?

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
I'm need some help with this script.

As you can see a teleport will be created when Azerus is going down. I wan't it to create two teleport and a delay before the teleports a created, about 2 min should the delay be.. Im have been trying and searching but i can't really get it to work..
I tried to add "addEvent(onDeath, delay, 10000)" before " doCreateTeleport(config.teleportId, pos[1], pos[2]) " But then i just got errors in the console..

Code:
local config = { 
    message = "Azerus ran into teleporter! It will disappear in 2 minutes. Enter It!", 
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position 
        ["Azerus"] = { { x = 32784, y = 31169, z = 9 }, { x = 32783, y = 31177, z = 9 }}, 



            } 
} 


function onDeath(cid, corpse, killer) 
    local position = getCreaturePosition(cid) 
    for name, pos in pairs(config.bosses) do 
        if name == getCreatureName(cid) then 
        doCreateTeleport(config.teleportId, pos[1], pos[2]) 
        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) 
        end 
    end 
    return TRUE 
end
 
try this not tested
Lua:
local config = { 
    message = "Azerus ran into teleporter! It will disappear in 2 minutes. Enter It!", 
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position 
        ["Azerus"] = { { x = 32784, y = 31169, z = 9 }, { x = 32783, y = 31177, z = 9 }}, 



            } 
} 


function onDeath(cid, corpse, killer) 
    local position = getCreaturePosition(cid) 
    for name, pos in pairs(config.bosses) do 
        if name == getCreatureName(cid) then 
        addevent(doDelay,120000)
        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1) 
        end 
    end 
    return TRUE 
end
function doDelay()
    doCreateTeleport(config.teleportId, pos[1], pos[2]) 


end
 
errorsx.png
 
Code:
local config =  {
    message = "Azerus ran into teleporter! It will disappear in 2 minutes. Enter It!",
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position
        ["Azerus"] = { { x = 32784, y = 31169, z = 9 }, { x = 32783, y = 31177, z = 9 }}
		}
}

function onDeath(cid, corpse, killer)
local position = getCreaturePosition(cid)
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(cid) then
			addEvent(doDelay, 120*1000)
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
		end
	end
return true
end

function doDelay()
    doCreateTeleport(config.teleportId, pos[1], pos[2])
end
 
Well now the tp was created after Azerus death, and the delay seems to work correctly but after 2 min i got some errors in the console.
errors2.png


By the way, thanks for your help so far :)
 
it wont work cause the "for name, pos in pairs(config.bosses) do
" has his "end" before the delay..

Lua:
local config =  {
    message = "Azerus ran into teleporter! It will disappear in 2 minutes. Enter It!",
    teleportId = 1387,
    bosses = { -- Monster Name, Teleport To Position, Teleport Position
        ["Azerus"] = { { x = 32784, y = 31169, z = 9 }, { x = 32783, y = 31177, z = 9 }}
		}
}

function onDeath(cid, corpse, killer)
local position = getCreaturePosition(cid)
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(cid) then
			addEvent(doCreateTeleport, 120*1000, config.teleportId, pos[1], pos[2])
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
		end
	end
return true
end
 
Thank you very much it works perfect. One more thing! Atm the script create one teleport with a certian pos.. I need it to create two teleports with different pos.. I tried to copy paste but can't get it to work propely.

Thx in advanced!
 
Code:
local t = {
	["azerus"] = {
		message = "Azerus ran into teleporter! It will disappear in 2 minutes. Enter It!",
		teleports = {
			{
				delay = 120,
				destination = {x=32784, y=31169, z=9},
				create = {x=32783, y=31177, z=9}
			},
			{
				delay = 240,
				destination = {x=32784, y=31169, z=9},
				create = {x=32783, y=31177, z=9}
			},
		}
	}
}
function onDeath(cid, corpse, deathList)
	local k = t[getCreatureName(cid):lower()]
	if k then
		for i = 1, #k.teleports do
			local v = k.teleports[i]
			addEvent(doCreateTeleport, v.delay * 1000, 1387, v.destination, v.create)
		end
		doCreatureSay(cid, k.message, TALKTYPE_ORANGE_1)
	end
	return true
end
 
Back
Top