• 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 Kill a Monster to Create a Portal (with Optional Countdown)

Did you find this script by searching?


  • Total voters
    27
heey i'm using otx, same as tfs latest revs aaand..

aah u should replace
Code:
addEvent(remove, v.timeToRemove * 1000)
with
Code:
addEvent(remove, v.timeToRemove * 1000, position)

other monsters aren't dying..

edit..

i've added an array and worked ^^
Code:
local t = {
creatures = {"pythius the rotten", "ferumbras"
},
Code:
function onKill(cid, target, damage, flags)
if not isInArray(t.creatures, getCreatureName(target):lower()) then return true end  
	local v = t[string.lower(getCreatureName(target))]

Work for you in OTX?
Can you post edit script?
 
umm, possible to make that u should kill the same monster twice in the same room b4 it opens?
like i have 2 dogs in the room and u need to kill both b4 it opens :p
 
umm, possible to make that u should kill the same monster twice in the same room b4 it opens?
like i have 2 dogs in the room and u need to kill both b4 it opens :p

Yes. You can set a storage onKill and when the storage reaches a certain amount, a teleport is created. You can refer to this script: http://otland.net/f82/killed-monsters-counter-27195/ and you will see that it is very similar to what you want. It needs some additions, but it shouldn't be difficult to fulfill your request.
 
Lua:
local config = {
	useCountdown = true -- true or false
}
 
local t = {
	["Panda"] = {
		toPos = {x = 1592, y = 1913, z = 2}, -- enter a position OR a town's name \\ toPos = {x = 100, y = 100, z = 7} //
		createPos = {x = 1592, y = 1914, z = 3, stackpos = 0},
		time = 5, -- seconds until the TP is removed
		msg = "You have taken my life!" -- the message the monster says upon death
	}
}
 
local function remove(position)
    local k = getTileItemById(position, 1387).uid
    return k > 0 and doRemoveItem(k), doSendMagicEffect(position, CONST_ME_POFF)
end
 
function onKill(cid, target)
	local v = t[string.lower(getCreatureName(target))]
	if(v and isMonster(target)) then
		doCreatureSay(cid, v.msg, TALKTYPE_MONSTER, nil, nil, getCreaturePosition(target))
		doSendMagicEffect(v.createPos, CONST_ME_ENERGYAREA)
		doCreateTeleport(1387, type(v.toPos) == 'table' and v.toPos or getTownTemplePosition(getTownId(v.toPos)), v.createPos)
		if(config.useCountdown) then
			for j = 0, v.time do
				local i = v.time - j
				addEvent(doSendAnimatedText, j * 1000, v.createPos, i > 0 and tostring(i), TEXTCOLOR_WHITE)
			end
		end
		addEvent(remove, v.time * 1000, v.createPos)
	end
	return true
end

no errors, monster killed, no tp shows, no text either. nthn
 
Did you register it in creaturescripts.xml, and login.lua? It works perfectly fine for me. I posted pictures on the first page.

Also, you need to use "panda" (lowercase).
 
ok, so i tested the script and it worked great, but when i changed the monsters, it didnt work so well

nvm... it was capital letters in script lol
 
TFS 0.4 is basicly the same as 0.3.7. TFS 0.3.7 was a later version that came after 0.4 and some 0.4 versions were renamed to 0.3.7.
If you have errors or other problems with this script, post them.
 
Back
Top