• 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 [Inquisition] Create Teleport When Boss Die!

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
data/creaturescripts/scripts/inquisition.lua
Lua:
local monsters = 
{
	["Ushuriel"] = {teleportPos = {x = 100, y = 100, z = 7, stackpos = 1}, toPos = {x = 100, y = 100, z = 100}},
	["Annihilon"] = {teleportPos = {x = 100, y = 100, z = 7, stackpos = 1}, toPos = {x = 100, y = 100, z = 100}},
	["Hellgorak"] = {teleportPos = {x = 100, y = 100, z = 7, stackpos = 1}, toPos = {x = 100, y = 100, z = 100}},
	["Madareth"] = {teleportPos = {x = 100, y = 100, z = 7, stackpos = 1}, toPos = {x = 100, y = 100, z = 100}},
	["Zugurosh"] = {teleportPos = {x = 100, y = 100, z = 7, stackpos = 1}, toPos = {x = 100, y = 100, z = 100}}
}

local brothers = 
{
	["Golgordan"] = {teleportPos = {x = 100, y = 100, z = 7}, toPos = {x = 100, y = 100, z = 100}, brother = "Latrivan"},
	["Latrivan"] = {teleportPos = {x = 100, y = 100, z = 7}, toPos = {x = 100, y = 100, z = 100}, brother = "Golgordan"},

	brothersArea =
	{
		fromPos = {x = 500, y = 500, z = 7},
		toPos = {x = 550, y = 550, z = 7}
	}
}
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)
		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_MONSTER, getCreaturePosition(target))
		addEvent(doRemoveTeleport, time * 1000, t.teleportPos)
	elseif(brothers[getCreatureName(target)]) then
		t = brothers[getCreatureName(target)]
		local brother = getCreatureByName(t.brother)
		if(isMonster(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)
				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_MONSTER, getCreaturePosition(target))
				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

data/creaturescripts/scripts/login.lua
Lua:
registerCreatureEvent("Inquisition")

data/creaturescripts/creaturescripts.xml
PHP:
	<event type="kill" name="Inquisition" script="inquisition.lua"/>

monsterfile.xml(Ex: Zugurosh.xml)
After "</flags"> add:
PHP:
	<script>
		<event name="Inquisition"/>
	</script>

NOT TESTED!
 
Last edited:
@Darkhaos,

Would you mind trying this one? Dont know if it will work.
Code:
local config = {
	message = "Go into the teleporter in 3 minutes, else it will disappear.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = {
		["Ushuriel"] = { x = 588, y = 1086, z = 7 },
		["Annihilion"] = { x = 276, y = 1045, z = 6 },
		["Hellgorak"] = { x = 169, y = 1047, z = 6 },
		["Madareth"] = { x = 416, y = 1017, z = 6 },
		["Zugurosh"] = { x = 424, y = 1119, z = 7 },
		["Latrivan"] = { x = 46, y = 1109, z = 7}
	}
}
	
function onDeath(cid, corpse, killer)
	registerCreatureEvent(cid, "inquisitionPortals")
	local position = getCreaturePosition(cid)
	
	for name, pos in pairs(config.bosses) do
		if name == getCreatureName(cid) then
			teleport = doCreateTeleport(config.teleportId, pos, position)
			doCreatureSay(cid, config.message, TALKTYPE_ORANGE_1)
			addEvent(doRemoveItem, config.timeToRemove * 1000, getThingfromPos(position).uid, 1)
		end
	end
	return TRUE
end
 
Yeah it work.. but the teleport is created when the monster die...

Well.. is a great script too.. more soft that the mine.. =D!

Edit:

The teleport don disappear
 
Last edited:
Code:
local config = {
	message = "Go into the teleporter in 3 minutes, else it will disappear.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = {
		["Ushuriel"] = { x = 588, y = 1086, z = 7 },
		["Annihilion"] = { x = 276, y = 1045, z = 6 },
		["Hellgorak"] = { x = 169, y = 1047, z = 6 },
		["Madareth"] = { x = 416, y = 1017, z = 6 },
		["Zugurosh"] = { x = 424, y = 1119, z = 7 },
		["Latrivan"] = { x = 46, y = 1109, z = 7}
	}
}

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

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

Try now.
 
Code:
local config = {
	message = "Go into the teleporter in 3 minutes, else it will disappear.",
	timeToRemove = 180, -- seconds
	teleportId = 1387,
	bosses = {
		["Ushuriel"] = { x = 588, y = 1086, z = 7 },
		["Annihilion"] = { x = 276, y = 1045, z = 6 },
		["Hellgorak"] = { x = 169, y = 1047, z = 6 },
		["Madareth"] = { x = 416, y = 1017, z = 6 },
		["Zugurosh"] = { x = 424, y = 1119, z = 7 },
		["Latrivan"] = { x = 46, y = 1109, z = 7}
	}
}

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

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

Try now.

Works Perfectly =d
 
My ot cant load ushuriel while i have this in the .xml file

<script>
<event name="inquisitionPortals"/>
</script>

im using tfs 0.2
 
íve tried on ushuriel but without the rest of the scripts this work

<script>
<event name="inquisitionPortals"/>
</script>


but when i add the other script the ot cant load ushuriel when i start it.

so i guess something is wrong with the other scripts.
 
íve tried on ushuriel but without the rest of the scripts this work

<script>
<event name="inquisitionPortals"/>
</script>


but when i add the other script the ot cant load ushuriel when i start it.

so i guess something is wrong with the other scripts.

The script was tested in TFS 0.2!

Remember...
you need put this code..
Code:
<script>
<event name="inquisitionPortals"/>
</script>

Under </flags>

an example...

Code:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Ushuriel" nameDescription="ushuriel" race="blood" experience="10000" speed="400" manacost="0">
  <health now="40000" max="40000"/>
  <look type="12" head="1" body="76" legs="0" feet="132" corpse="6068"/>
  <targetchange interval="10000" chance="15"/>
  <strategy attack="100" defense="0"/>
  <flags>
    <flag summonable="0"/>
    <flag attackable="1"/>
    <flag hostile="1"/>
    <flag illusionable="0"/>
    <flag convinceable="0"/>
    <flag pushable="0"/>
    <flag canpushitems="1"/>
    <flag canpushcreatures="1"/>
    <flag staticattack="90"/>
    <flag targetdistance="1"/>
    <flag runonhealth="0"/>
  </flags>
[B][COLOR="Blue"]<script>
<event name="inquisitionPortals"/>
</script>[/COLOR][/B]
<attacks>
	    <attack name="melee" interval="2000" min="-0" max="-1028"/> 
	<attack name="physical" interval="1000" chance="10" length="10" spread="0" min="-250" max="-500">
		<attribute key="areaEffect" value="mortarea"/>
	</attack>
	<attack name="death" interval="1000" chance="8" radius="5" target="0" min="-30" max="-760">
		<attribute key="areaEffect" value="mortarea"/>
		<attribute key="shootEffect" value="death"/>
	</attack>
	<attack name="earth" interval="2000" chance="9" length="8" spread="0" min="-200" max="-585">
		<attribute key="areaEffect" value="smallplants"/>
	</attack>
	<attack name="ice" interval="1000" chance="8" target="0" radius="6" min="0" max="-430">
		<attribute key="areaEffect" value="icetornado"/>
	</attack>
	<attack name="drunk" interval="3000" chance="11" radius="6" target="0">
		<attribute key="areaEffect" value="purplenote"/>
	</attack>
	<attack name="energycondition" interval="2000" chance="15" radius="4" target="0" min="-250" max="-250">
		<attribute key="areaEffect" value="energy"/>
	</attack>
</attacks>

<defenses armor="50" defense="45">
	<defense name="healing" interval="1000" chance="12" min="400" max="600">
		<attribute key="areaEffect" value="greenshimmer"/>
	</defense>
	<defense name="speed" interval="1000" chance="4" speedchange="400" duration="7000">
		<attribute key="areaEffect" value="blueshimmer"/>
	</defense>
</defenses>
<elements>
		<element energyPercent="30"/>
		<element earthPercent="80"/>
		<element icePercent="15"/>
		<element holyPercent="-10"/>
		<element deathPercent="20"/>
		<element firePercent="-10"/>
</elements>
  <immunities>
    <immunity physical="0"/>
    <immunity energy="0"/>
    <immunity fire="0"/>
    <immunity poison="0"/>
    <immunity lifedrain="1"/>
    <immunity paralyze="1"/>
    <immunity outfit="1"/>
    <immunity drunk="1"/>
    <immunity invisible="1"/>
    <immunity death="1"/>
  </immunities>
  <voices interval="5000" chance="10">
	<voice sentence="You will run out of resources soon enough!"/>
    <voice sentence="One little mistake and your all are mine!"/>
    <voice sentence="I sense your strength fading!"/>
  </voices>

<loot>
<item id="2148" chance="100000" countmax="100" />
<item id="2148" chance="100000" countmax="100" />
<item id="2148" chance="100000" countmax="100" /> --
<item id="2150" chance="18000" countmax="3"/> -- 
<item id="2170" chance="12000" /> --
<item id="2202" chance="12000"/> --
<item id="2214" chance="60000" /> --
<item id="1987" chance="100000" > --
<inside>
	<item id="2158" chance="1200" /> --
	<item id="2520" chance="900" /> -- 
	<item id="2195" chance="900" /> -- 
	<item id="2514" chance="800" /> -- 
	<item id="2470" chance="800" /> -- 
</inside>
</item>
</loot>

</monster>

If the script does not work, then post here that goes wrong in the console.
 
Code: [28/11/2008 23:53:40] [Spawn::addMonster] Can not find Ushuriel

Code:
[28/11/2008 23:59:07] [Spawn::addMonster] Can not find Ushuriel

It works yeaaaaaaaaaaaaaaaaaaaaaaaaaa

the tp doesnt dissipear :S plz help
 
Last edited by a moderator:
actually me too, but this is no thread to offtopic ....

Im using of script Marcinek Paladinek and its working great :) Thanks guys
 
Only 2 of the teleports disappear after 3 minutes, the other 4 stay.
 
Error!

[23/02/2009 21:40:06] Warning: [Event::loadScript] Can not load script. data/creaturescripts/scripts/Inquisition/teleports_inquisition.lua
[23/02/2009 21:40:07] cannot open data/creaturescripts/scripts/Inquisition/teleports_inquisition.lua: No such file or directory
[23/02/2009 21:40:07] >> Loading monsters
[23/02/2009 21:40:07] >> Loading outfits
[23/02/2009 21:40:07] >> Loading admin protocol config
[23/02/2009 21:40:07] >> Loading experience stages
[23/02/2009 21:40:07] >> Using plaintext passwords
[23/02/2009 21:40:07] >> Checking world type... PVP-ENFORCED
[23/02/2009 21:40:07] >> Loading map
[23/02/2009 21:40:08] > Map size: 1000x1000.
[23/02/2009 21:40:08] > Map loading time: 0.562 seconds.
[23/02/2009 21:40:08] [Spawn::addMonster] Can not find Mechanical Fighter
[23/02/2009 21:40:08] WARNING: could not load house data.
[23/02/2009 21:40:08] >> Setting gamestate to: GAME_STATE_INIT
[23/02/2009 21:40:08] Warning: [Monster::Monster]. Unknown event name - inquisitionPortals
[23/02/2009 21:40:08] Warning: [Monster::Monster]. Unknown event name - inquisitionPortals
[23/02/2009 21:40:08] Warning: [Monster::Monster]. Unknown event name - inquisitionPortals
[23/02/2009 21:40:09] Warning: [Monster::Monster]. Unknown event name - inquisitionPortals
[23/02/2009 21:40:09] Warning: [Monster::Monster]. Unknown event name - inquisitionPortals
 
I get this error ::

Code:
[Warning - Event::loadScript] Can not load script (data/creaturescripts/scripts/
Inquisition/voodoo.lua)
data/creaturescripts/scripts/Inquisition/voodoo.lua:9: '=' expected near 'xief_i
n_pos'

I changed the script abit to match what i needed.
Code:
function onDeath(cid, corpse, killer)

	registerCreatureEvent(cid, "voodoo")

	local creaturename = getCreatureName(cid)

--- positions where the teleports will be created:
 
	local voodoo master xief_in_pos = {x=1226, y=935, z=8, stackpos=2} 

--- positions where the teleports will be teleported you:

 	local voodoo master xief_to_pos = {x=1233, y=941, z=8, stackpos=1} 

	local time_to_pass = 180 -- in seconds
	local tpID = 1387
	local doEffect = CONST_ME_TELEPORT
	local 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"

	if creaturename == 'Voodoo Master Xief' then

			teleport = doCreateTeleport(tpID, voodoo master xief_to_pos, voodoo master xief_in_pos)

			doSendMagicEffect(ushuriel_in_pos, doEffect)

			doCreatureSay(cid, message, TALKTYPE_ORANGE_1)

			addEvent(removeTeleportInUshurielWard, (1000*time_to_pass))

	
		end 
end

function removeTeleportInUshurielWard()
	if getThingfromPos({x=1226, y=935, z=8, stackpos=2}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=1226, y=935, z=8, stackpos=2}).uid,1)
	doSendMagicEffect({x=1226, y=935, z=8, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

function removeTeleportInAnnihilonWard()
	if getThingfromPos({x=143, y=963, z=7, stackpos=2}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=143, y=963, z=7, stackpos=2}).uid,1)
	doSendMagicEffect({x=143, y=963, z=7, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

function removeTeleportInHellgorakWard()
	if getThingfromPos({x=244, y=959, z=4, stackpos=2}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=244, y=959, z=4, stackpos=2}).uid,1)
	doSendMagicEffect({x=244, y=959, z=4, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

function removeTeleportInMadarethWard()
	if getThingfromPos({x=345, y=1017, z=7, stackpos=2}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=345, y=1017, z=7, stackpos=2}).uid,1)
	doSendMagicEffect({x=345, y=1017, z=7, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

function removeTeleportInZuguroshWard()
	if getThingfromPos({x=509, y=1190, z=7, stackpos=2}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=509, y=1190, z=7, stackpos=2}).uid,1)
	doSendMagicEffect({x=509, y=1190, z=7, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

function removeTeleportInBrothersWard()
	if getThingfromPos({x=219, y=1041, z=7, stackpos=1}).itemid == 1387 then
	doRemoveItem(getThingfromPos({x=219, y=1041, z=7, stackpos=1}).uid,1)
	doSendMagicEffect({x=219, y=1041, z=7, stackpos=1}, CONST_ME_POFF)
	return TRUE
	end
end

The first script worked for the boss Demodras and all i did was copy and change over what was needed. I dont know if that caused the issue.
 
local voodoo master xief_in_pos = {x=1226, y=935, z=8, stackpos=2}

You cannot have spaces in a variable name, try changing all those to voodoo_master_xief_in_pos
 
Back
Top