Launian
Tsuki~
- Joined
- Jul 7, 2008
- Messages
- 34
- Reaction score
- 1
I'm using TFS 2.14 (9.6), and last night I wanted to set up the Inquisition Quest, but I wanted to do it as close to the real quest as possible, so I searched the forums until I found a working script. Sadly, after I set it up and everything, I went and tried it, but when I get to the part with the 2 brothers (the 4th boss), it just stops working. Anyways, here's the script for the Creature Event::
EVerything works fine up to the point where I have to kill the brothers (the elseif(brothers) part).
Here's the error my console gives me when I kill the first brother:
I tried changing it to "getCreatureName", but then it'd just say it couldn't find anything.
So, that's about it. Hope anyone can help, since the script thread is over 2 years old and I don't feel like bumping it ^^ Thank you in advance.
Lua:
local monsters =
{
["Ushuriel"] = {teleportPos = {x = 525, y = 218, z = 11, stackpos = 1}, toPos = {x = 432, y = 273, z = 13}, storage = 2001},
["Zugurosh"] = {teleportPos = {x = 492, y = 182, z = 11, stackpos = 1}, toPos = {x = 734, y = 103, z = 14}, storage = 2002},
["Madareth"] = {teleportPos = {x = 560, y = 253, z = 11, stackpos = 1}, toPos = {x = 516, y = 272, z = 12}, storage = 2003},
["Annihilon"] = {teleportPos = {x = 560, y = 187, z = 11, stackpos = 1}, toPos = {x = 562, y = 176, z = 12}, storage = 2005},
["Hellgorak"] = {teleportPos = {x = 467, y = 218, z = 11, stackpos = 1}, toPos = {x = 474, y = 172, z = 12}, storage = 2006},
}
local brothers =
{
["Golgordan"] = {teleportPos = {x = 595, y = 220, z = 11}, toPos = {x = 401, y = 243, z = 15}, brother = "Latrivan"},
["Latrivan"] = {teleportPos = {x = 595, y = 220, z = 11}, toPos = {x = 401, y = 243, z = 15}, brother = "Golgordan"},
brothersArea =
{
fromPos = {x = 583, y = 208, z = 11},
toPos = {x = 607, y = 228, z = 11}
}
}
local time = 180 --seconds(3 minutes)
function onKill(cid, target, lastHit)
if(monsters[getCreatureName(target)]) then
local t = monsters[getCreatureName(target)]
doCreateTeleport(1387, t.toPos, t.teleportPos)
setPlayerStorageValue(cid, t.storage, 1)
doSendMagicEffect(t.teleportPos, CONST_ME_POFF)
doCreatureSay(cid, "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", TALKTYPE_ORANGE_1)
addEvent(doRemoveTeleport, time * 1000, t.teleportPos)
elseif(brothers[getCreatureName(target)]) then
t = brothers[getCreatureName(target)]
local brother = getCreatureByName(t.brother)
if(isCreature(brother) == true) then
if(isInRange(getCreaturePosition(brother), brothers.brothersArea.fromPos, brothers.brothersArea.toPos) == true) then
return true
else
doCreateTeleport(1387, t.toPos, t.teleportPos)
doSendMagicEffect(t.teleportPos, CONST_ME_POFF)
setPlayerStorageValue(cid, 2004, 1)
doCreatureSay(cid, "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", TALKTYPE_ORANGE_1)
addEvent(doRemoveTeleport, time * 1000, t.teleportPos)
end
end
end
return true
end
function doRemoveTeleport(position)
if(getTileThingByPos(position).itemid > 0) then
doRemoveItem(getTileThingByPos(position).uid)
doSendMagicEffect(position, CONST_ME_POFF)
end
end
EVerything works fine up to the point where I have to kill the brothers (the elseif(brothers) part).
Here's the error my console gives me when I kill the first brother:
Lua:
[12/09/2012 17:38:20] Lua Script Error: [CreatureScript Interface]
[12/09/2012 17:38:20] data/creaturescripts/scripts/inquisition.lua:onKill
[12/09/2012 17:38:20] data/creaturescripts/scripts/inquisition.lua:36: attempt to call global 'getCreatureByName' (a nil value)
[12/09/2012 17:38:20] stack traceback:
[12/09/2012 17:38:20] [C]: in function 'getCreatureByName'
[12/09/2012 17:38:20] data/creaturescripts/scripts/inquisition.lua:36: in function <data/creaturescripts/scripts/inquisition.lua:25>
I tried changing it to "getCreatureName", but then it'd just say it couldn't find anything.
So, that's about it. Hope anyone can help, since the script thread is over 2 years old and I don't feel like bumping it ^^ Thank you in advance.