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

Kill x monster in x area

Status
Not open for further replies.

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,767
Solutions
5
Reaction score
769
Hello,
Im looking for a script where you have to kill x monster before you can enter the door. if you try to enter the door it says please kill the monsters in room.

Rep++
 
I have this script ATM, when i kill any of the monsters i get debugged :S

Lua:
local c = {
	boss = { -- Boss Name, ttp = position for the new room, tp = position where you want it to appear Teleport, time = time after which disappears teleport, bro = the second boss to kill in this room
-- 1 room
		["Evil Eye"] = {ttp={x = 1592, y = 1908, z = 6},	tp={x = 1592, y = 1914, z = 7, stackpos=1}, time = 4,	bro = "Exodius"},
		["Exodius"] = {ttp={x = 1592, y = 1908, z = 6},		tp={x = 1592, y = 1914, z = 7, stackpos=1}, time = 4,	bro = "Evil eye"},
-- 2 room
		["Exodius"] = {ttp={x = 2222, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 4,	bro = "Amirs bodyguard"},
		["Amirs bodyguard"] = {ttp={x = 2222, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 4,	bro = "Exodius"},
-- 3 room
		["Exodius"] = {ttp={x = 3333, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 4,	bro = "Paradise master"},
		["Paraidse master"] = {ttp={x = 3333, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 4,	bro = "Exodius"},
-- 4 room
		["Amirs bodyguard"] = {ttp={x = 4444, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 5,	bro = "Paradise master"},
		["Paradise master"] = {ttp={x = 4444, y = 1111, z = 11},	tp={x = 1111, y = 1111, z = 11, stackpos=1}, time = 5,	bro = "Amirs bodyguard"}
	}
}
function onKill(cid, target, lastHit)
	local k = c.boss[getCreatureName(target)]
	if(not isPlayer(target)) and isPlayer(cid) and k and not(getCreatureMaster(target)) then
		if(k.bro) then
			local bro = getCreatureByName(k.bro)
			if isMonster(bro) and getDistanceBetween(getThingPosition(cid), getThingPosition(bro)) < 8 then -- 
				return true
			end
		end
		doCreateTeleport(1387, k.ttp, k.tp)
		doCreatureSay(cid, "You now have ".. k.time .."sec  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_SAY)
		addEvent(function()
			local itek = getTileItemById(k.tp, 1387)
			if itek.uid > 0 then
				doRemoveItem(itek.uid, 1)
			end
		end, k.time*1000, k.tp)
	end
	return true
end

- - - Updated - - -

error:

Code:
[17:5:49.715] [Error - CreatureScript Interface]
[17:5:49.715] data/creaturescripts/scripts/viptrial.lua:onKill
[17:5:49.716] Description:
[17:5:49.717] (luaDoCreateTeleport) Tile not found
 
Last edited:
im currently using this
no errors, and no tp spawn after i kill both

Lua:
local c = {
	boss = { -- Boss Name, ttp = position for the new room, tp = position where you want it to appear Teleport, time = time after which disappears teleport, bro = the second boss to kill in this room
-- 1 room
		["evil Eye"] = {ttp={x = 1592, y = 1908, z = 6},	tp={x = 1592, y = 1914, z = 7, stackpos=1}, time = 4,	bro = "exodius"},
		["exodius"] = {ttp={x = 1592, y = 1908, z = 6},		tp={x = 1592, y = 1914, z = 7, stackpos=1}, time = 4,	bro = "evil eye"}
	}
}
function onKill(cid, target, lastHit)
	local k = c.boss[getCreatureName(target)]
	if(not isPlayer(target)) and isPlayer(cid) and k and not(getCreatureMaster(target)) then
		if(k.bro) then
			local bro = getCreatureByName(k.bro)
			if isMonster(bro) and getDistanceBetween(getThingPosition(cid), getThingPosition(bro)) < 5 then -- 
				return true
			end
		end
		doCreateTeleport(1387, k.ttp, k.tp)
		addEvent(function()
			local itek = getTileItemById(k.tp, 1387)
			if itek.uid > 0 then
				doRemoveItem(itek.uid, 1)
			end
		end, k.time*1000, k.tp)
	end
	return true
end
 
do a script after kill x monster get x storage and do movement script if do player have x storage so enter on x position and when he enter on x position remove -1 of this x storage, and do a teleport to make the player go back if he not have that x storage , i think you won't me do it for you because i think that you is a lua scripter '_'
 
Status
Not open for further replies.
Back
Top