Ir para conteúdo

[MODS] - [8.6] Perfect Zombie System [Automático] [V1.0]

Featured Replies

Postado

Desculpe o doble post, sei que é contra as regras, é que eu realmente estou com esse problema e precisava de uma ajuda, dessa vez trouxe mais detalhes.

 

Problema: Quando eu inicio o EVENTO, o teleporte aparece a cordenada, ao entrar no teleporte eu vou pra um local inexistente igual na imagem ANEXADA.

 

 

ARENA.png

GLOBAL.png

LIB.png

MAPA.png

ERRO.png

  • Respostas 107
  • Visualizações 12.1k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • pronto

  • FIZ UM UPDATE NO MODS   Coloquei pro zombier só nascer onde ele pode ser criado(não em montanhas)    e   coloquei comando /zombiestart MINUTOS;   exemplo  

  • sim, abre a lib(se você usa tudo por lua) do zombie  ou no MODS e procure por essa linha:   doCreateMonster(zombie_config.monster_name, pos, false, false, false)   e troque por essa:

Posted Images

Postado

Estou com problemas, quando acaba o evento o premio vai para um player aleatório sendo que o player nem estava no evento.

E o vencedor fica no evento e não é teleportado para o templo. E não da nenhum erro na distro.

  • 4 months later...
Postado

Aqui no meu, funcionou em partes, com alguns erros:

 

1 - Como fazer nascer mais Zombies? Pois nasceu no máximo 5. De 7 a 10 seria ótimo.

 

10:47 A zombie has spawned! There is currently 1 zombies in the zombie event!
10:47 A zombie has spawned! There is currently 2 zombies in the zombie event!

 

3 - Como remover essa premiação de trophy do script?

 

rewards = {items ={{10503,1},{9971,15}}, trophy = 6573},

 

 

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Perfect Zombie System" version="8.6" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="zombie_config"><![CDATA[
zombie_config = {
	storages = {172100, 172101, 172102}, -- n edite
	players = {min = 2, max = 30}, -- min, max players no evento
	rewards = {items ={{10503,1},{9971,15}}, trophy = 6573}, 
	timeToStartEvent = 30, -- segundos para começar o evento
	CheckTime = 2, -- tempo que o TP fica aberto para os jogadores adrentarem o evento
	teleport = {{x=1114, y=979, z=7}, {x=1839 , y=1188, z=7}}, -- position do tp onde aparece, position para onde o jogador vai ao entrar no tp
	arena = {{x=1825,y=1130,z=7},{x=1872,y=1192,z=7}}, -- area positions
	monster_name = "Zombie Event",
	timeBetweenSpawns = 30,
	min_Level = 500
}
zombie_days = {
	["Monday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Tuesday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Wednesday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Thursday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Friday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Saturday"] = {"10:45","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"},
	["Sunday"] = {"09:30","11:30","13:30","15:30","17:30","19:30","21:30","23:30","01:30"}
}
function removeZombieTp()
	local t = getTileItemById(zombie_config.teleport[1], 1387).uid
	return t > 0 and doRemoveItem(t) and doSendMagicEffect(zombie_config.teleport[1], CONST_ME_POFF)
end
function ZerarStoragesZombie()
	for _, stor in pairs(zombie_config.storages) do
		setGlobalStorageValue(stor, 0)
	end
end
function getPlayersInZombieEvent()
	local t = {}
	for _, pid in pairs(getPlayersOnline()) do
		if isInRange(getPlayerPosition(pid), zombie_config.arena[1], zombie_config.arena[2]) and getPlayerAccess(pid) < 3 then 
			t[#t+1] = pid
		end
	end
	return t
end
function getZombieRewards(cid, items)
	local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
	for _, i_i in ipairs(items) do
		local item, amount = i_i[1],i_i[2]
		if isItemStackable(item) or amount == 1 then
			doAddContainerItem(backpack, item, amount)
		else
			for i = 1, amount do
				doAddContainerItem(backpack, item, 1)
			end
		end
	end
end
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
function HaveCreatureZombie(area, remove)
	for x = area[1].x - 1, area[2].x + 1 do
		for y = area[1].y - 1, area[2].y + 1 do
			local pos = {x=x, y=y, z=area[1].z}
			local m = getTopCreature(pos).uid
			if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
		end
	end
end
function spawnZombie()
	if #getPlayersInZombieEvent() > 1 then
		local pos = {x=math.random(zombie_config.arena[1].x, zombie_config.arena[2].x), y=math.random(zombie_config.arena[1].y,zombie_config.arena[2].y), z=zombie_config.arena[1].z}
		if not isWalkable(pos, false, false, false) then 
			spawnZombie() 
		else
			doSummonCreature(zombie_config.monster_name, pos)
			doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
			addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
			addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
			doSendMagicEffect(pos, CONST_ME_MORTAREA)
			setGlobalStorageValue(zombie_config.storages[2], getGlobalStorageValue(zombie_config.storages[2]) <= 0 and 1 or getGlobalStorageValue(zombie_config.storages[2])+1)
			doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(zombie_config.storages[2]) .. " zombies in the zombie event!", MESSAGE_STATUS_CONSOLE_RED)
			addEvent(spawnZombie, zombie_config.timeBetweenSpawns *1000)
		end
	end
end
function CheckZombieEvent(delay)
	if getGlobalStorageValue(zombie_config.storages[1]) ~= (zombie_config.players.max+1) then
		if delay > 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.max then
			doBroadcastMessage("Zombie event starting in " .. delay .. " minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
		elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.min then
			for _, cid in pairs(getPlayersInZombieEvent()) do
				doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			end
			removeZombieTp()
			doBroadcastMessage("The Zombie event could not start because of to few players participating.\n At least " .. zombie_config.players.min .. " players is needed!", MESSAGE_STATUS_WARNING)
			ZerarStoragesZombie()
		elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) >= zombie_config.players.min then
			removeZombieTp()
			doBroadcastMessage("The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1]) .. " players]! The event will soon start.")
			for _, var in pairs(getPlayersInZombieEvent()) do
				doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
			end
			addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
		end
		addEvent(CheckZombieEvent, 60000, delay-1)
	end
end]]></config>
<event type="statschange" name="ZombieStats" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isMonster(attacker) and getCreatureName(attacker) == zombie_config.monster_name then
	if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
		if #getPlayersInZombieEvent() > 1 then
			doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED)
			local corpse = doCreateItem(getPlayerSex(cid) == 1 and 3058 or 6081, 1, getPlayerPosition(cid))
			doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
			doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
			doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
			if #getPlayersInZombieEvent() == 1 then
				local winner = getPlayersInZombieEvent()[1]
				doBroadcastMessage(getCreatureName(winner)..' has survived at zombie event!')
				local goblet = doPlayerAddItem(winner, zombie_config.rewards.trophy, 1)
				doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(winner) .. " for winning the Zombie event.")
				getZombieRewards(winner, zombie_config.rewards.items)
				doTeleportThing(winner, getTownTemplePosition(getPlayerTown(winner)), false)
				doSendMagicEffect(getPlayerPosition(winner), CONST_ME_TELEPORT)
				doBroadcastMessage(getPlayerName(winner).." won the Zombie event! Congratulations!")
				HaveCreatureZombie(zombie_config.arena, true)
				ZerarStoragesZombie()
			end
		else
			doBroadcastMessage("No one survived in the Zombie Event.", MESSAGE_EVENT_ADVANCE)
			HaveCreatureZombie(zombie_config.arena, true)
			ZerarStoragesZombie()
		end
		return false
	end
end
return true]]></event>
<globalevent name="Zombie_Start" interval="60000" event="script"><![CDATA[
domodlib('zombie_config')
function onThink(interval, lastExecution)
	if zombie_days[os.date("%A")] then
		local hrs = tostring(os.date("%X")):sub(1, 5)
		if isInArray(zombie_days[os.date("%A")], hrs) and getGlobalStorageValue(zombie_config.storages[3]) <= 0 then
			local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
			doItemSetAttribute(tp, "aid", 45110)
			CheckZombieEvent(zombie_config.CheckTime)
			setGlobalStorageValue(zombie_config.storages[1], 0)
			setGlobalStorageValue(zombie_config.storages[2], 0)
			HaveCreatureZombie(zombie_config.arena, true) 
		end
	end
	return true
end]]></globalevent>
<event type="login" name="Zombie_Login" event="script"><![CDATA[
domodlib('zombie_config')
function onLogin(cid)
	registerCreatureEvent(cid, "ZombieBattle")
	registerCreatureEvent(cid, "ZombieStats")
	if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
	end
	return true
end]]></event>
<event type="combat" name="ZombieBattle" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isPlayer(target) and isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
	doPlayerSendCancel(cid, "You may not attack this player.") return false
end
return true
]]></event>
<movevent type="StepIn" actionid ="45110" event="script"><![CDATA[
domodlib('zombie_config')
function onStepIn(cid, item, position, fromPosition)
	if not isPlayer(cid) then return true end
	if getPlayerAccess(cid) > 3 then return doTeleportThing(cid, zombie_config.teleport[2]) end
	if getPlayerLevel(cid) < zombie_config.min_Level then
		doTeleportThing(cid, fromPosition, true)
		doPlayerSendCancel(cid, "You need to be at least level " .. zombie_config.min_Level .. ".")
		doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
		return true
	end
	if getGlobalStorageValue(zombie_config.storages[1]) <= zombie_config.players.max then
		doTeleportThing(cid, zombie_config.teleport[2])
		setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
		doBroadcastMessage(getPlayerName(cid) .. " entered the Zombie event! Currently " .. getGlobalStorageValue(zombie_config.storages[1]) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED)
		if getGlobalStorageValue(zombie_config.storages[1]) == zombie_config.players.max then
			setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
			removeZombieTp()
			doBroadcastMessage("The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1])-1 .. " players]! The event will soon start.")
			for _, var in pairs(getPlayersInZombieEvent()) do
				doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
			end
			addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
		end 
	end
	return true
end]]></movevent>
<talkaction words="/zombiestart;!zombiestart" access="5" event="buffer"><![CDATA[
domodlib('zombie_config')
	if getGlobalStorageValue(zombie_config.storages[3]) > 0 then
		doPlayerSendCancel(cid, "The event is already starting.") return true
	elseif not param or not tonumber(param) then 
		doPlayerSendCancel(cid, "Use only numbers.") return true 
	end
	local param = tonumber(param) <= 0 and 1 or tonumber(param)
	local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
		doItemSetAttribute(tp, "aid", 45110)
		CheckZombieEvent(tonumber(param))
		ZerarStoragesZombie()
		setGlobalStorageValue(zombie_config.storages[3], 1)
		HaveCreatureZombie(zombie_config.arena, true)
]]></talkaction>
<globalevent name="ZombieDebug-Start" type="start" event="buffer"><![CDATA[
domodlib('zombie_config')
ZerarStoragesZombie()
return true]]></globalevent>
</mod>

 

 

 

 

Editado por JcA (veja o histórico de edições)

  • 3 months later...
Postado

@Vodkart ,

Evento perfeito, funcionando filé.. Porem tem algo errado, ele só sumona 7 zombies. 
Queria que fosse nascendo até o evento acabar, seguindo a ordem de 20 seg pra cada um nascer..
Pois eu uso esse mapa do meu amigo Bordin e como ele é grande, fica geral parado nas pontas sem nenhum zombie achar eles.

10:14 A zombie has spawned! There is currently 1 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 2 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 3 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 4 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 5 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 6 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 7 zombies in the zombie event!

 

Spoiler

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Perfect Zombie System" version="8.6" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="zombie_config"><![CDATA[
zombie_config = {
    storages = {172100, 172101, 172102}, -- n edite
    players = {min = 2, max = 30}, -- min, max players no evento
    rewards = {items ={{9971,10},{8301,1}}, trophy = 5805}, 
    timeToStartEvent = 30, -- segundos para começar o evento
    CheckTime = 1, -- tempo que o TP fica aberto para os jogadores adrentarem o evento
    teleport = {{x=175, y=51, z=7}, {x=549 , y=131, z=7}}, -- position do tp onde aparece, position para onde o jogador vai ao entrar no tp
    arena = {{x=522,y=106,z=7},{x=573,y=165,z=7}}, -- area positions
    monster_name = "Zombie Event",
    timeBetweenSpawns = 20,
    min_Level = 80
}
zombie_days = {
    ["Monday"] = {"13:00","18:00","20:00","22:00"},
    ["Tuesday"] = {"13:00","18:00","22:50","22:00"},
    ["Wednesday"] = {"21:57","18:00","20:00","23:17"},
    ["Thursday"] = {"13:00","18:00","20:00","22:00"},
    ["Friday"] = {"13:00","18:00","21:45","22:00"},
    ["Saturday"] = {"13:00","18:00","20:00","22:00"},
    ["Sunday"] = {"13:00","18:00","20:00","22:00"}
}
function removeZombieTp()
    local t = getTileItemById(zombie_config.teleport[1], 1387).uid
    return t > 0 and doRemoveItem(t) and doSendMagicEffect(zombie_config.teleport[1], CONST_ME_POFF)
end
function ZerarStoragesZombie()
    for _, stor in pairs(zombie_config.storages) do
        setGlobalStorageValue(stor, 0)
    end
end
function getPlayersInZombieEvent()
    local t = {}
    for _, pid in pairs(getPlayersOnline()) do
        if isInRange(getPlayerPosition(pid), zombie_config.arena[1], zombie_config.arena[2]) and getPlayerAccess(pid) < 3 then 
            t[#t+1] = pid
        end
    end
    return t
end
function getZombieRewards(cid, items)
    local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
    for _, i_i in ipairs(items) do
        local item, amount = i_i[1],i_i[2]
        if isItemStackable(item) or amount == 1 then
            doAddContainerItem(backpack, item, amount)
        else
            for i = 1, amount do
                doAddContainerItem(backpack, item, 1)
            end
        end
    end
end
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
function HaveCreatureZombie(area, remove)
    for x = area[1].x - 1, area[2].x + 1 do
        for y = area[1].y - 1, area[2].y + 1 do
            local pos = {x=x, y=y, z=area[1].z}
            local m = getTopCreature(pos).uid
            if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
        end
    end
end
function spawnZombie()
    if #getPlayersInZombieEvent() > 1 then
        local pos = {x=math.random(zombie_config.arena[1].x, zombie_config.arena[2].x), y=math.random(zombie_config.arena[1].y,zombie_config.arena[2].y), z=zombie_config.arena[1].z}
        if not isWalkable(pos, false, false, false) then 
            spawnZombie() 
        else
            doSummonCreature(zombie_config.monster_name, pos)
            doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
            addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
            addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
            doSendMagicEffect(pos, CONST_ME_MORTAREA)
            setGlobalStorageValue(zombie_config.storages[2], getGlobalStorageValue(zombie_config.storages[2]) <= 0 and 1 or getGlobalStorageValue(zombie_config.storages[2])+1)
            doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(zombie_config.storages[2]) .. " zombies in the zombie event!", MESSAGE_STATUS_CONSOLE_RED)
            addEvent(spawnZombie, zombie_config.timeBetweenSpawns *1000)
        end
    end
end
function CheckZombieEvent(delay)
    if getGlobalStorageValue(zombie_config.storages[1]) ~= (zombie_config.players.max+1) then
        if delay > 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.max then
            doBroadcastMessage("Zombie event starting in " .. delay .. " minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
        elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.min then
            for _, cid in pairs(getPlayersInZombieEvent()) do
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            end
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event could not start because of to few players participating.\n At least " .. zombie_config.players.min .. " players is needed!", MESSAGE_STATUS_WARNING)
            ZerarStoragesZombie()
        elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) >= zombie_config.players.min then
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1]) .. " players]! The event will soon start.")
            for _, var in pairs(getPlayersInZombieEvent()) do
                doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "[Zombie Event] The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
            end
            addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
        end
        addEvent(CheckZombieEvent, 60000, delay-1)
    end
end]]></config>
<event type="statschange" name="ZombieStats" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isMonster(attacker) and getCreatureName(attacker) == zombie_config.monster_name then
    if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
        if #getPlayersInZombieEvent() > 1 then
            doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED)
            local corpse = doCreateItem(getPlayerSex(cid) == 1 and 3058 or 6081, 1, getPlayerPosition(cid))
            doItemSetAttribute(corpse, "description", "[Zombie Event] You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            if #getPlayersInZombieEvent() == 1 then
                local winner = getPlayersInZombieEvent()[1]
                doBroadcastMessage(getCreatureName(winner)..' has survived at zombie event!')
                local goblet = doPlayerAddItem(winner, zombie_config.rewards.trophy, 1)
                doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(winner) .. " for winning the Zombie event.")
                getZombieRewards(winner, zombie_config.rewards.items)
                doTeleportThing(winner, getTownTemplePosition(getPlayerTown(winner)), false)
                doSendMagicEffect(getPlayerPosition(winner), CONST_ME_TELEPORT)
                doBroadcastMessage(getPlayerName(winner).." won the Zombie event! Congratulations!")
                HaveCreatureZombie(zombie_config.arena, true)
                ZerarStoragesZombie()
            end
        else
            doBroadcastMessage("[Zombie Event] No one survived in the Zombie Event.", MESSAGE_EVENT_ADVANCE)
            HaveCreatureZombie(zombie_config.arena, true)
            ZerarStoragesZombie()
        end
        return false
    end
end
return true]]></event>
<globalevent name="Zombie_Start" interval="60000" event="script"><![CDATA[
domodlib('zombie_config')
function onThink(interval, lastExecution)
    if zombie_days[os.date("%A")] then
        local hrs = tostring(os.date("%X")):sub(1, 5)
        if isInArray(zombie_days[os.date("%A")], hrs) and getGlobalStorageValue(zombie_config.storages[3]) <= 0 then
            local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
            doItemSetAttribute(tp, "aid", 45110)
            CheckZombieEvent(zombie_config.CheckTime)
            setGlobalStorageValue(zombie_config.storages[1], 0)
            setGlobalStorageValue(zombie_config.storages[2], 0)
            HaveCreatureZombie(zombie_config.arena, true) 
        end
    end
    return true
end]]></globalevent>
<event type="login" name="Zombie_Login" event="script"><![CDATA[
domodlib('zombie_config')
function onLogin(cid)
    registerCreatureEvent(cid, "ZombieBattle")
    registerCreatureEvent(cid, "ZombieStats")
    if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    return true
end]]></event>
<event type="combat" name="ZombieBattle" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isPlayer(target) and isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
    doPlayerSendCancel(cid, "You may not attack this player.") return false
end
return true
]]></event>
<movevent type="StepIn" actionid ="45110" event="script"><![CDATA[
domodlib('zombie_config')
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then return true end
    if getPlayerAccess(cid) > 3 then return doTeleportThing(cid, zombie_config.teleport[2]) end
    if getPlayerLevel(cid) < zombie_config.min_Level then
        doTeleportThing(cid, fromPosition, true)
        doPlayerSendCancel(cid, "[Zombie Event] You need to be at least level " .. zombie_config.min_Level .. ".")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
        return true
    end
    if getGlobalStorageValue(zombie_config.storages[1]) <= zombie_config.players.max then
        doTeleportThing(cid, zombie_config.teleport[2])
        setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
        doBroadcastMessage(getPlayerName(cid) .. " entered the Zombie event! Currently " .. getGlobalStorageValue(zombie_config.storages[1]) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED)
        if getGlobalStorageValue(zombie_config.storages[1]) == zombie_config.players.max then
            setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1])-1 .. " players]! The event will soon start.")
            for _, var in pairs(getPlayersInZombieEvent()) do
                doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "[Zombie Event] The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
            end
            addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
        end 
    end
    return true
end]]></movevent>
<talkaction words="/zombiestart;!zombiestart" access="5" event="buffer"><![CDATA[
domodlib('zombie_config')
    if getGlobalStorageValue(zombie_config.storages[3]) > 0 then
        doPlayerSendCancel(cid, "[Zombie Event] The event is already starting.") return true
    elseif not param or not tonumber(param) then 
        doPlayerSendCancel(cid, "[Zombie Event] Use only numbers.") return true 
    end
    local param = tonumber(param) <= 0 and 1 or tonumber(param)
    local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
        doItemSetAttribute(tp, "aid", 45110)
        CheckZombieEvent(tonumber(param))
        ZerarStoragesZombie()
        setGlobalStorageValue(zombie_config.storages[3], 1)
        HaveCreatureZombie(zombie_config.arena, true)
]]></talkaction>
<globalevent name="ZombieDebug-Start" type="start" event="buffer"><![CDATA[
domodlib('zombie_config')
ZerarStoragesZombie()
return true]]></globalevent>
</mod>

 

Postado
  • Autor
Em 04/12/2017 em 10:37, brendoonh disse:

@Vodkart ,

Evento perfeito, funcionando filé.. Porem tem algo errado, ele só sumona 7 zombies. 
Queria que fosse nascendo até o evento acabar, seguindo a ordem de 20 seg pra cada um nascer..
Pois eu uso esse mapa do meu amigo Bordin e como ele é grande, fica geral parado nas pontas sem nenhum zombie achar eles.

10:14 A zombie has spawned! There is currently 1 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 2 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 3 zombies in the zombie event!
10:15 A zombie has spawned! There is currently 4 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 5 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 6 zombies in the zombie event!
10:16 A zombie has spawned! There is currently 7 zombies in the zombie event!

 

  Mostrar conteúdo oculto

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Perfect Zombie System" version="8.6" author="Vodkart" contact="tibiaking.com" enabled="yes">
<config name="zombie_config"><![CDATA[
zombie_config = {
    storages = {172100, 172101, 172102}, -- n edite
    players = {min = 2, max = 30}, -- min, max players no evento
    rewards = {items ={{9971,10},{8301,1}}, trophy = 5805}, 
    timeToStartEvent = 30, -- segundos para começar o evento
    CheckTime = 1, -- tempo que o TP fica aberto para os jogadores adrentarem o evento
    teleport = {{x=175, y=51, z=7}, {x=549 , y=131, z=7}}, -- position do tp onde aparece, position para onde o jogador vai ao entrar no tp
    arena = {{x=522,y=106,z=7},{x=573,y=165,z=7}}, -- area positions
    monster_name = "Zombie Event",
    timeBetweenSpawns = 20,
    min_Level = 80
}
zombie_days = {
    ["Monday"] = {"13:00","18:00","20:00","22:00"},
    ["Tuesday"] = {"13:00","18:00","22:50","22:00"},
    ["Wednesday"] = {"21:57","18:00","20:00","23:17"},
    ["Thursday"] = {"13:00","18:00","20:00","22:00"},
    ["Friday"] = {"13:00","18:00","21:45","22:00"},
    ["Saturday"] = {"13:00","18:00","20:00","22:00"},
    ["Sunday"] = {"13:00","18:00","20:00","22:00"}
}
function removeZombieTp()
    local t = getTileItemById(zombie_config.teleport[1], 1387).uid
    return t > 0 and doRemoveItem(t) and doSendMagicEffect(zombie_config.teleport[1], CONST_ME_POFF)
end
function ZerarStoragesZombie()
    for _, stor in pairs(zombie_config.storages) do
        setGlobalStorageValue(stor, 0)
    end
end
function getPlayersInZombieEvent()
    local t = {}
    for _, pid in pairs(getPlayersOnline()) do
        if isInRange(getPlayerPosition(pid), zombie_config.arena[1], zombie_config.arena[2]) and getPlayerAccess(pid) < 3 then 
            t[#t+1] = pid
        end
    end
    return t
end
function getZombieRewards(cid, items)
    local backpack = doPlayerAddItem(cid, 1999, 1) -- backpackID
    for _, i_i in ipairs(items) do
        local item, amount = i_i[1],i_i[2]
        if isItemStackable(item) or amount == 1 then
            doAddContainerItem(backpack, item, amount)
        else
            for i = 1, amount do
                doAddContainerItem(backpack, item, 1)
            end
        end
    end
end
function isWalkable(pos, creature, proj, pz)-- by Nord
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
    if getTopCreature(pos).uid > 0 and creature then return false end
    if getTileInfo(pos).protection and pz then return false, true end
    local n = not proj and 3 or 2
    for i = 0, 255 do
        pos.stackpos = i
        local tile = getTileThingByPos(pos)
        if tile.itemid ~= 0 and not isCreature(tile.uid) then
            if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
                return false
            end
        end
    end
    return true
end
function HaveCreatureZombie(area, remove)
    for x = area[1].x - 1, area[2].x + 1 do
        for y = area[1].y - 1, area[2].y + 1 do
            local pos = {x=x, y=y, z=area[1].z}
            local m = getTopCreature(pos).uid
            if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
        end
    end
end
function spawnZombie()
    if #getPlayersInZombieEvent() > 1 then
        local pos = {x=math.random(zombie_config.arena[1].x, zombie_config.arena[2].x), y=math.random(zombie_config.arena[1].y,zombie_config.arena[2].y), z=zombie_config.arena[1].z}
        if not isWalkable(pos, false, false, false) then 
            spawnZombie() 
        else
            doSummonCreature(zombie_config.monster_name, pos)
            doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE)
            addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE)
            addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA)
            doSendMagicEffect(pos, CONST_ME_MORTAREA)
            setGlobalStorageValue(zombie_config.storages[2], getGlobalStorageValue(zombie_config.storages[2]) <= 0 and 1 or getGlobalStorageValue(zombie_config.storages[2])+1)
            doBroadcastMessage("A zombie has spawned! There is currently " .. getGlobalStorageValue(zombie_config.storages[2]) .. " zombies in the zombie event!", MESSAGE_STATUS_CONSOLE_RED)
            addEvent(spawnZombie, zombie_config.timeBetweenSpawns *1000)
        end
    end
end
function CheckZombieEvent(delay)
    if getGlobalStorageValue(zombie_config.storages[1]) ~= (zombie_config.players.max+1) then
        if delay > 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.max then
            doBroadcastMessage("Zombie event starting in " .. delay .. " minutes! The teleport will be closed when the event start!", MESSAGE_STATUS_WARNING)
        elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) < zombie_config.players.min then
            for _, cid in pairs(getPlayersInZombieEvent()) do
                doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            end
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event could not start because of to few players participating.\n At least " .. zombie_config.players.min .. " players is needed!", MESSAGE_STATUS_WARNING)
            ZerarStoragesZombie()
        elseif delay == 0 and getGlobalStorageValue(zombie_config.storages[1]) >= zombie_config.players.min then
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1]) .. " players]! The event will soon start.")
            for _, var in pairs(getPlayersInZombieEvent()) do
                doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "[Zombie Event] The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
            end
            addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
        end
        addEvent(CheckZombieEvent, 60000, delay-1)
    end
end]]></config>
<event type="statschange" name="ZombieStats" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isMonster(attacker) and getCreatureName(attacker) == zombie_config.monster_name then
    if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
        if #getPlayersInZombieEvent() > 1 then
            doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED)
            local corpse = doCreateItem(getPlayerSex(cid) == 1 and 3058 or 6081, 1, getPlayerPosition(cid))
            doItemSetAttribute(corpse, "description", "[Zombie Event] You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".")
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)), false)
            doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
            if #getPlayersInZombieEvent() == 1 then
                local winner = getPlayersInZombieEvent()[1]
                doBroadcastMessage(getCreatureName(winner)..' has survived at zombie event!')
                local goblet = doPlayerAddItem(winner, zombie_config.rewards.trophy, 1)
                doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(winner) .. " for winning the Zombie event.")
                getZombieRewards(winner, zombie_config.rewards.items)
                doTeleportThing(winner, getTownTemplePosition(getPlayerTown(winner)), false)
                doSendMagicEffect(getPlayerPosition(winner), CONST_ME_TELEPORT)
                doBroadcastMessage(getPlayerName(winner).." won the Zombie event! Congratulations!")
                HaveCreatureZombie(zombie_config.arena, true)
                ZerarStoragesZombie()
            end
        else
            doBroadcastMessage("[Zombie Event] No one survived in the Zombie Event.", MESSAGE_EVENT_ADVANCE)
            HaveCreatureZombie(zombie_config.arena, true)
            ZerarStoragesZombie()
        end
        return false
    end
end
return true]]></event>
<globalevent name="Zombie_Start" interval="60000" event="script"><![CDATA[
domodlib('zombie_config')
function onThink(interval, lastExecution)
    if zombie_days[os.date("%A")] then
        local hrs = tostring(os.date("%X")):sub(1, 5)
        if isInArray(zombie_days[os.date("%A")], hrs) and getGlobalStorageValue(zombie_config.storages[3]) <= 0 then
            local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
            doItemSetAttribute(tp, "aid", 45110)
            CheckZombieEvent(zombie_config.CheckTime)
            setGlobalStorageValue(zombie_config.storages[1], 0)
            setGlobalStorageValue(zombie_config.storages[2], 0)
            HaveCreatureZombie(zombie_config.arena, true) 
        end
    end
    return true
end]]></globalevent>
<event type="login" name="Zombie_Login" event="script"><![CDATA[
domodlib('zombie_config')
function onLogin(cid)
    registerCreatureEvent(cid, "ZombieBattle")
    registerCreatureEvent(cid, "ZombieStats")
    if isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
    end
    return true
end]]></event>
<event type="combat" name="ZombieBattle" event="script"><![CDATA[
domodlib('zombie_config')
if isPlayer(cid) and isPlayer(target) and isInRange(getPlayerPosition(cid), zombie_config.arena[1], zombie_config.arena[2]) then
    doPlayerSendCancel(cid, "You may not attack this player.") return false
end
return true
]]></event>
<movevent type="StepIn" actionid ="45110" event="script"><![CDATA[
domodlib('zombie_config')
function onStepIn(cid, item, position, fromPosition)
    if not isPlayer(cid) then return true end
    if getPlayerAccess(cid) > 3 then return doTeleportThing(cid, zombie_config.teleport[2]) end
    if getPlayerLevel(cid) < zombie_config.min_Level then
        doTeleportThing(cid, fromPosition, true)
        doPlayerSendCancel(cid, "[Zombie Event] You need to be at least level " .. zombie_config.min_Level .. ".")
        doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
        return true
    end
    if getGlobalStorageValue(zombie_config.storages[1]) <= zombie_config.players.max then
        doTeleportThing(cid, zombie_config.teleport[2])
        setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
        doBroadcastMessage(getPlayerName(cid) .. " entered the Zombie event! Currently " .. getGlobalStorageValue(zombie_config.storages[1]) .. " players have joined!", MESSAGE_STATUS_CONSOLE_RED)
        if getGlobalStorageValue(zombie_config.storages[1]) == zombie_config.players.max then
            setGlobalStorageValue(zombie_config.storages[1], getGlobalStorageValue(zombie_config.storages[1])+1)
            removeZombieTp()
            doBroadcastMessage("[Zombie Event] The Zombie event is now full [" .. getGlobalStorageValue(zombie_config.storages[1])-1 .. " players]! The event will soon start.")
            for _, var in pairs(getPlayersInZombieEvent()) do
                doPlayerSendTextMessage(var, MESSAGE_EVENT_ADVANCE, "[Zombie Event] The first zombie will spawn in " .. zombie_config.timeToStartEvent .. " seconds! Good luck!")
            end
            addEvent(spawnZombie, zombie_config.timeToStartEvent*1000)
        end 
    end
    return true
end]]></movevent>
<talkaction words="/zombiestart;!zombiestart" access="5" event="buffer"><![CDATA[
domodlib('zombie_config')
    if getGlobalStorageValue(zombie_config.storages[3]) > 0 then
        doPlayerSendCancel(cid, "[Zombie Event] The event is already starting.") return true
    elseif not param or not tonumber(param) then 
        doPlayerSendCancel(cid, "[Zombie Event] Use only numbers.") return true 
    end
    local param = tonumber(param) <= 0 and 1 or tonumber(param)
    local tp = doCreateItem(1387, 1, zombie_config.teleport[1])
        doItemSetAttribute(tp, "aid", 45110)
        CheckZombieEvent(tonumber(param))
        ZerarStoragesZombie()
        setGlobalStorageValue(zombie_config.storages[3], 1)
        HaveCreatureZombie(zombie_config.arena, true)
]]></talkaction>
<globalevent name="ZombieDebug-Start" type="start" event="buffer"><![CDATA[
domodlib('zombie_config')
ZerarStoragesZombie()
return true]]></globalevent>
</mod>

 

 

creio que não... tente mudar o valor das storages ai no script e depois abrir o serve e evento.

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo