Survival of the Fittest
O que é ?
O evento Survival of the Fittest pode ser aberto a qualquer dia e a qualquer hora pelo God.
Quem participa desse evento é teleportado para X lugar onde ocorre o evento.
É basicamente um mata mata, onde quem matar mais player será o vencedor.
Como funciona ?
Para abrir o evento o God deve falar "!openEvent"
- Após aberto o sistema irá mandar uma mensagem para todo o server, convidando todos os players para participarem.
Para participar o Player deve falar "!goEvent"
- Após falar isso o player será teleportado para X lugar (onde todos serão teleportado), a parti desse momento o mesmo já deve começar a matar. Iniciará uma contagem e quem matar mais será o Vencedor.
O Evento tem um tempo determinado no Script.
Se um player morrer no evento o mesmo poderá voltar quantas vezes quiser até o evento acabar.
A recompensa é definida no Script.
O Player não pode ser Teleportado com Battle.
Para participar o Player deve ter X level ou mais.
Como configurar ?
A explicação está toda no script, está tudo detalhado .
E muito fácil de configurar.
"Mensagens"
Ao ser aberto : O Evento [survival of the Fittest] começou, e será Fechado em 2 Minutos. Fale [!goEvent] Para participar.
Quando o player participa : O Jogador [Duuh Carvalho] está participando, essa é sua chance de matá-lo.
Quando tem um vencedor : O Jogador [Duuh Carvalho] matou [2 Player's] e ganhou o evento.
Quando não tem vencedor : O evento acabou e não teve um vencedor.
obs: Apenas uma amostra.
Instalando :
vá em data / talkactions / scripts e crie um arquivo.lua com o nome " survival "
e cole isso dentro :
-------------[[System by DuuhCarvalho]]------[[Xtibia.com]]--------------------- -------------------------------------------------------------------------------- --[[CONFIG WORDS]]-- local wordsPlayer = "!goEvent" -- o que o god tem que falar. local wordsGm = "!openEvent" -- o que o player tem que falar. --[[CONFIG NAME]]-- local name = "Survival of the Fittest" -- nome do evento --[[CONFIG "PLAYER"]]-- local level = 200 -- level necessario local storagePlayer = 12940 -- 1ª storage local storagePlayer2 = 123654 -- 2ª storage local posPlayer = {x= 155, y= 63, z= 7} -- Posição para onde o player será teleportado. --[[CONFIG "GOD"]]-- local storageGlobal = 17892 -- storage global. local time = 2 -- tempo para acabar o evento em minutos. --[[RECOMPENSA]]-- local recompensa = {{2160, 100}, {2493, 1}} -- {{id do item, quantidade} , {id do item, quantidade}} -------- Para adicionar mais items segue esse padrão : {{1 recompensa}, {2 recompensa}, {...}, {...}} -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function fim() if getGlobalStorageValue(storageGlobal) >= 1 then local max = 0 local winner = 0 for _, pid in pairs(getPlayersOnline()) do local sto = getPlayerStorageValue(pid, storagePlayer) if sto > max then max = sto winner = pid end end if isPlayer(winner) then doBroadcastMessage("O Jogador ["..getCreatureName(winner).."] matou ["..getPlayerStorageValue(winner, storagePlayer).." Player's] e ganhou o evento.") for i = 1, #recompensa do doPlayerAddItem(winner, recompensa[i][1], recompensa[i][2]) end else doBroadcastMessage("O evento acabou e não teve um vencedor.") end setGlobalStorageValue(storageGlobal, 0) end end -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function onSay(cid, words, param) -------------------------------------------------------------------------------- if(words == wordsPlayer) then if getPlayerGroupId(cid) <= 1 then if getGlobalStorageValue(storageGlobal) >= 1 then if getCreatureCondition(cid, CONDITION_INFIGHT) == FALSE then if getPlayerLevel(cid) >= level then local pos1 = getClosestFreeTile(cid, posPlayer, false, true) doTeleportThing(cid, pos1) doSendMagicEffect(pos1, 5) doPlayerSendCancel(cid, "Boa Sorte, mate todos.") doBroadcastMessage("O Jogador ["..getCreatureName(cid).."] está participando, essa é sua chance de matá-lo.") if getPlayerStorageValue(cid, storagePlayer2) - os.time() <= 0 then setPlayerStorageValue(cid, storagePlayer2, os.time()+time*60) end else doPlayerSendCancel(cid, "Para participar do evento você precisa ter level maior ou igual à "..level..".") end else doPlayerSendCancel(cid, "Você nãoo pode ser teleportado com Battle.") end else doPlayerSendCancel(cid, "O Evento não está aberto.") end else doPlayerSendCancel(cid, "Essa Função é Para Players.") end -------------------------------------------------------------------------------- elseif(words == wordsGm) then if getPlayerGroupId(cid) >= 4 then if getGlobalStorageValue(storageGlobal) <= 0 then for _, pid in pairs(getPlayersOnline()) do setPlayerStorageValue(pid, storagePlayer, 0) end doBroadcastMessage("O Evento ["..name.."] começou, e será Fechado em "..time.." Minutos. Fale ["..wordsPlayer.."] Para participar.") setGlobalStorageValue(storageGlobal, 1) addEvent(fim, time*60*1000) else doPlayerSendCancel(cid, "O Evento ["..name.."] já está aberto.") end else doPlayerSendCancel(cid, "Apenas o [God] Pode Usar essa função") end end -------------------------------------------------------------------------------- return true end -------------------------------------------------------------------------------- ---------------------[[Não autorizo a postagem em outro fórum]]-----------------
Obs : O que você precisa configurar está editado no próprio script.
Agora vá em data / talkactions / talkactions.xml e coloque a seguinte tag:
<talkaction words="!goEvent;!openEvent" script="survival.lua"/>
----------------------------------------------------------------------------------- --[[CONFIG]]-- --[[obs: todas as storages devem ser iguais a do primeiro script]]-- local storageGlobal = 17892 -- storage global. local storagePlayer = 12940 -- 1ª storage. local storagePlayer2 = 123654 -- 2ª storage. ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- function onDeath(cid, corpse, killer) if getGlobalStorageValue(storageGlobal) >= 1 then if isPlayer(cid) and isPlayer(killer[1]) then if (getPlayerStorageValue(cid, storagePlayer2) - os.time() >= 1) and (getPlayerStorageValue(killer[1], storagePlayer2) - os.time() >= 1) then setPlayerStorageValue(killer[1], storagePlayer, getPlayerStorageValue(killer[1], storagePlayer) + 1) end end end ----------------------------------------------------------------------------------- return true end ----------------------------------------------------------------------------------- ----------------------------------------------------------------------------------- function onLogin(cid) registerCreatureEvent(cid, "SurvivalOfTheFittest") if (getPlayerStorageValue(cid, storagePlayer2) - os.time() <= 0) then setPlayerStorageValue(cid, storagePlayer, 0) end ----------------------------------------------------------------------------------- return true end ----------------------------------------------------------------------------------- -----------------------------------------------------------------------------------
obs : as storage dos 2 scripts devem ser iguais
Agora adicione as tags em data / creaturescripts / creaturescripts.xml :
<event type="login" name="SurvivalOfTheFittestLogin" script="fittest.lua"/> <event type="death" name="SurvivalOfTheFittest" script="fittest.lua"/>
obs : Não é necessário colocar tag em login.lua
É isso