therrax
Member
- Joined
- Jul 12, 2012
- Messages
- 262
- Solutions
- 1
- Reaction score
- 11
Hi.
I am using tfs 1.0
this is error:
Inquisition.lua
I am using tfs 1.0
this is error:
Code:
data/creaturescripts/scripts/Inquisition.lua:onKill
attempt to index a nil value
stack traceback:
[C]: at 0x008a320c
[C]: in function 'doCreateItem'
data/creaturescripts/scripts/Inquisition.lua:27: in function <data/creaturescripts/scripts/Inquisition.lua:24>
Code:
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=237, y=407, z=11, stackpos=1 }, aid=1001 },
["Zugurosh"] = { pos={ x=271, y=406, z=11, stackpos=1 }, aid=1002},
["Madareth"] = { pos={ x=234, y=433, z=11, stackpos=1 }, aid=1003},
["Annihilon"] = { pos={ x=309, y=391, z=11, stackpos=1 }, aid=1005},
["Hellgorak"] = { pos={ x=314, y=433, z=11, stackpos=1 }, aid=1006}
},
brothers ={
["Golgordan"] = {pos={ x=269, y=437, z=11, stackpos=1 },aid=1004, brother = "Latrivan"},
["Latrivan"] = {pos={ x=269, y=437, z=11, stackpos=1 },aid=1004, brother = "Golgordan"},
brothersArea ={
fromPos = {x = 263, y = 438, z = 11},
toPos = {x = 275, y = 445, z = 11} } }
}
local function removal(position)
doRemoveItem(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
doSetItemActionId(teleport, 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 = getPlayerByName(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
doSetItemActionId(teleport, t.aid)
doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
addEvent(removal, config.timeToRemove * 1000, position)
end
end
return TRUE
end