Ninja Bodil
New Member
- Joined
- Mar 7, 2009
- Messages
- 116
- Reaction score
- 0
Okey this script works fine until the tp should dissapear:
I get this error message:
Please help
Code:
function onDeath(cid, corpse, killer)
registerCreatureEvent(cid, "inquisitionPortals")
local creaturename = getCreatureName(cid)
--- positions where the teleports will be created:
local ushuriel_in_position = {x=969, y=237, z=12}
local annihilon_in_position = {x=1042, y=221, z=12, stackpos=2}
local hellgorak_in_position = {x=1045, y=265, z=12, stackpos=2}
local madareth_in_position = {x=966, y=265, z=12, stackpos=2}
local zugurosh_in_position = {x=1001, y=237, z=12, stackpos=2}
local brothers_in_position = {x=1001, y=269, z=12, stackpos=1}
--- positions where the teleports will be teleported you:
local ushuriel_to_position = {x=1025, y=163, z=12, stackpos=1}
local annihilon_to_position = {x=1129, y=419, z=13, stackpos=1}
local hellgorak_to_position = {x=918, y=331, z=13, stackpos=1}
local madareth_to_position = {x=887, y=223, z=13, stackpos=1}
local zugurosh_to_position = {x=984, y=175, z=12, stackpos=1}
local brothers_to_position = {x=1043, y=79, z=13, stackpos=1}
local time_to_pass = 180 -- in seconds
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)
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)
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)
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)
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)
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)
doCreatureSay(cid, message, TALKTYPE_ORANGE_1)
addEvent(removeTeleportInBrothersWard, (1000*time_to_pass))
end
end
function removeTeleportInUshurielWard()
if getThingfromPosition({x=969, y=237, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=969, y=237, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=969, y=237, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
function removeTeleportInAnnihilonWard()
if getThingfromPosition({x=1042, y=221, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=1042, y=221, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=1042, y=221, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
function removeTeleportInHellgorakWard()
if getThingfromPosition({x=1045, y=265, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=1045, y=265, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=1045, y=265, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
function removeTeleportInMadarethWard()
if getThingfromPosition({x=966, y=265, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=966, y=265, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=966, y=265, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
function removeTeleportInZuguroshWard()
if getThingfromPosition({x=1001, y=237, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=1001, y=237, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=1001, y=237, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
function removeTeleportInBrothersWard()
if getThingfromPosition({x=1001, y=269, z=12, stackpos=1}).itemid == 5023 then
doRemoveItem(getThingfromPosition({x=1001, y=269, z=12, stackpos=1}).uid,1)
doSendMagicEffect({x=1001, y=269, z=12, stackpos=1}, CONST_ME_POFF)
return TRUE
end
end
Code:
[09/04/2010 14:11:46] data/creaturescripts/scripts/inquisitionPortals.lua:onDeath
[09/04/2010 14:11:46] Description:
[09/04/2010 14:11:46] data/creaturescripts/scripts/inquisitionPortals.lua:83: attempt to call global 'getThingfromPosition' (a nil value)
[09/04/2010 14:11:46] stack traceback:
[09/04/2010 14:11:46] data/creaturescripts/scripts/inquisitionPortals.lua:83: in function <data/creaturescripts/scripts/inquisitionPortals.lua:82>