Golden Survival Arena System (Atualizado 2.7)
Introdução
A Golden Survival Arena é um evento automático que ocorre a cada 5 horas, onde os players registrados são teleportados para uma arena e devem sobreviver a waves (rounds) com vários pokémons e cada vez mais fortes.
Como participar do evento
Para participar do evento é necessário se registrar possuindo o item Meowth Coin. Este item pode ser adquirido dropando de Meowth Hunter ou comprando no NPC Meowth Dealer por 1 diamond cada Coin.
Obs: Ambos (monster e npc) estão localizados no salão do evento, para ir até o mesmo, teleporte-se utilizando um pokémon com essa habilidade (h "golden).
Adicionando o Sistema
Implantando a Arena no mapa
Primeiramente faça o download do mapa com a Arena separada para implantar a seu mapa.
Obs: Não contem nada no mapa além da Arena.
Download via MediaFire:
Clique aqui.
Scan VirusTotal:
Clique aqui.
Continuando
Após ter terminado o download, abra o mapa baixado e o mapa de seu servidor utilizando o RME (remere's map editor).
Se não possui o RME, faça o download dele no site oficial clicando aqui.
Agora com os dois mapas abertos, vá ao que foi baixado e siga as instruções.
Clique no quadrado azul localizado na diagonal esquerda para baixo no RME.
Ele será modificado para um lápis onde você poderá selecionar a área a ser copiada e transferida/copiada ao outro mapa.
Agora com a função do lapís selecionador ativada, selecione a área a ser transferida/copiada ao outro mapa.
Para isto, pressione Shift e selecione a área a ser copiada com o botão esquerdo do mouse.
Após isto, solte os botões e a área será destacada.
Agora copie o que foi selecionado (CTRL+C) e vá ao outro mapa (o que irá implantar a Arena).
Cole a área selecionada (CTRL+V) e após isto, apenas escolha o local para colocá-la e pressione o botão esquerdo do mouse.
Enfim este será o resultado da Arena implantada.
Agora vamos aos scripts do sistema e acompanhamentos necessários.
Actions
Abra a pasta data/actions/scripts de seu servidor e crie/copie qualquer arquivo .lua e renomeie para Meowth Coin.lua
Dentro do arquivo, apague tudo e adicione:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getGlobalStorageValue(22549) ~= -1 then
s = string.explode(getGlobalStorageValue(22549), ",")
for i = 1, #s do
if getCreatureName(cid) == s then
doPlayerSendTextMessage(cid, 20, "You are already registered in the Golden Arena!")
return true
end
end
if #s > 15 then
doPlayerSendTextMessage(cid, 20, "Sorry, but we have reached the limit of players for the Golden Arena!")
return true
end
end
doPlayerSendTextMessage(cid, 20, "You spent a Meowth coin! Now attend the next event of the 'Golden Survival Arena'.")
doPlayerSendTextMessage(cid, 20, "Check the time for the next event in the billboard on the CP or say /golden horarios.")
doRemoveItem(item.uid, 1)
if getGlobalStorageValue(22549) == -1 then
setGlobalStorageValue(22549, getCreatureName(cid)..",")
else
setGlobalStorageValue(22549, getGlobalStorageValue(22549)..""..getCreatureName(cid)..",")
end
end
Novamente crie/copie qualquer arquivo .lua na mesma pasta (data/actions/scripts) e renomeie para Quadro_Golden.lua
Dentro do arquivo, apague tudo e adicione:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.actionid == 65535 then
timeDiff = showTimeDiff(nextHorario(cid))
str = "Golden Survival Arena\n"
str = str.."Next Event in "..timeDiff..".\n\n"
if getGlobalStorageValue(22549) ~= -1 then
local s = string.explode(getGlobalStorageValue(22549), ",")
for i = 1, 15 do
if s and s ~= "" then
str = str.."["..i.."] - "..s.."\n"
else
str = str.."["..i.."] - Empty\n"
end
end
else
for a = 1, 15 do
str = str.."["..a.."] - Empty\n"
end
end
doShowTextDialog(cid, 6527, str)
return true
end
end
Abra a pasta data/actions/scripts de seu servidor e crie/copie qualquer arquivo .lua e renomeie para Quadro_Golden_Rank.lua
Dentro do arquivo, apague tudo e adicione:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.actionid == 55356 then
local str = getRankGolden()
if str ~= "" then
doShowTextDialog(cid, 6527, str)
else
doShowTextDialog(cid, 6527, "A error are occored! Sorry...")
print("A Error occored with the Rank of the Golden Arena!")
end
return true
end
end
No mesmo local (data/actions/scripts) abra o arquivo catch.lua
No seu, é provavel que esteja mais ou menos assim (só que com configurações de acordo com seu servidor):
local ballcatch = {
[2394] = {cr = 10, on = 24, off = 23, ball = 11826, send = 47},
[2391] = {cr = 20, on = 198, off = 197, ball = 11832, send = 48},
[2393] = {cr = 25, on = 202, off = 201, ball = 11835, send = 46},
[2392] = {cr = 15, on = 200, off = 199, ball = 11829, send = 49},
[556] = {cr = 0, on = 187, off = 176, ball = 554, send = 45},
}
function onUse(cid, item, frompos, item3, topos)
local item2 = getTopCorpse(topos)
if item2 == null then
return true
end
if getItemAttribute(item2.uid, "catching") == 1 then
return true
end
local name = string.lower(getItemNameById(item2.itemid))
name = string.gsub(name, "fainted ", "")
name = string.gsub(name, "defeated ", "")
local x = pokecatches[doCorrectPokemonName(name)]
if not x then return true end
local owner = getItemAttribute(item2.uid, "corpseowner")
if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner and isInArray({1,9}, getPlayerGroupId(cid)) then
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
local catchinfo = {}
catchinfo.rate = ballcatch[item.itemid].cr
catchinfo.catch = ballcatch[item.itemid].on
catchinfo.fail = ballcatch[item.itemid].off
catchinfo.newid = ballcatch[item.itemid].ball
catchinfo.name = doCorrectPokemonName(name)
catchinfo.topos = topos
catchinfo.chance = x.chance
doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
doRemoveItem(item.uid, 1)
local d = getDistanceBetween(getThingPos(cid), topos)
addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false)
addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
return true
end
Após as linhas:
if getItemAttribute(item2.uid, "catching") == 1 then
return true
end
Adicione abaixo:
if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
return
doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")
end
Resultando em (no caso, script configurado para o meu servidor):
local ballcatch = {
[2394] = {cr = 10, on = 24, off = 23, ball = 11826, send = 47},
[2391] = {cr = 20, on = 198, off = 197, ball = 11832, send = 48},
[2393] = {cr = 25, on = 202, off = 201, ball = 11835, send = 46},
[2392] = {cr = 15, on = 200, off = 199, ball = 11829, send = 49},
[556] = {cr = 0, on = 187, off = 176, ball = 554, send = 45},
}
function onUse(cid, item, frompos, item3, topos)
local item2 = getTopCorpse(topos)
if item2 == null then
return true
end
if getItemAttribute(item2.uid, "catching") == 1 then
return true
end
if getItemAttribute(item2.uid, "golden") and getItemAttribute(item2.uid, "golden") == 1 then
return
doPlayerSendCancel(cid, "You can't try to catch a pokemon in the Golden Arena!")
end
local name = string.lower(getItemNameById(item2.itemid))
name = string.gsub(name, "fainted ", "")
name = string.gsub(name, "defeated ", "")
local x = pokecatches[doCorrectPokemonName(name)]
if not x then
return true
end
local owner = getItemAttribute(item2.uid, "corpseowner")
if owner and isCreature(owner) and isPlayer(owner) and cid ~= owner and isInArray({1,9}, getPlayerGroupId(cid)) then
doPlayerSendCancel(cid, "You are not allowed to catch this pokemon.")
return true
end
local catchinfo = {}
catchinfo.rate = ballcatch[item.itemid].cr
catchinfo.catch = ballcatch[item.itemid].on
catchinfo.fail = ballcatch[item.itemid].off
catchinfo.newid = ballcatch[item.itemid].ball
catchinfo.name = doCorrectPokemonName(name)
catchinfo.topos = topos
catchinfo.chance = x.chance
doSendDistanceShoot(getThingPos(cid), topos, ballcatch[item.itemid].send)
doRemoveItem(item.uid, 1)
local d = getDistanceBetween(getThingPos(cid), topos)
addEvent(doSendPokeBall, d * 70 + 100 - (d * 14) , cid, catchinfo, false, false)
addEvent(doSendMagicEffect, (d * 70 + 100 - (d * 14)) - 100, topos, 3)
return true
end
Agora abra a pasta data/actions e abra o arquivo actions.xml (abra como editar/bloco de notas).
Adicione as tags:
<!-- Golden Arena -->
<action actionid="65535" event="script" value="Quadro_Golden.lua"/>
<action actionid="55356" event="script" value="Quadro_Golden_Rank.lua"/>
<action itemid="6527" event="script" value="Meowth Coin.lua"/>
Em vermelho são os ID dos quadros da Golden Island, utilizado para ver a lista de participantes do próximo evento, o horário e o rank de waves (rounds).
Em azul é o ID do Meowth Coin utilizado para se registrar ao evento.
GlobalEvents
Abra a pasta data/globalevents/scripts e crie/copie qualquer arquivo .lua e renomeie para Golden Arena.lua
Dentro do arquivo, apague tudo e adicione:
function onTimer(cid, interval, lastExecution)
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, 480000)
addEvent(doBroadcastMessage, 600000, "The Golden Arena are started!")
addEvent(doWave, 600000)
return true
end
Em azul são as mensagens antes de começar o evento e quando começar o evento.
Novamente na mesma pasta (data/globalevents/scripts) crie/copie qualquer arquivo .lua e renomeie para CleanGoldenArena.lua
Dentro do arquivo, apague tudo e adicione:
function onTimer(cid, interval, lastExecution)
positionsArray = returnPositions(GoldenUpper, GoldenLower)
killMonsterFromArea(positionsArray)
return true
end
Agora abra a pasta data/globalevents e abra o arquivo globalevents.xml (abra como editar/bloco de notas).
Adicione as tags:
<globalevent name="GoldenArena" time=" 2:50 ; 7:50 ;11:50;16:5 0;21:50" event="script" value="Golden Arena.lua" />
<globalevent name="CleanGoldenArena" time=" 4:30 ; 9:30 ;13:30;18:3 0;23:30" even t="script" value="CleanGoldenArena.lua"/>
Em vermelho são os horários da Golden Survival Arena, porém eles tem que ser configurados 10 minutos antes de começar o evento, por causa das mensagens que informam quando irá começar. Sendo assim o evento for começar por exemplo as 14:00, terá de estar configurado time="13:50".
Em azul são os horários dos cleans da Golden Survival Arena, porém eles tem que ser configurados 02:30 (2 horas e 30 minutos) após o evento ter começado. Sendo assim se o evento começar as 14:00 e as mensagens estiverem configuradas para 13:50, o evento irá começar somente as 14:00, portanto o Clean da Arena teria que estar configurado time="16:30" (14:00+02:30=16:30).
Items
Agora abra a pasta data/items e abra o arquivo items.xml (abra como editar/bloco de notas).
Procure pelo ID 6527 (CTRL+F) e subistitua a tag dele por esta:
<item id="6527" article="a" name="Meowth Coin" plural="Meowth Coins">
<attribute key="description" value="A coin needed to register to the Golden Arena!"/>
</item>
Lib
Agora abra a pasta data/lib e crie/copie qualquer arquivo .lua e renomeie para Golden Arena.lua
Dentro do arquivo, apague tudo e adicione:
--[[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()
if getGlobalStorageValue(22550) >= 1 then
local wave = getGlobalStorageValue(22547) <= 0 and 1 or getGlobalStorageValue(22547)
local players = creaturesInGolden(GoldenUpper, GoldenLower, true)
for i = 1, #posisGolden do
if wavesGolden[wave] ~= "" then
local monster = doSummonCreature(wavesGolden[wave], posisGolden)
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)
if isCreature(sid) then
doTeleportThing(sid, getClosestFreeTile(sid, posGolden))
doSendMagicEffect(getThingPos(sid), 21)
if #getCreatureSummons(sid) >= 1 then
doTeleportThing(getCreatureSummons(sid)[1], getClosestFreeTile(getCreatureSummons(sid)[1], posGolden))
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)
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
------------------------------------------------------------------------------------------------------------------
Agora novamente na pasta data/lib, abra o arquivo configuration.lua
Nele, dessa a barra até o fim do script/arquivo e então após o } do sistema anterior, pule uma linha e adicione:
------------- Configuraçoes da Golden Arena -----------------------------------
timeToWaves = 30 --
---------
GoldenUpper = {x=1212, y=1113, z=6}
GoldenLower = {x=1240, y=1123, z=6}
---------
posGolden = {x=1227, y=1118, z=6}
posBackGolden = {x=1231, y=1113, z=7}
---------
horas = {"3:00", "8:00", "12:00", "17:00", "22:00"}
--
--------
posisGolden = {
{x=1220, y=1115, z=6},
{x=1227, y=1118, z=6},
{x=1233, y=1115, z=6},
{x=1220, y=1121, z=6},
{x=1233, y=1121, z=6},
{x=1220, y=1118, z=6},
{x=1233, y=1118, z=6},
{x=1227, y=1115, z=6},
{x=1227, y=1121, z=6},
}
----------
wavesGolden = {
[ 1 ] = {"Raticate", "Pikachu", "Tauros", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 2 ] = {"Raticate", "Pikachu", "Tauros", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 3 ] = {"Raticate", "Pikachu", "Tauros", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 4 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 5 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 6 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 7 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 8 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 9 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 10 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 1 1 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 12 ] = {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 1 3 ] = {"", "Shiny Blastoise", "", "", "", "", "Shiny Venusaur", "", "Shiny Charizard"},
[ 14]= {"Raticate", "Ekans", "Arbok", "Koffing", "Ponyta", "Bulbasaur", "Charmander", "Squirtle", "Pidgeotto"},
[ 1 5] = {"", "Shiny Gyarados", "", "", "", "", "", "", ""},
}
Em vermelho é a posição x y z da ponta superior da Golden Survival Arena e em azul é a posição da ponta inferior da mesma.
Em verde é a posição x y z para onde os players registrados no evento seram teleportados quando ele começar.
Em laranja é a posição x y z para onde os players no evento seram teleportados ao morrerem na Arena ou quando ela acabar.
Em verde água é a posição x y z que os pokémons da parte em marrom seram teleportados. Como pode ver são 9 posições e 9 pokémons, apenas escolha as 9 diferentes posições da Arena que os pokémons iram aparecer, e sempre o número de posições terá de ser o mesmo número de pokémons; mesmo que ali esteja por exemplo apenas um pokémon que ira aparecer na wave {"", "Shiny Gyarados", "", "", "", "", "", "", ""}, as "" (aspas) são a mesma quantidade de posições.
Em rosa são os horários em que a Golden Survival Arena irá iniciar executando a função de trazer todos os players registrados a posição escolhida. Diferente dos horários da globalevents.xml que são 10 minutos antes por serem horários das mensagens antes que o evento comece, estes horários são os que ela ira iniciar; portanto devem ser exatos, horas de inicialização.
Em roxo é o número de waves (rounds) da Arena.
Em salmão é o tempo em segundos para cada wave (round).
Monster
Agora abra a pasta data/monster e escolha uma pasta/local para criar os arquivos .xml
Após ter escolhido o local, crie/copie qualquer arquivo .xml e renomeie para aHunter.xml
Dentro do arquivo, apague tudo e adicione:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Meowth Hunter" nameDescription="a Meowth Hunter" race="normal" experience="0" speed="180" manacost="0">
<health now="1500" max="1500"/>
<look type="1015" head="114" body="119" legs="114" feet="114" corpse="12588"/>
<targetchange interval="1000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="0"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="97"/>
<flag runonhealth="0"/>
</flags>
<attacks>
</attacks>
<defenses armor="0" defense="0">
</defenses>
<loot>
<item id="6527" chance="33333" count="1" countmax="1"/>
<item id="2152" chance="100000" countmax="5"/>
</loot>
<script>
<event name="Spawn"/>
</script>
</monster>
O Meowth Hunter é o monster que dropa meowth coins.
Novamente após ter escolhido o local, crie/copie qualquer arquivo .xml e renomeie para aHunterFemale.xml
Dentro do arquivo, apague tudo e adicione:
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Meowth Hunter" nameDescription="a Meowth Hunter" race="normal" experience="0" speed="180" manacost="0">
<health now="1500" max="1500"/>
<look type="1016" head="114" body="119" legs="114" feet="114" corpse="12589"/>
<targetchange interval="1000" chance="0"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="1"/>
<flag attackable="1"/>
<flag hostile="0"/>
<flag illusionable="1"/>
<flag convinceable="1"/>
<flag pushable="0"/>
<flag canpushitems="0"/>
<flag canpushcreatures="0"/>
<flag targetdistance="1"/>
<flag staticattack="97"/>
<flag runonhealth="0"/>
</flags>
<attacks>
</attacks>
<defenses armor="0" defense="0">
</defenses>
<loot>
<item id="6527" chance="33333" count="1" countmax="1"/>
<item id="2152" chance="100000" countmax="5"/>
</loot>
<script>
<event name="Spawn"/>
</script>
</monster>
Em vermelho é o mesmo que o anterior, só que outfit female para ficar como no script do npc da Golden Island.
Agora abra a pasta data/monster e abra o arquivo monsters.xml (abra como editar/bloco de notas).
Adicione as tags:
<monster name="aHunter" file="pokes/System/aHunter.xml"/>
<monster name="aHunterFemale" file="pokes/System/aHunterFemale.xml"/>
Em azul é a localização dos Meowth Hunter's, nesse tipo eu coloquei o aHunter.xml e aHunterFemale.xml na pasta data/monster/pokes/System, porém não precisei colocar a parte de data/monster, apenas o que está dentro da pokes em diante (pokes/System/.xml). Se você por exemplo coloca-se o aHunter.xml e aHunterFemale.xml na pasta data/monster/meowthmonster, as tags seriam:
<monster name="aHunter" file="meowthmonster/aHunter.xml"/>
<monster name="aHunterFemale" file="meowthmonster/aHunterFemale.xml"/>
Npc
Abra a pasta data/npc/scripts e crie/copie qualquer arquivo .lua e renomeie para .aHunter.lua
Dentro do arquivo, apague tudo e adicione:
local target = 0
local prevTarget = 0
local origPos = 0
local max_distance = 15
local fighting = false
local challenger = 0
local battle_turn = 1 -- don't change
local challenger_turn = 0 -- don't change
---
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function doSummonGymPokemon(npc)
local this = npc
if not isCreature(this) or not ehNPC(this) then
return true
end
if #getCreatureSummons(this) >= 1 or target == 0 then return true end
local it = wildHunter[getPlayerStorageValue(this, 665471)][battle_turn]
if not it then return true end
doSummonMonster(this, it.name)
local summon = getCreatureSummons(this)[1]
if not summon then
print("Error in npc: "..getCreatureName(this)..", tring to execute function 'doSummonGymPokemon', poke: "..it.name)
battle_turn = battle_turn+1
return true
end
local balleffect = pokeballs["normal"].effect
if it.ball and pokeballs[it.ball] then
balleffect = pokeballs[it.ball].effect
end
doSendMagicEffect(getThingPos(summon), balleffect)
setPlayerStorageValue(summon, 10000, balleffect)
setPlayerStorageValue(summon, 10001, gobackmsgs[math.random(#gobackmsgs)].back:gsub("doka", it.nick ~= "" and it.nick or it.name))
setPlayerStorageValue(summon, 1007, it.nick ~= "" and it.nick or it.name)
doSetMonsterGym(summon, target)
local name = it.nick ~= "" and it.nick or getCreatureName(this).."s "..it.name
setWildPokemonLevel(summon, it.optionalLevel, getPokemonStatus(it.name, it.optionalLevel), name, 1.5)
doCreatureSay(this, gobackmsgs[math.random(#gobackmsgs)].go:gsub("doka", getPlayerStorageValue(summon, 1007)), 1)
fighting = true
battle_turn = battle_turn + 1
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function goToOrigPos()
target = 0
selfFollow(0)
fighting = false
challenger = 0
challenger_turn = 0
if #getCreatureSummons(getNpcCid()) >= 1 then
setPlayerStorageValue(getCreatureSummons(getNpcCid())[1], 1006, 0)
doCreatureAddHealth(getCreatureSummons(getNpcCid())[1], -getCreatureMaxHealth(getCreatureSummons(getNpcCid())[1]))
end
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
doTeleportThing(getNpcCid(), origPos)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
local function updateTarget()
if(target == 0) then
local list = getSpectators(getNpcPos(), 9, 9, false)
for i = 1, table.getn(list) do
local _target = list
if(_target ~= 0) then
if(isPlayer(_target) == TRUE) then
selfSay(hunterTalks[math.random(#hunterTalks)])
doNpcSetCreatureFocus(_target)
target = _target
prevTarget = target
break
end
end
end
end
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onCreatureAppear(cid)
end
function onCreatureDisappear(cid)
end
function onCreatureMove(creature, oldPos, newPos)
end
--/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////--
function onThink()
if not isCreature(getNpcCid()) then
return false
end
if origPos == 0 then
origPos = getNpcPos()
end
------------------------------------------------------
if getPlayerStorageValue(getNpcCid(), 665471) <= 0 then
setPlayerStorageValue(getNpcCid(), 665471, math.random(1, 5))
randOutfit(getNpcCid())
end
updateTarget()
------------------------------------------------------
if getDistanceBetween(getNpcPos(), origPos) >= max_distance then
goToOrigPos()
end
------------------------------------------------------
if(target == 0) then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
return true
end
------------------------------------------------------
local playerPos = getThingPosWithDebug(target)
local myPos = getNpcPos()
------------------------------------------------------
if(myPos.z ~= playerPos.z) then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) > max_distance then
goToOrigPos()
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) >= 5 then
if getPlayerStorageValue(getNpcCid(), 154788) >= 1 then
setPlayerStorageValue(getNpcCid(), 154788, -1)
doRegainSpeed(getNpcCid())
if isCreature(target) then
selfFollow(target)
end
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 3 then
if getPlayerStorageValue(getNpcCid(), 154788) <= 0 then
setPlayerStorageValue(getNpcCid(), 154788, 1)
doChangeSpeed(getNpcCid(), -getCreatureSpeed(getNpcCid()))
addEvent(randWalk, 2000, getNpcCid(), 1000, getPlayerStorageValue(getNpcCid(), 154788))
end
end
------------------------------------------------------
if getDistanceBetween(playerPos, myPos) <= 5 then
challenger = target
addEvent(doSummonGymPokemon, 850, getNpcCid())
---
local change = false
if not isCreature(target) then
target = 0
battle_turn = battle_turn == 1 and battle_turn or battle_turn-1
return true
end
if fighting then
if not isCreature(getCreatureTarget(getNpcCid())) then
if #getCreatureSummons(challenger) >= 1 then
selfAttackCreature(getCreatureSummons(challenger)[1])
change = true
else
if change then
change = false
challenger_turn = challenger_turn + 1
end
end
end
if #getCreatureSummons(getNpcCid()) == 0 and isCreature(target) then
if battle_turn > #wildHunter[getPlayerStorageValue(getNpcCid(), 665471)] then
addEvent(doCreateNpc, 300000, ".aHunter", myPos)
local outfit = getCreatureOutfit(getNpcCid())
doRemoveCreature(getNpcCid())
----------------------------------------
if outfit.lookType == 1016 then
monster = doCreateMonster("aHunterFemale", myPos)
else
monster = doCreateMonster("aHunter", myPos)
end
----------------------------------------
doCloneOut(monster, outfit)
addEvent(beDrunk, 100, monster)
end
addEvent(doSummonGymPokemon, 1000, getNpcCid())
end
if #getCreatureSummons(challenger) <= 0 then
selfAttackCreature(challenger)
end
end
end
end
Agora vá a pasta data/npc e crie/copie qualquer arquivo .xml e renomeie para .aHunter.xml
Dentro do arquivo, apague tudo e adicione:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Hunter" script=".aHunter.lua" walkinterval="0" floorchange="0" access="5" level="100" maglevel="1">
<health now="1500" max="1500"/>
<look type="1015" head="114" body="119" legs="114" feet="114" corpse="3058"/>
<parameters>
</parameters>
</npc>
O npc Hunter identifica o sexo do player e cria um Meowth Hunter do mesmo sexo que o player para lutarem. Lembrando que este monster dropa Meowth Coins.
Abra a pasta data/npc/scripts e crie/copie qualquer arquivo .lua e renomeie para .aMeowthDealer.lua
Dentro do arquivo, apague tudo e adicione:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function doBuyPokemonWithCasinoCoins(cid, poke) npcHandler:onSellpokemon(cid) end
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'meowth coin') or msgcontains(msg, 'Meowth Coin') then
selfSay("I have a good offer for you, 2 meowth coins for 2 diamonds, what do you think?", cid)
talkState[cid] = 1
elseif msgcontains(msg, 'yes') or msgcontains(msg, 'Yes') and talkState[cid] == 1 then
if doPlayerRemoveItem(cid, 2145, 2) then
selfSay("So there is it! Good luck at the event!", cid)
doPlayerAddItem(cid, 6527, 2)
talkState[cid] = 0
return true
else
selfSay("You don't have enough diamonds!", cid)
talkState[cid] = 0
return true
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Em vermelho são os 2 diamonds sendo removidos e em azul os 2 Meowth Coins sendo adicionados ao player.
Agora vá a pasta data/npc e crie/copie qualquer arquivo .xml e renomeie para aMeowth Dealer.xml
Dentro do arquivo, apague tudo e adicione:
<?xml version="1.0" encoding="UTF-8"?>
<npc name=" Meowth Dealer " script="aMeowthDealer.lua" walkinterval="0" floor change="0" access="5" level="1" maglevel="1">
<health now="150" max="150"/>
<look type="1015" head="114" body="119" legs="114" feet="114" corpse="0"/>
<parameters>
<parameter key="message_greet" value="Hello survivalist! If you want MEOWTH COINS, you're in the right place!"/>
</parameters>
</npc>
Em laranja é o NPC que troca 2 diamonds por 2 Meowth Coins, utilizados para se registrar a Golden Survival Arena.
Após concluir tudo isto, a Golden Survival System estará completamente instalada em seu servidor.
Créditos
Slicer pelo script 90%.
PokeXGames por direitos autorais.
Eu pelo tutorial e 10% do script editado.
Creio que esse seja o primeiro System Tutorial de instalação completa da Golden Survival Arena.
Obrigado.