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

CreatureEvent Creating teleport after monster dies.

EvulMastah

๏̯͡๏﴿
Premium User
Joined
Aug 19, 2007
Messages
4,941
Solutions
11
Reaction score
352
This idea comes from darkhaos I suppose.

This can be used for different events, not only inquisition quest, you can simply edit it to your needs.

data/creaturescripts/inquisition.lua:
Code:
local config = {
	message = "Go into the teleporter in 3 minutes, else it will disappear.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = { -- Monster Name, Teleport To Position, Teleport Position
		["ushuriel"] = { { x = 222, y = 564, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["annihilion"] = { { x = 276, y = 1045, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["hellgorak"] = { { x = 169, y = 1047, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["madareth"] = { { x = 416, y = 1017, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["zugurosh"] = { { x = 424, y = 1119, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["latrivan"] = { { x = 46, y = 1109, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } }
	}
}

local function removal(position)
	if getThingfromPos(position).itemid == config.teleportId then
		doRemoveItem(getThingfromPos(position).uid)
	end
	return TRUE
end

function onDeath(cid, corpse, killer)
	local position = getCreaturePosition(cid)
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(cid) then
			teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(removal, config.timeToRemove * 1000, pos[2])
		end
	end
	return TRUE
end

data/creaturescripts/creaturescripts.xml:
Code:
	<event type="death" name="Inquisition" script="marcino/inquisition.lua"/>

To make it work you have to add in every monster that will use this script those lines (suggested after </flags>):
Code:
<script>
	<event name="Inquisition"/>
</script>

and also register an event for player, by NPC, action, onLogin script or whatever:
Code:
	registerCreatureEvent(cid, "Inquisition")

If you dont have those monsters, here is a pack for you:
Manx's Monster Pack, You can rep him >here<.

bye.
 
Last edited:
More softness that my script... very useful..

Edit 19:42 P.M!

I have edited you script Marcinek Paladinek!!

-When the teleport is created a effect is created too "CONST_ME_TELEPORT"
-Changed message to a message more Tibia Cip!
-Fixed bug in creature name, changed Annihilion to Annihilon.

Code:
local config = {
	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.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = { -- Monster Name, Teleport To Position, Teleport Position
		["Ushuriel"] = { { x = 222, y = 564, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Annihilon"] = { { x = 276, y = 1045, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Hellgorak"] = { { x = 169, y = 1047, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Madareth"] = { { x = 416, y = 1017, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Zugurosh"] = { { x = 424, y = 1119, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Latrivan"] = { { x = 46, y = 1109, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } }

	}
}

local function removal(position)
	if getThingfromPos(position).itemid == config.teleportId then
		doRemoveItem(getThingfromPos(position).uid)
	end
	return TRUE
end

function onDeath(cid, corpse, killer)
	local position = getCreaturePosition(cid)
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(cid) then
			teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
			doSendMagicEffect(pos[2], CONST_ME_TELEPORT)
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(removal, config.timeToRemove * 1000, pos[2])
		end
	end
	return TRUE
end
 
Last edited:
My deathlist stopped worked after I used your script, do you know why o.o?
 
My deathlist at the website stopped working after I used your script, why? ;s

creaturescripts.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
    <event type="login" name="PlayerLogin" script="login.lua"/>
          <event type="death" name="PlayerDeath" script="playerdeath.lua"/>
    <event type="death" name="Inquisition" script="inquisition.lua"/>

</creaturescripts>
scripts/login.lua
Code:
function onLogin(cid)
    setPlayerStorageValue(cid,29061,1)
    registerCreatureEvent(cid, "PlayerDeath")
    registerCreatureEvent(cid, "Inquisition")
    return TRUE
end
Anyone know if I can change the event type="death" part to something else than "death"? because I think that is the problem with the deathlist not showing.
 
Last edited by a moderator:
Changing the event to kill, and change the function to an onKill event would fix the problem.

creaturescript with onKill instead of onDeath:
Code:
local config = {
	message = "Go into the teleporter in 3 minutes, else it will disappear.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = { -- Monster Name, Teleport To Position, Teleport Position
		["Ushuriel"] = { { x = 222, y = 564, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Annihilion"] = { { x = 276, y = 1045, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Hellgorak"] = { { x = 169, y = 1047, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Madareth"] = { { x = 416, y = 1017, z = 6 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Zugurosh"] = { { x = 424, y = 1119, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } },
		["Latrivan"] = { { x = 46, y = 1109, z = 7 }, { x = 218, y = 564, z = 6, stackpos = 1 } }
	}
}

local function removal(position)
	if getThingfromPos(position).itemid == config.teleportId then
		doRemoveItem(getThingfromPos(position).uid)
	end
	return TRUE
end

function onKill(cid, target)
	local position = getCreaturePosition(target)
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(target) then
			teleport = doCreateTeleport(config.teleportId, pos[1], pos[2])
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(removal, config.timeToRemove * 1000, pos[2])
		end
	end
	return TRUE
end
and the action
Code:
<event type="kill" name="Inquisition" script="marcino/inquisition.lua"/>

*NOTE* - I haven't tested, but should fix the problem.

Jo3
 
That was just a guess since I'm not home to test anything, if I don't get home in time to fix it just wait til Marcinek fixes it.

Jo3
 
Is this line rly needed? in login.lua?

Code:
registerCreatureEvent(cid, "Inquisition")


Its work great for me without adding it :p

So Lolzor try to without adding this line and check if it work
 
problem

hello, this is the problem is that I get this error and will not fix it if someone can help me (not created teleport) im using tfs 0.2

15/12/2008 12:30:26] Lua Script Error: [CreatureScript Interface]
[15/12/2008 12:30:26] in a timer event called from:
[15/12/2008 12:30:26] data/creaturescripts/scripts/inquisition.lua:eek:nKill

[15/12/2008 12:30:26] luaGetThingfromPos(). Tile not found
 
Last edited:
[18/12/2008 14:28:21] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/inquisition.lua
[18/12/2008 14:28:21] data/creaturescripts/scripts/inquisition.lua:8: unexpected symbol near '['

:S
 
teleport doest not disapear

i dotn know, if any1 has this problem too, but its all working fine i guess, but when pas the 3 minuts, the teleport doest not vanish, anyone know the reason?
Tnx in adv.
 
Back
Top