Ir para conteúdo

[Encerrado] Golden Arena Pda


Hikigaya

Posts Recomendados

  • Respostas 47
  • Created
  • Última resposta

Top Posters In This Topic

Bom esse é o meu, não é certo que vai pega no seu pois editei as posições conforme meu mapa e os pokemon conforme os do meu servidor

 

 

/lib/configuration.lua

 

------------- Configuraçoes da Golden Arena ---------------------------------		   --alterado v2.7  \/\/ algumas pos, soh pro novo mapa!
timeToWaves = 30  --time entre waves, em segs...  --alterado v2.7  -- obrigatorio pegar pelo menos isso!
---------
GoldenUpper = {x=528, y=676, z=6}	--posiçao da ponta superior esquerda da arena!
GoldenLower = {x=557, y=687, z=6}	--posiçao da ponta inferior direita da arena!
---------
posGolden = {x=543, y=680, z=6}  --pos da golden pra onde os players vao ser teleportados!
posBackGolden = {x=547, y=677, z=7}	 --pos da golden pra onde os players vao ser teleportados ao morrerem e quando acabar a golden...
---------
horas = {"0:20", "2:20", "4:20", "6:20", "8:20", "10:20", "12:20", "14:20", "16:20", "17:40", "20:20", "22:20"} --alterar aki os horarios da golden arena!
--deixe sempre na ordem do menor pro maior horario!!!
--------
posisGolden = {
{x=531, y=678, z=6},
{x=534, y=683, z=6},
{x=539, y=683, z=6},
{x=541, y=678, z=6},	--aki vcs colocam todas as posiçoes q os monstros vao nascer dentro da golden arena...
{x=548, y=678, z=6},	--lembrando q o numero de posis q vcs colocarem tem q ser igual ao numero de pokes q vcs vao colocar ali embaixo!
{x=554, y=678, z=6},
{x=544, y=683, z=6},
{x=549, y=683, z=6},					--LEMBRANDO Q AGORA N PRECISA MAIS EDITAR MAIS NENHUM SCRIPT A N SER ESSE!!
{x=554, y=683, z=6},					--E O GLOBALEVENTS/GLOBALEVENTS.XML COM OS HORARIOS!
}
----------
wavesGolden = {				 --waves q vao ter na golden arena... o numero de pokes tem q ser igual ao numero de posis!!						  
[1] = {"Raticate", "Pikachu", "Tauros", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},				  
[2] = {"Venusaur", "Blastoise", "Charizard", "Golem", "Wigglytuff", "Scyther", "Nidoking", "Sandslash", "Raichu"},
[3] = {"Slowking", "Scizor", "Hitmontop", "Electabuzz", "Ursaring", "Tyranitar", "Alakazam", "Misdreavus", "Dragonite"},
[4] = {"Snorlax", "Porygon2", "Alakazam", "Gengar", "Mantine", "Blissey", "Sudowoodo", "Wobbuffet", "Aerodactyl"},
[5] = {"Shiny Seadra", "Shiny Kingler", "Shiny Voltorb", "Shiny Butterfree", "Shiny Beedrill", "Shiny Cubone", "Shiny Dratini", "Shiny Golbat", "Shiny Electrode"},
[6] = {"Tentacruel", "Aerodactyl", "Venusaur", "Charizard", "Blastoise", "Gyarados", "Kabutops", "Omastar", "Magmar"},
[7] = {"Blissey", "Scizor", "Skarmory", "Feraligatr", "Typhlosion", "Meganium", "Dragonite", "Snorlax", "Golem"},
[8] = {"Shiny Abra", "Shiny Pinsir", "Shiny Blastoise", "Shiny Arcanine", "Shiny Venusaur", "Shiny Charizard", "Shiny Tangela", "Shiny Pidgeot", "Shiny Muk"},
[9] = {"Shiny Jynx", "Shiny Golbat", "Shiny Electabuzz", "Shiny Gengar", "Shiny Magikarp", "Shiny Onix", "Shiny Dragonair", "Shiny Alakazam", "Shiny Raichu"},
[10] = {"Shiny Mr. Mime", "Shiny Mr. Mime", "Shiny Mr. Mime", "", "", "", "", "", ""},
[11] = {"Shiny Gyarados", "Shiny Gyarados", "", "", "", "", "", "", ""},
[12] = {"Shiny Snorlax", "Shiny Snorlax", "", "", "", "", "", "", ""},
[13] = {"Shiny Onix", "Shiny Farfetch'd", "Shiny Tentacruel", "Shiny Abra", "Shiny Arcanine", "Shiny Venomoth", "Blissey", "Miltank", "Porygon2"},
[14] = {"Shiny Scyther", "Shiny Jynx", "Shiny Tangela", "Shiny Pinsir", "Shiny Venusaur", "Shiny Venomoth", "Shiny Tentacruel", "Snorlax", "Ursaring"},
[15] = {"Shiny Dragonair", "Shiny Scyther", "Shiny Gengar", "Shiny Dragonite", "Shiny Pinsir", "Shiny Seadra", "Shiny Jynx", "Shiny Tangela", "Tyranitar"},
[16] = {"Shiny Abra", "Shiny Pinsir", "Shiny Blastoise", "Shiny Arcanine", "Shiny Venusaur", "Shiny Charizard", "Shiny Tangela", "Shiny Pidgeot", "Shiny Muk"},
[17] = {"Shiny Jynx", "Shiny Golbat", "Shiny Electabuzz", "Shiny Gengar", "Shiny Magikarp", "Shiny Onix", "Shiny Dragonair", "Shiny Alakazam", "Shiny Raichu"},
[18] = {"Shiny Farfetch'd", "Shiny Alakazam", "Shiny Gengar", "Shiny Pidgeot", "Shiny Muk", "Shiny Marowak", "Shiny Onix", "Shiny Tangela", "Shiny Dragonair"},
[19] = {"Shiny Dragonite", "Shiny Onix", "Shiny Mr. Mime", "Shiny Hitmonlee", "Shiny Hitmonchan", "Shiny Gyarados", "Shiny Snorlax", "Shiny Scyther", "Shiny Electabuzz"},
[20] = {"Zapdos", "", "", "", "", "", "", "", ""},
[21] = {"Moltres", "", "", "", "", "", "", "", ""},
[22] = {"Articuno", "", "", "", "", "", "", "", ""},  --o numero de espaços na tabela tem q ser o ms do numero de posis!!!
}

 

 

 

/lib/Golden Arena.lua

 

--[[storages
22545 = player q entra na arena  (normal)
22546 = monstros na arena  (normal)
22547 = waves  (global)
22548 = qnts monstros tem na arena  (global)
22549 = nome dos players q vao pra arena  (global)
22550 = qnts players tem na arena  (global)
22551 = waves para cada player  (normal)
]]
------------------------------------------------------------------------------------------------------------------
function doWave(start)
if getGlobalStorageValue(22550) >= 1 and getGlobalStorageValue(22548) <= 0 then
local wave = getGlobalStorageValue(22547) <= 0 and 1 or getGlobalStorageValue(22547)
local players = creaturesInGolden(GoldenUpper, GoldenLower, true) --pega os players na golden
for i = 1, #posisGolden do
if wavesGolden[wave][i] ~= "" then
local monster = doSummonCreature(wavesGolden[wave][i], posisGolden[i])
doSetMonsterPassive(monster)
doWildAttackPlayer(monster, players[math.random(#players)])
doSendMagicEffect(getThingPos(monster), 21)
setPlayerStorageValue(monster, 22546, 1)
local sto = getGlobalStorageValue(22548) <= 0 and 0 or getGlobalStorageValue(22548)
setGlobalStorageValue(22548, sto+1)
end
end
for a = 1, #players do
setPlayerStorageValue(players[a], 22551, wave)
end
setGlobalStorageValue(22547, wave+1)
end
end
------------------------------------------------------------------------------------------------------------------
function puxaParticipantes()
local s = ""
if getGlobalStorageValue(22549) ~= -1 then
s = string.explode(getGlobalStorageValue(22549), ",")
end

if type(s) ~= 'table' or s == "" then
print("Golden Arena will not begin, because no player are registered!")
return true
end

for i = 1, #s do
local sid = getPlayerByName(s[i])
if isCreature(sid) then
doTeleportThing(sid, getClosestFreeTile(sid, posGolden)) --pos pra onde os players vao ser teleportados quando a golden começar!
doSendMagicEffect(getThingPos(sid), 21)
if #getCreatureSummons(sid) >= 1 then
doTeleportThing(getCreatureSummons(sid)[1], getClosestFreeTile(getCreatureSummons(sid)[1], posGolden)) --pos pra onde os pokes dos players serao teleportados!
doSendMagicEffect(getThingPos(getCreatureSummons(sid)[1]), 21)
end
setPlayerStorageValue(sid, 22545, 1)
setGlobalStorageValue(22550, (getGlobalStorageValue(22550) <= 0 and 0 or getGlobalStorageValue(22550))+1)
end
end
setGlobalStorageValue(22549, -1)
end
------------------------------------------------------------------------------------------------------------------
function endGoldenArena(onStart)
for sto = 22547, 22550 do
setGlobalStorageValue(sto, -1)
end
addEvent(creaturesInGolden, 150, GoldenUpper, GoldenLower, false, true, true)
if not onStart then
print("The Golden Arena are finished!")
end
end
------------------------------------------------------------------------------------------------------------------
function creaturesInGolden(upper, lower, player, remove, clean) -- function by Vodkart and edited by Slicer
local players = {}
for x = upper.x - 1, lower.x + 1 do
for y = upper.y - 1, lower.y + 1 do
local pos = {x = x, y = y, z = upper.z}
local m = getTopCreature(pos).uid
if remove ~= false and m ~= 0 and ehMonstro(m) then doRemoveCreature(m) end
if clean ~= false then doCleanTile(pos, false) end
if player ~= false and m ~= 0 and isPlayer(m) and getPlayerStorageValue(m, 22545) == 1 then table.insert(players, m) end
end
end
if player ~= false then return players end
end
------------------------------------------------------------------------------------------------------------------
function installRankGolden()
if db.executeQuery("ALTER TABLE `players` ADD `Golden` integer not null default 0;") then
if db.executeQuery("UPDATE `players` SET `Golden` = '10000' WHERE `id` = 1;") then
local dir = "data/globalevents/scripts/start.lua"
local arq = io.open(dir, "w")
local base = 'function onStartup()\n\ndb.executeQuery("UPDATE `players` SET `online` = 0 WHERE `world_id` = " .. getConfigValue("worldId") .. ";")\n'
base = base..'endGoldenArena(true)\n\nreturn true\nend'
arq:write(base)
arq:close()

print("Table 'Golden' added with success!")
end
end
return true
end
------------------------------------------------------------------------------------------------------------------
function getPlayerRecordWaves(cid)
if not isCreature(cid) then return 0 end
local pid = getPlayerGUID(cid)
local query = db.getResult("SELECT `Golden` FROM `players` WHERE `id` = "..pid..";")

if query:getID() == -1 then
return 0
end
return query:getDataInt("Golden")
end
------------------------------------------------------------------------------------------------------------------
function setPlayerRecordWaves(cid)
if not isCreature(cid) then return false end
local waves = getPlayerStorageValue(cid, 22551)
local acc = getPlayerGUID(cid)
if waves > getPlayerRecordWaves(cid) then
if db.executeQuery("UPDATE `players` SET `Golden` = '"..waves.."' WHERE `id` = "..acc..";") then
setPlayerStorageValue(cid, 22551, -1)
return true
end
end
return false
end
------------------------------------------------------------------------------------------------------------------
function getRankGolden()
local query = db.getResult("SELECT `id`, `Golden` FROM `players` ORDER BY `Golden` DESC;")
local str = "Rank of the Golden Arena:\n\n"

if query:getID() ~= -1 then
for i = 1, 10 do
if not(query:next()) or query:getDataInt("Golden") == 0 then
str = str..""..i.."° None - 0 wave.\n"
else
local s = tonumber(query:getDataInt("Golden")) > 1 and "s" or ""
str = str..""..i.."° "..getPlayerNameByGUID(query:getDataString("id")).." - "..query:getDataInt("Golden").." wave"..s..".\n"
end
end
query:free()
end
return str
end
------------------------------------------------------------------------------------------------------------------

 

 

 

/globalevents/scripts/Golden Arena.lua

 

function onTimer(cid, interval, lastExecution)  --alterado v2.7 \/

doBroadcastMessage("Golden Arena will begin in 10 minutes! Go prepare yourself!")
addEvent(doBroadcastMessage, 300000, "Golden Arena will begin in 5 minutes!\nWe hope that participants are already prepared!")
addEvent(puxaParticipantes, 550000)  
addEvent(doBroadcastMessage, 600000, "The Golden Arena are started!")
addEvent(doWave, 600000)	

return true
end

 

 

/globalevents/globalevents.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<globalevents>

<globalevent name="save" interval="1800" event="script" value="save.lua"/>
<globalevent name="clean" interval="7200" event="script" value="clean.lua"/>


<globalevent name="serverstart" type="start" event="script" value="start.lua"/>

<globalevent name="playersrecord" type="record" event="script" value="record.lua"/>

<globalevent name="GoldenArena1" time="0:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena2" time="2:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena3" time="4:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena4" time="6:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena5" time="8:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena6" time="10:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena7" time="12:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena8" time="14:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena9" time="16:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena10" time="17:40" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena11" time="20:20" event="script" value="Golden Arena.lua"/>
<globalevent name="GoldenArena12" time="22:20" event="script" value="Golden Arena.lua"/>

</globalevents>

 

 

acho que é isso, nao cheguei a testar com + de 2 player, mais pelo oque testei ta tudo suave ;)

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

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

×
×
  • Criar Novo...