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

Lua Inquisition Quest - addEvent (Remove).

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,664
Reaction score
125
Location
Warsaw, Poland
Hello i have problem with remove teleport :)

When i kill boss, all woking fine, there is teleport etc. but witin 180 sec after kill boses i have bug:

Code:
[20:27:40.023] [Error - CreatureScript Interface]
[20:27:40.023] In a timer event called from:
[20:27:40.023] data/creaturescripts/scripts/test.lua:onKill
[20:27:40.023] Description:
[20:27:40.023] (luaDoRemoveItem) Item not found

INQ script:
Lua:
local t = {
	message	= "You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room only during his time or the teleporter will disappear!",
	bosses	= {
		["Ushuriel"] = {ttp={x=1173,	y=1333,	z=12},	tp={x=1279,	y=1279,	z=10,	stackpos=1}},
		["Zugurosh"] = {ttp={x=1182,	y=1228,	z=11},	tp={x=1247,	y=1243,	z=10,	stackpos=1}},
		["Madareth"] = {ttp={x=1257,	y=1333,	z=11},	tp={x=1301,	y=1305,	z=10,	stackpos=1}},
		["Golgordan"] = {ttp={x=1142,	y=1304,	z=14},	tp={x=1336,	y=1273,	z=10,	stackpos=1}, bro = "Latrivan"},
		["Latrivan"] = {ttp={x=1142,	y=1304,	z=14},	tp={x=1336,	y=1273,	z=10,	stackpos=1}, bro = "Golgordan"},
		["Annihilon"] = {ttp={x=1303,	y=1237,	z=11},	tp={x=1301,	y=1239,	z=10,	stackpos=1}},
		["Hellgorak"] = {ttp={x=1214,	y=1233,	z=11},	tp={x=1208,	y=1277,	z=10,	stackpos=1}}
	}
}
 
function onKill(cid, target, lastHit)
	local k = t.bosses[getCreatureName(target)]
	if(not isPlayer(target)) and isPlayer(cid) and k and not(getCreatureMaster(target)) then		
			if(k.bro) then
			local bro = getCreatureByName(k.bro)
			if isMonster(bro) and getDistanceBetween(getThingPosition(cid), getThingPosition(bro)) < 12 then return true end
		end
		doCreateTeleport(1387, k.ttp, k.tp)		
		doCreatureSay(cid, t.message, TALKTYPE_ORANGE_1)
		addEvent(doRemoveThing, 180 * 1000, getTileItemById(k.tp, 1387).uid, 1)
	end
	return true
end

Any idea? :)
 
dont know but take the script i use and test.

just edit and test it
Lua:
function onDeath(cid, corpse, killer)

registerCreatureEvent(cid, "inquisitionPortals")

local creaturename = getCreatureName(cid)

local ushuriel_in_position = {x=33257, y=31643, z=12, stackpos=2}
local annihilon_in_position = {x=33432, y=31890, z=13, stackpos=2}
local hellgorak_in_position = {x=33129, y=32000, z=10, stackpos=2}
local madareth_in_position = {x=33135, y=31879, z=13, stackpos=2}
local zugurosh_in_position = {x=33184, y=31946, z=13, stackpos=2}
local brothers_in_position = {x=33298, y=31764, z=13, stackpos=1}

local ushuriel_to_position = {x=32966, y=31979, z=13, stackpos=1}
local annihilon_to_position = {x=33088, y=32101, z=13, stackpos=1}
local hellgorak_to_position = {x=33049, y=31887, z=13, stackpos=1}
local madareth_to_position = {x=33081, y=31785, z=13, stackpos=1}
local zugurosh_to_position = {x=33108, y=31893, z=13, stackpos=1}
local brothers_to_position = {x=33202, y=31833, z=13, stackpos=1}

local time_to_pass = 180
local tpID = 5023
local doEffect = CONST_ME_ENERGYHIT
local message = "You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room only during his time or the teleporter will disappear."

if creaturename == 'Ushuriel' then

teleport = doCreateTeleport(tpID, ushuriel_to_position, ushuriel_in_position)

doSendMagicEffect(ushuriel_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInUshurielWard, (1000*time_to_pass))

elseif creaturename == 'Annihilon' then

teleport = doCreateTeleport(tpID, annihilon_to_position, annihilon_in_position)

doSendMagicEffect(annihilon_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInAnnihilonWard, (1000*time_to_pass))

elseif creaturename == 'Madareth' then

teleport = doCreateTeleport(tpID, madareth_to_position, madareth_in_position)

doSendMagicEffect(madareth_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInMadarethWard, (1000*time_to_pass))

elseif creaturename == 'Hellgorak' then

teleport = doCreateTeleport(tpID, hellgorak_to_position, hellgorak_in_position)

doSendMagicEffect(hellgorak_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInHellgorakWard, (1000*time_to_pass))

elseif creaturename == 'Zugurosh' then

teleport = doCreateTeleport(tpID, zugurosh_to_position, zugurosh_in_position)

doSendMagicEffect(zugurosh_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInZuguroshWard, (1000*time_to_pass))

elseif creaturename == 'Latrivan' then

teleport = doCreateTeleport(tpID, brothers_to_position, brothers_in_position)

doSendMagicEffect(brothers_in_position, CONST_ME_ENERGYHIT)

doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

addEvent(removeTeleportInBrothersWard, (1000*time_to_pass))


end
end

function removeTeleportInUshurielWard()
if getThingfromPos({x=33257, y=31643, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33257, y=31643, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=33257, y=31643, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end

function removeTeleportInAnnihilonWard()
if getThingfromPos({x=33432, y=31890, z=13, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33432, y=31890, z=13, stackpos=1}).uid,1)
doSendMagicEffect({x=33432, y=31890, z=13, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end

function removeTeleportInHellgorakWard()
if getThingfromPos({x=33129, y=32000, z=10, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33129, y=32000, z=10, stackpos=1}).uid,1)
doSendMagicEffect({x=33129, y=32000, z=10, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end

function removeTeleportInMadarethWard()
if getThingfromPos({x=33135, y=31879, z=13, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33135, y=31879, z=13, stackpos=1}).uid,1)
doSendMagicEffect({x=33135, y=31879, z=13, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end

function removeTeleportInZuguroshWard()
if getThingfromPos({x=33184, y=31946, z=13, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33184, y=31946, z=13, stackpos=1}).uid,1)
doSendMagicEffect({x=33184, y=31946, z=13, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end

function removeTeleportInBrothersWard()
if getThingfromPos({x=33298, y=31764, z=13, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPos({x=33298, y=31764, z=13, stackpos=1}).uid,1)
doSendMagicEffect({x=33298, y=31764, z=13, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
 
addEvent(doRemoveThing, 180 * 1000, getTileItemById(k.tp, 1387).uid, 1)
-->
Lua:
		addEvent(function()
			local itek = getTileItemById(k.tp, 1387)
			if itek.uid ~= 0 then
				doRemoveThing(itek.uid, 1)
			end
		end, 180*1000, k.tp)
 
Lua:
-- config
config = 
{
	fromPos 	= {x = 0, y = 0, z = 0},
	teleportId	= 1234,
	effectId	= 0
}

-- script
addEvent(function() 
	doRemoveItem(getTileItemById(config.fromPos, config.teleportId).uid, 1)
	doSendMagicEffect(config.fromPos, config.effectId)
end, 2000)
 
Lua:
local config = {
        timeToRemove = 180, -- seconds
		message = "You now have 3 minutes to exit this room through the teleporter. It will bring you to the next room only during his time or the teleporter will disappear",
        teleportId = 9773,
        bosses = { -- Monster Name,  Teleport Position
                ["Ushuriel"] = {  pos={ x=33157, y=31725, z=11, stackpos=1 }, aid=1001 },
				["Zugurosh"] = {  pos={ x=33123, y=31689, z=11, stackpos=1 }, aid=1002},
				["Madareth"] = {  pos={ x=33194, y=31768, z=11, stackpos=1 }, aid=1003},
                ["Annihilon"] = {  pos={ x=33200, y=31704, z=11, stackpos=1 }, aid=1005},
                ["Hellgorak"] = {  pos={ x=33107, y=31735, z=11, stackpos=1 }, aid=1006}
				},
		brothers ={
        ["Golgordan"] = {pos={ x=33235, y=31734, z=11, stackpos=1 },aid=1004, brother = "Latrivan"},
        ["Latrivan"] = {pos={ x=33235, y=31734, z=11, stackpos=1 },aid=1004, brother = "Golgordan"},
        brothersArea ={
                fromPos = {x = 33224, y = 31722, z = 11},
                toPos = {x = 33240, y = 31734, z = 11}	}	}
}
local function removal(position)
	doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return TRUE
end

function onKill(cid, target, lastHit)
    if(config.bosses[getCreatureName(target)]) then
		local t = config.bosses[getCreatureName(target)]
	    local teleport = doCreateItem(config.teleportId, t.pos)
		local position = t.pos
		doItemSetAttribute(teleport, "aid", t.aid)
        doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
		addEvent(removal, config.timeToRemove * 1000, position)
	elseif(config.brothers[getCreatureName(target)]) then
		local t = config.brothers[getCreatureName(target)]
        local brother = getCreatureByName(t.brother)
		if(isMonster(brother) == true) then
            if(isInRange(getCreaturePosition(brother), config.brothers.brothersArea.fromPos, config.brothers.brothersArea.toPos) == true) then
                return TRUE
			end
        else
			local teleport = doCreateItem(config.teleportId, t.pos)
			local position = t.pos
			doItemSetAttribute(teleport, "aid", t.aid)
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(removal, config.timeToRemove * 1000, position)
		end
	end
	return TRUE
end
 
Back
Top