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

Help with a Inquisition CreatureEvent

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::

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.
 
your problem is not existin function named:
Lua:
getCreatureByName
look to docs/LUA_FUNCTIONS maybe there is any replacement. ; )
 
Here We Are :)
Lua:
local config = {
	message = "You have 45 seconds for back use Death Monster For Teleport You.",
	timeToRemove = 60, -- seconds
	teleportId = 1387,
	bosses = {
		["Ushuriel"] = { x = 172, y = 559, z = 13 },
		["Annihilon"] = { x = 294, y = 681, z = 13},
		["Hellgorak"] = { x = 255, y = 467, z = 13},
		["Madareth"] = { x = 287, y = 365, z = 13},
		["Zugurosh"] = { x = 314,  y = 474, z = 13},
		["Latrivan"] = { x = 408, y = 413, z = 13},
        ["Tirecz"] = { x = 33049, y = 30985, z = 7 }                          
	}
}
	
function removal(position)
	doRemoveThing(getTileItemById(position, config.teleportId).uid, 1)
    return true
end

function onKill(cid, target, lastHit)
	local position = getCreaturePosition(target)
	local name = getCreatureName(target)
	if config.bosses[name] then
		local teleport = doCreateTeleport(config.teleportId, config.bosses[name], position)
		doCreatureSay(target, config.message, TALKTYPE_ORANGE_1)
		addEvent(removal, config.timeToRemove * 1000, position)
		doSendMagicEffect(position,65)
	end
return true
end
Rep++ If It Helpful For You
 
Back
Top