• 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 Kill monster create teleport issues.

bybbzan

mapper
Joined
Aug 4, 2012
Messages
809
Solutions
2
Reaction score
136
Location
Sweden
Hello. I tried this script by View Profile: JDB - OtLand.
The problem is, it doesnt work for me. The text doesnt come up, neither do the teleport.
Also no errors in the console?

What's the problem?

LUA:
local bosses = { -- Teleport Takes Player -- Teleport Is Created --
        ["Ushuriel"] = { x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12 },
        ["Zugurosh"] = { x=1126, y=1151, z=12 }, { x=1149, y=1231, z=12 },
        ["Madareth"] = { x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12 },
        ["Latrivan"] = { x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12 },
        ["Annihilon"] = { x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12 },
        ["Hellgorak"] = { x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12 }                      
}
 
local time = 30 -- Seconds
function onKill(cid, target, lastHit)
        for name, pos in pairs(bosses) do
                if (name == getCreatureName(target):lower()) then
                        doCreateTeleport(1387, pos[1], pos[2])
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. time .." seconds until the portal will disapear.")
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end
 
Last edited:
LUA:
local bosses = { -- Teleport Takes Player -- Teleport Is Created --
        ["Ushuriel"] = { x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12 },
        ["Zugurosh"] = { x=1126, y=1151, z=12 }, { x=1149, y=1231, z=12 },
        ["Madareth"] = { x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12 },
        ["Latrivan"] = { x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12 },
        ["Annihilon"] = { x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12 },
        ["Hellgorak"] = { x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12 }                      
}
 
local time = 30 -- Seconds
function onKill(cid, target, lastHit)
        for name, pos in pairs(bosses) do
                if (name:lower() == getCreatureName(target):lower()) then
                        doCreateTeleport(1387, pos[1], pos[2])
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. time .." seconds until the portal will disapear.")
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end
 
LUA:
local bosses = { -- Teleport Takes Player -- Teleport Is Created --
        ["Ushuriel"] = { x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12 },
        ["Zugurosh"] = { x=1126, y=1151, z=12 }, { x=1149, y=1231, z=12 },
        ["Madareth"] = { x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12 },
        ["Latrivan"] = { x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12 },
        ["Annihilon"] = { x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12 },
        ["Hellgorak"] = { x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12 }                      
}
 
local time = 30 -- Seconds
function onKill(cid, target, lastHit)
        for name, pos in pairs(bosses) do
                if (name:lower() == getCreatureName(target):lower()) then
                        doCreateTeleport(1387, pos[1], pos[2])
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. time .." seconds until the portal will disapear.")
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end

Now the monster isn't really dead. Got none hp but still is alive.
Also this error:
Code:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/hota/pharaohs.lua:onKill
Description:
data/creaturescripts/scripts/hota/pharaohs.lua:14: attempt to index local 'name'
 (a number value)
stack traceback:
        data/creaturescripts/scripts/hota/pharaohs.lua:14: in function <data/cre
aturescripts/scripts/hota/pharaohs.lua:12>
 
Try:

LUA:
local config = {
        timeToRemove = 120, -- seconds
		message = "You now have 2 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
 
Thats with "brothers" in it. I tried that but when i tried to edited that one i just got errors.
Please either edit it for me or solve the other script.

thanks
 
LUA:
local bosses = { -- Teleport Takes Player -- Teleport Is Created --
        ["Ushuriel"] = {{ x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12 }},
        ["Zugurosh"] = {{ x=1126, y=1151, z=12 }, { x=1149, y=1231, z=12 }},
        ["Madareth"] = {{ x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12 }},
        ["Latrivan"] = {{ x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12 }},
        ["Annihilon"] = {{ x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12 }},
        ["Hellgorak"] = {{ x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12 }}                      
}
 
local time = 30 -- Seconds
function onKill(cid, target, lastHit)
        for name, pos in pairs(bosses) do
                if (name:lower() == getCreatureName(target):lower()) then
                        doCreateTeleport(1387, pos[1], pos[2])
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. time .." seconds until the portal will disapear.")
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end
 
LUA:
local bosses = { -- Teleport Takes Player -- Teleport Is Created --
        ["Ushuriel"] = {{ x=1173, y=1141, z=12 }, { x=1097, y=1214, z=12 }},
        ["Zugurosh"] = {{ x=1126, y=1151, z=12 }, { x=1149, y=1231, z=12 }},
        ["Madareth"] = {{ x=1045, y=1206, z=13 }, { x=1112, y=1240, z=12 }},
        ["Latrivan"] = {{ x=1154, y=1195, z=13 }, { x=1147, y=1244, z=12 }},
        ["Annihilon"] = {{ x=1244, y=1297, z=12 }, { x=1187, y=1198, z=12 }},
        ["Hellgorak"] = {{ x=1067, y=1307, z=13 }, { x=1192, y=1240, z=12 }}                      
}
 
local time = 30 -- Seconds
function onKill(cid, target, lastHit)
        for name, pos in pairs(bosses) do
                if (name:lower() == getCreatureName(target):lower()) then
                        doCreateTeleport(1387, pos[1], pos[2])
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. time .." seconds until the portal will disapear.")
                        addEvent(doRemoveItem, tpTime * 1000, getTileItemById(pos[2], 1387).uid, 1)
                end
        end
        return true
end

LOL :p
Code:
[Error - CreatureScript Interface]
data/creaturescripts/scripts/hota/pharaohs.lua:onKill
Description:
data/creaturescripts/scripts/hota/pharaohs.lua:17: attempt to perform arithmetic
 on global 'tpTime' (a nil value)
stack traceback:
        data/creaturescripts/scripts/hota/pharaohs.lua:17: in function <data/cre
aturescripts/scripts/hota/pharaohs.lua:12>

The teleport is just spamming.. wierd
and i do get this message all the time, just spamms
XML:
14:33 You have 30 seconds until the portal will disapear.
 
Thanks guys, now it works.

Actually i noticed this bug now.. The teleports do not get removed.

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

PLEASE HELP
 
Last edited:
Back
Top