Eu peguei um zombie event aqui no xtibia e funcionou perfeitamente, mas eu gostaria de fazer umas mudanças nele:
local config = {
Eu peguei um zombie event aqui no xtibia e funcionou perfeitamente, mas eu gostaria de fazer umas mudanças nele:
local config = {
Use assim mas preste atenção, vc deve configurar a tabela id_trofeis corretamente:
local config = { playerCount = 2001, -- Global storage for counting the players left/entered in the event goblet = 5805, -- id of the gold goblet you'll get when finishing the event. rewards = {2159}, -- You will get this + a gold goblet with your name on. -- {moneyId, count, using? 1 for using moneyReward, 0 for not using.} moneyReward = {2159, 10, 1}, -- Should be same as in the globalevent! -- The zombies will spawn randomly inside this area fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground id_trofeis = {5805} -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze) } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isMonster(attacker) then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then if getGlobalStorageValue(config.playerCount) >= 4 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 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) setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1) elseif getGlobalStorageValue(config.playerCount) <= 3 then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING) local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3 if getGlobalStorageValue(config.playerCount) == 1 then local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") else local goblet = doPlayerAddItem(cid, if_trofeis[desc_], 1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") end 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) for _,items in ipairs(config.rewards) do doPlayerAddItem(cid, items, 1) end if config.moneyReward[3] == 1 then doPlayerAddItem(cid, config.moneyReward[1], math.random(10, 14)) end end for x = config.fromPosition.x, config.toPosition.x do for y = config.fromPosition.y, config.toPosition.y do for z = config.fromPosition.z, config.toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end return false end end return true end
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)
Então, não funcionou cara, quando o zombie toca no player da a mensagem "Fulano won the zombie event" mas ele não é teleportado e nem ganha os items e aparece esse erro aqui:
Abre o script da ctrl+f procura if_trofeis e substitui por id_trofeis foi um erro de digitação.
Essa coisa de ganhar menos eu mudo qd chegar em casa
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)
Mesmo erro mudando de if_trofeis pra id_trofeis.
Não tem como ser o mesmo erro, já que aquele acusava o if_teofeis.
Me mande o script e o erro pqra eu ver
REP = Curtir
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)
local config = { playerCount = 2001, -- Global storage for counting the players left/entered in the event goblet = 5805, -- id of the gold goblet you'll get when finishing the event. rewards = {2159}, -- You will get this + a gold goblet with your name on. -- {moneyId, count, using? 1 for using moneyReward, 0 for not using.} moneyReward = {2159, 10, 1}, -- Should be same as in the globalevent! -- The zombies will spawn randomly inside this area fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground id_trofeis = {5805, 7370, 7371}, -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze) quant_points = {{10, 14}, {8, 10}, {6, 8}} } function onStatsChange(cid, attacker, type, combat, value) if isPlayer(cid) and isMonster(attacker) then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then if getGlobalStorageValue(config.playerCount) >= 4 then doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED) local corpse = doCreateItem(3058, 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) setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1) elseif getGlobalStorageValue(config.playerCount) <= 3 then if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING) local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3 if getGlobalStorageValue(config.playerCount) == 1 then local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") else local goblet = doPlayerAddItem(cid, config.id_trofeis[desc_], 1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.") end 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) for _,items in ipairs(config.rewards) do doPlayerAddItem(cid, items, 1) end if getGlobalStorageValue(config.playerCount) == 1 then doPlayerAddItem(cid, config.moneyReward[1], math.random(config.quant_points[1][1], config.quant_points[1][2])) else local quant = getGlobalStorageValue(config.playerCount) == 3 and math.random(config.quant_ponts[3][1], config.quant_ponts[3][2]) or math.random(config.quant_ponts[2][1], config.quant_ponts[2][2]) doPlayerAddItem(cid, config.moneyReward[1], quant) end end for x = config.fromPosition.x, config.toPosition.x do for y = config.fromPosition.y, config.toPosition.y do for z = config.fromPosition.z, config.toPosition.z do areapos = {x = x, y = y, z = z, stackpos = 253} getMonsters = getThingfromPos(areapos) if isMonster(getMonsters.uid) then doRemoveCreature(getMonsters.uid) end end end end end return false end end return true end
na tabela quant_points vc vai por, o tanto {minimo, maximo} de points que os vencedores podem ganhar. Em ordem, primeiro o q fica em primeiro lugar, depois em segundo etc
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)
Situação agora é a seguinte: Quando os players vão morrendo e chega na parte dos 3 ultimos, os que iriam ganhar os premios, eles ganham (1 coin e um troféu de prata [sempre esses items e valores]) e o evento não acaba, por mais que o player tenha morrido e ganhado os 1 coin~troféu, se eu puxa ele pra area do evento denovo, ele vai ganha o 1 coin e troféu denovo.. aifushfiiah
Erro:
local config = {
playerCount = 2001, -- Global storage for counting the players left/entered in the event
goblet = 5805, -- id of the gold goblet you'll get when finishing the event.
rewards = {2159}, -- You will get this + a gold goblet with your name on.
-- {moneyId, count, using? 1 for using moneyReward, 0 for not using.}
moneyReward = {2159, 10, 1},
-- Should be same as in the globalevent!
-- The zombies will spawn randomly inside this area
fromPosition = {x = 1150, y = 1024, z = 7}, -- top left cornor of the playground
toPosition = {x = 1178, y = 1040, z = 7}, -- bottom right cornor of the playground
id_trofeis = {5805, 7370, 7371}, -- Bote os 3 id dos trofeis, separados por vírgula. Tem que ser em order (primeiro o de ouro, dps prata e dps bronze)
quant_points = {{10, 14}, {5, 9}, {1, 5}}
}
function onStatsChange(cid, attacker, type, combat, value)
if isPlayer(cid) and isMonster(attacker) then
if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
if getGlobalStorageValue(config.playerCount) >= 4 then
doBroadcastMessage(getPlayerName(cid) .. " have been eated by Zombies!", MESSAGE_STATUS_CONSOLE_RED)
local corpse = doCreateItem(3058, 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)
setGlobalStorageValue(config.playerCount, getGlobalStorageValue(config.playerCount)-1)
elseif getGlobalStorageValue(config.playerCount) <= 3 then
if isInArea(getPlayerPosition(cid), config.fromPosition, config.toPosition) then
local desc_ = getGlobalStorageValue(config.playerCount) == 3 and 2 or 3
if getGlobalStorageValue(config.playerCount) == 1 then
local goblet = doPlayerAddItem(cid, config.id_trofeis[1], 1)
doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.")
else
local goblet = doPlayerAddItem(cid, config.id_trofeis[desc_], 1)
local corpse = doCreateItem(3058, 1, getPlayerPosition(cid))
doItemSetAttribute(goblet, "description", "Awarded to " .. getPlayerName(cid) .. " for winning the Zombie event.")
end
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)
for _,items in ipairs(config.rewards) do
doPlayerAddItem(cid, items, 1)
end
if getGlobalStorageValue(config.playerCount) == 1 then
doPlayerAddItem(cid, config.moneyReward[1], math.random(config.quant_points[1][1], config.quant_points[1][2]))
else
local quant = getGlobalStorageValue(config.playerCount) == 3 and math.random(config.quant_points[3][1], config.quant_points[3][2]) or math.random(config.quant_points[2][1], config.quant_points[2][2])
doPlayerAddItem(cid, config.moneyReward[1], quant)
end
end
if getGlobalStorageValue(config.playerCount) == 1 then
doBroadcastMessage(getPlayerName(cid) .. " won the Zombie event! Congratulations!", MESSAGE_STATUS_WARNING)
for x = config.fromPosition.x, config.toPosition.x do
for y = config.fromPosition.y, config.toPosition.y do
for z = config.fromPosition.z, config.toPosition.z do
areapos = {x = x, y = y, z = z, stackpos = 253}
getMonsters = getThingfromPos(areapos)
if isMonster(getMonsters.uid) then
doRemoveCreature(getMonsters.uid)
end
end
end
end
end
end
return false
end
end
return true
end
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)
Resolvido, muito obrigado.
Tópico movido para a seção de dúvidas e pedidos resolvidos.
Alguns dos meus trabalhos no fórum
Projeto Tutores de Scripting (encerrado)
Evento Blood Castle Automático
Killua Task System
Killua Automatic Raids System
Função AccountStorageValue
Player Pull Action (puxar jogador)
NPC Trocador - Troca itens por outros (SIMPLIFICADO)
Teleportar Membros Da Guild Para Seu Lado
Itens Ganhando Exp e Upando (Upgrade System)
Como usar addEvent - Tutorial
Sistema de Cultivo (Plantação)
Cart System (Andar de carrinho)