Eae galera do xtibia beleza? hoje venho trazer o Death System um sisteminha que um amigo meu fez, é bem utilizado atualmente.
Antes de tudo gostaria de deixar bem claro que não fui eu que fiz.
Créditos no final do tópico.
Testado em OTX Server 8.60 e TheForgottenServer 0.4 8.60...
Como funciona?
O Death System em alguns servidores possui um channel chamado "Mortes" ou "Death Channel",
mas há alguns servidores que preferem que seja anunciado no default mesmo e a função é informar
quem matou quem, ou quem foi morto por certo monstro.
O que há de novo?
Bom, agora quem matar x jogadores(configurável) e essa quantia for uma consecutiva, será anunciado isso :
E se algum jogador derrotá-lo dentro a consecutiva, será anunciado isso :
Vamos ao sistema :
em data/XML/channels.xml, adicione isso :
<channel id="15" name="Death Channel"/>
em data/creaturescripts/creaturescripts.xml :
<event type="death" name="deathchannel" event="script" value="deathchannel.lua"/>
em data/creaturescripts/login.lua, adicione isso antes do último return true :
registerCreatureEvent(cid, "deathchannel")
em data/creaturescripts/scripts, crie um arquivo deathchannel.lua e cole isso dentro :
TFS:
-- Coded by Zoom..
local info, win, lose = "%s [Level: %s] foi mort%s pelo %s %s%s", "%s obteve %s frags seguidos após derrotar %s.", "%s acabou de impedir que %s fizesse uma sequência de %s frags seguidos."
local frags, storage = {10, 15, 20, 25, 30, 35, 40, 45, 50}, 30045
function onDeath(cid, corpse, deathList)
if(not isPlayer(cid)) then
return true
end
local target = deathList[1]
doCreatureSetStorage(target, storage, getCreatureStorage(target, storage) + (getCreatureStorage(target, storage) == -1 and 2 or 1))
for _, pid in ipairs(getPlayersOnline()) do
doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_O, 0xF)
for _, frag in ipairs(frags) do
if(getCreatureStorage(target, storage) == frag) then
doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_W, 0xF)
end
if(getCreatureStorage(cid, storage) >= frag) then
doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), getCreatureStorage(cid, storage)+1), TALKTYPE_CHANNEL_RN, 0xF)
end
end
end
doCreatureSetStorage(cid, storage, 0)
return true
end
OTX:
-- Coded by Zoom..
local info, win, lose = "%s [Level: %s] foi mort%s pelo %s %s%s", "%s obteve %s frags seguidos após derrotar %s.", "%s acabou de impedir que %s fizesse uma sequência de %s frags seguidos."
local frags, storage = {10, 15, 20, 25, 30, 35, 40, 45, 50}, 30045
function onDeath(cid, corpse, deathList)
if(not isPlayer(cid)) then
return true
end
local target = deathList[1]
doCreatureSetStorage(target, storage, getCreatureStorage(target, storage) + (getCreatureStorage(target, storage) == -1 and 2 or 1))
for _, pid in ipairs(getPlayersOnline()) do
doPlayerSendChannelMessage(pid, '', info:format(getCreatureName(cid), getPlayerLevel(cid), getPlayerSex(cid) == 1 and "o" or "a", isPlayer(target) and "player" or "monstro", getCreatureName(target), isPlayer(target) and " [Level: "..getPlayerLevel(target).."]." or "."), TALKTYPE_CHANNEL_ORANGE, 0xF)
for _, frag in ipairs(frags) do
if(getCreatureStorage(target, storage) == frag) then
doPlayerSendChannelMessage(pid, '', win:format(getCreatureName(target), frag, getCreatureName(cid)), TALKTYPE_CHANNEL_MANAGEMENT, 0xF)
end
if(getCreatureStorage(cid, storage) >= frag) then
doPlayerSendChannelMessage(pid, '', lose:format(getCreatureName(target), getCreatureName(cid), getCreatureStorage(cid, storage)+1), TALKTYPE_GAMEMASTER_CHANNEL, 0xF)
end
end
end
doCreatureSetStorage(cid, storage, 0)
return true
end
Há uma única configuração, que é as consecutivas :
local frags = {10, 15, 20, 25, 30, 35, 40, 45, 50}
completou 10 frags? anuncia! e assim sucessivamente..
Créditos: Zoom