• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent A simple script for your Inquisition

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Hello this is a simple script made by me... =D

When you kill a Boss a teleport is created, 3 minutes later the teleport disappear.

Here is.. (Change the positions of agreement to your map)
.data/creaturescripts/scripts/teleport_creaturename.lua
Code:
[B]--- Created by Darkhaos

function onDeath(cid, corpse, killer)

	registerCreatureEvent(cid, "ushurielTeleport")

	local creaturename = getCreatureName(cid)
	local in_pos = {[COLOR="Red"]x[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]859[/COLOR], [COLOR="Red"]y[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]837[/COLOR], [COLOR="Red"]z[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]6[/COLOR], [COLOR="Red"]stackpos[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]2[/COLOR]} 
	local checkIID = getThingfromPos(in_pos)
	local to_pos = {[COLOR="Red"]x[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]588[/COLOR], [COLOR="Red"]y[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]1086[/COLOR], [COLOR="Red"]z[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]7[/COLOR], [COLOR="Red"]stackpos[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]1[/COLOR]} 
	local time_to_pass = [COLOR="Orange"]180[/COLOR] -- in seconds
	local tpID = [COLOR="Orange"]1387[/COLOR]

    if creaturename == '[COLOR="Blue"]creaturename[/COLOR]' then

		teleport = doCreateTeleport(tpID, to_pos, in_pos)

		doSendMagicEffect(in_pos, CONST_ME_TELEPORT)

		doCreatureSay(cid, "[COLOR="Orange"]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[/COLOR]", TALKTYPE_ORANGE_1)
		addEvent([COLOR="DarkGreen"]removeTeleport[/COLOR], (1000*time_to_pass))

	
		end 
	end

[COLOR="DarkGreen"]function removeTeleport()[/COLOR]
	if getThingfromPos({[COLOR="Red"]x[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]859[/COLOR], [COLOR="Red"]y[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]837[/COLOR], [COLOR="Red"]z[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]6[/COLOR], [COLOR="Red"]stackpos[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]1[/COLOR]}).itemid == 1387 then
	doRemoveItem(getThingfromPos({[COLOR="Red"]x[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]859[/COLOR], [COLOR="Red"]y[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]837[/COLOR], [COLOR="Red"]z[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]6[/COLOR], [COLOR="Red"]stackpos[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]1[/COLOR]}).uid,1)
	doSendMagicEffect({[COLOR="Red"]x[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]859[/COLOR], [COLOR="Red"]y[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]837[/COLOR], [COLOR="Red"]z[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]6[/COLOR], [COLOR="Red"]stackpos[/COLOR][COLOR="DarkGreen"]=[/COLOR][COLOR="Blue"]1[/COLOR]}, [COLOR="Orange"]CONST_ME_POFF[/COLOR])
	return TRUE
	end
end[/B]

in "if creaturename == 'creaturename' then" set the Monster name..

Example...
Code:
    if creaturename == '[COLOR="Blue"]Latrivan[/COLOR]' then

Warning!

In the function "removeTeleport" don't use the abbreviations (in_pos, checkIID and tpID). If you use them then the script will not work

In... .data/creaturescripts/scripts/login.lua
Add under onLogin...
Code:
registerCreatureEvent(cid, "[COLOR="Blue"][B]creaturenameTeleport[/B][/COLOR]")

example...
Code:
registerCreatureEvent(cid, "[COLOR="Blue"][B]ushurielTeleport[/B][/COLOR]")
registerCreatureEvent(cid, "[COLOR="Blue"][B]zuguroshTeleport[/B][/COLOR]")
registerCreatureEvent(cid, "[COLOR="Blue"][B]madarethTeleport[/B][/COLOR]")

Add in .data/creaturescripts/creaturescripts.xml
Code:
	<event type="death" name="[COLOR="Blue"][B]creaturenameTeleport[/B][/COLOR]" script="[COLOR="Blue"][B]teleport_creaturename.lua[/B][/COLOR]"/>

Add in .data/monsters/creaturename.xml

under.. </flags>
Code:
<scripts>
<event name="creaturenameTeleport"/>
</script>

For Example.. .data/monsters/Latrivan.xml
Code:
<scripts>
<event name="latrivanTeleport"/>
</script>

Enjoy it!
 
Last edited:
When i put this exactly as you said after flags

<scripts>
<event name="ushurielTeleport"/>
</script>

the ot cant load the monster.

Plz figure out what is wrong and tell me.

im using tfs 0.2
 
lol thats exactly the same as i had and this script doesnt work for the latest tfs version "TFS Vo.3 alpha 4
 
IT WORKSS I KNOW WHAT :DDDD

before i did just copy this

<event type="death" name="creaturenameTeleport" script="teleport_creaturename.lua"/>

beucase you had examples and so good tutorials and now it was on that so i thought i just had to copy :p

but then i put ushurial and it works :DDD

THANKS I LOVE YOU MAN YOU ARE SO FUCKING GOOD
 
[27/06/2010 11:37:22] [Error - CreatureScript Interface]
[27/06/2010 11:37:22] data/creaturescripts/scripts/Inquisition/teleport_creaturename.lua:eek:nDeath
[27/06/2010 11:37:22] Description:
[27/06/2010 11:37:22] (luaDoCreateTeleport) Tile not found


Pls help me..
 
There are way shorter scripts for the same.
Anyways nice job xD
 
Back
Top