LuizFernando Posted January 30, 2018 at 12:26 AM Share Posted January 30, 2018 at 12:26 AM Boas Pessoal, Tenho uma guerra das metins que são duas parte. Porém tenho aqui uma parte que gostaria de modificar algumas coisas e não entendo muito de lua, alguém poderia me ajudar? Ao terminar o evento esperar 30 segundos e anunciar o vencedor da guerra. Gostaria de mudar ao terminar a guerra, o reino vencedor receber bonus de exp automaticamente e anuncia que ele foi o reino vencedor. Gostaria também ao terminar a guerra, não recebe boss como recompensa como está na quest e desaitvar os anuncios de que o reino foi eliminado após terminar a guerra. Quem puder ajudar fico feliz! quest destroy begin state start begin when login with pc.get_map_index() == 103 begin table.insert(warMetinPlayers, {pc.getempire(), pc.get_vid()}) end when kill with not npc.is_pc() and pc.get_map_index() == 103 begin local stones = { 8020, 8021, 8022 } local killedStone = 0 for i = 1, 3 do if npc.get_race() == stones then killedStone = stones break end end if killedStone > 0 then local killedCount = game.get_event_flag("defend_and_destroy_killed_count") + 1 local reinos = { [8020] = "Shinsu", [8021] = "Jinno", [8022] = "Chunjo" } if game.get_event_flag("defend_and_destroy_"..killedStone) > 0 then notice_all("A Pedra Metin do Reino "..reinos[killedStone].." foi destruída!") notice_all("O Reino "..reinos[killedStone].." foi eliminado da Guerra das Metins!") game.set_event_flag("defend_and_destroy_killed_count", killedCount) destroy.empireToVillage(game.get_event_flag("defend_and_destroy_"..killedStone)) if killedCount == 2 then notice_all("Parabéns ao Reino Vencedor!") warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy", 0 ) local mobsToSpawn = { --mobID, pos_localX, pos_LocalY, quant { 2493, 384, 383, 1}, -- Dragão { 2092, 408, 407, 1}, -- Aranha Rei { 2092, 360, 361, 1}, -- Aranha Rei { 11506, 362, 383, 1}, { 11506, 383, 403, 1}, { 11506, 404, 383, 1}, { 11506, 383, 362, 1}, } for ix = 1, table.getn(mobsToSpawn) do mob.spawn(mobsToSpawn[ix][1], mobsToSpawn[ix][2], mobsToSpawn[ix][3], mobsToSpawn[ix][4]) end end end end end function empireToVillage(empire) local villageInfo = { {469300, 964200}, {55700, 157900}, {969600, 278400} } local i = 1 while i <= table.getn(warMetinPlayers) do if warMetinPlayers[1] == empire then local oldVid = pc.select(warMetinPlayers[2]) pc.warp(villageInfo[empire][1], villageInfo[empire][2]) pc.select(oldVid) table.remove(warMetinPlayers, i) else i = i + 1 end end end end end Link to comment Share on other sites More sharing options...
Mário. Posted January 30, 2018 at 02:22 AM Share Posted January 30, 2018 at 02:22 AM (edited) quest destroy begin state start begin when login with pc.get_map_index() == 103 begin table.insert(warMetinPlayers, {pc.getempire(), pc.get_vid()}) end when kill with not npc.is_pc() and pc.get_map_index() == 103 begin local stones = { 8020, 8021, 8022 } local killedStone = 0 for i = 1, 3 do if npc.get_race() == stones then killedStone = stones break end end if killedStone > 0 then local killedCount = game.get_event_flag("defend_and_destroy_killed_count") + 1 local reinos = { [8020] = "Shinsu", [8021] = "Jinno", [8022] = "Chunjo" } local empire = { [1] = "Shinsu", [2] = "Jinno", [3] = "Chunjo" } if game.get_event_flag("defend_and_destroy_"..killedStone) > 0 then notice_all("A Pedra Metin do Reino "..reinos[killedStone].." foi destruída!") -- 02: É removido/comentado -- notice_all("O Reino "..reinos[killedStone].." foi eliminado da Guerra das Metins!") game.set_event_flag("defend_and_destroy_killed_count", killedCount) destroy.empireToVillage(game.get_event_flag("defend_and_destroy_"..killedStone)) if killedCount == 2 then -- 01: Basicamente a pessoa que partir a pedra de um outro reino, será a do reino vencedor. notice_all("O Reino "..empire[pc.get_empire()[1]].." é o vencedor da guerra das metins.") warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy", 0 ) __give_empire_priv(empire[1], 4, 50, 60*60*24) -- EXP durante 24 horas -- 02: É removido/comentado -- local mobsToSpawn = -- { -- mobID, pos_localX, pos_LocalY, quant -- { 2493, 384, 383, 1}, -- Dragão -- { 2092, 408, 407, 1}, -- Aranha Rei -- { 2092, 360, 361, 1}, -- Aranha Rei -- { 11506, 362, 383, 1}, -- { 11506, 383, 403, 1}, -- { 11506, 404, 383, 1}, -- { 11506, 383, 362, 1}, -- } -- for ix = 1, table.getn(mobsToSpawn) do -- mob.spawn(mobsToSpawn[ix][1], mobsToSpawn[ix][2], mobsToSpawn[ix][3], mobsToSpawn[ix][4]) -- end end end end end function empireToVillage(empire) local villageInfo = { {469300, 964200}, {55700, 157900}, {969600, 278400} } local i = 1 while i <= table.getn(warMetinPlayers) do if warMetinPlayers[1] == empire then local oldVid = pc.select(warMetinPlayers[2]) pc.warp(villageInfo[empire][1], villageInfo[empire][2]) pc.select(oldVid) table.remove(warMetinPlayers, i) else i = i + 1 end end end end end Nada testado. EDIT: As partes que editei estão fucked up porque o texto não veio formatado. Edited January 30, 2018 at 02:24 AM by Mário. Link to comment Share on other sites More sharing options...
LuizFernando Posted January 30, 2018 at 12:07 PM Author Share Posted January 30, 2018 at 12:07 PM Olha essa outra quest aqui, você consegue me ajudar colocar quando a metin do reino for destruida o reino for eliminado? quest destroy begin state start begin when 8020.kill with pc.get_map_index()== 103 begin if game.get_event_flag("defend_and_destroy_red") == 1 and npc.race == 8020 then notice_all("A Pedra Metin do Reino Shinsu foi destruida!") notice_all("O Reino Shinsu falhou em defender sua Pedra Metin!") game.set_event_flag("defend_and_destroy_red", 0 ) timer("yellow", 10) timer("blue", 10) else end end when 8022.kill with pc.get_map_index()== 103 begin if game.get_event_flag("defend_and_destroy_yellow") == 1 and npc.race == 8022 then notice_all("A Pedra Metin do Reino Chunjo foi destruida!") notice_all("O Reino Chunjo falhou em defender sua Pedra Metin!") game.set_event_flag("defend_and_destroy_yellow", 0 ) timer("red", 10) timer("blue", 10) else end end when 8021.kill with pc.get_map_index()== 103 begin if game.get_event_flag("defend_and_destroy_blue") == 1 and npc.race == 8021 then notice_all("A Pedra Metin do Reino Jinno foi destruida!") notice_all("O Reino Jinno falhou em defender sua Pedra Metin!") game.set_event_flag("defend_and_destroy_blue", 0 ) timer("red", 10) timer("yellow", 10) else end end when blue.timer begin if game.get_event_flag("defend_and_destroy_red") > 0 and game.get_event_flag("defend_and_destroy_yellow") == 0 and game.get_event_flag("defend_and_destroy_blue") == 0 then notice_all("O Reino Shinsu venceu a Guerra das Metins!") __give_empire_priv(1, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_red", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when yellow.timer begin if game.get_event_flag("defend_and_destroy_red") > 0 and game.get_event_flag("defend_and_destroy_yellow") == 0 and game.get_event_flag("defend_and_destroy_blue") == 0 then notice_all("O Reino Shinsu venceu a Guerra das Metins!") __give_empire_priv(1, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_red", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when blue.timer begin if game.get_event_flag("defend_and_destroy_red") == 0 and game.get_event_flag("defend_and_destroy_yellow") > 0 and game.get_event_flag("defend_and_destroy_blue") == 0 then notice_all("O Reino Chunjo venceu a Guerra das Metins!") __give_empire_priv(2, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_yellow", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when red.timer begin if game.get_event_flag("defend_and_destroy_red") == 0 and game.get_event_flag("defend_and_destroy_yellow") > 0 and game.get_event_flag("defend_and_destroy_blue") == 0 then notice_all("O Reino Chunjo venceu a Guerra das Metins!") __give_empire_priv(2, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_yellow", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when yellow.timer begin if game.get_event_flag("defend_and_destroy_red") == 0 and game.get_event_flag("defend_and_destroy_yellow") == 0 and game.get_event_flag("defend_and_destroy_blue") > 0 then notice_all("O Reino Jinno venceu a Guerra das Metins!") __give_empire_priv(3, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_blue", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when red.timer begin if game.get_event_flag("defend_and_destroy_red") == 0 and game.get_event_flag("defend_and_destroy_yellow") == 0 and game.get_event_flag("defend_and_destroy_blue") > 0 then notice_all("O Reino Jinno venceu a Guerra das Metins!") __give_empire_priv(3, 4, 50, 60*60*24*3) warp_all_to_village(103, 10) -- em 10 segundos manda todos para vila. game.set_event_flag("defend_and_destroy_blue", 0 ) game.set_event_flag("defend_and_destroy", 0 ) else end end when login with not pc.is_gm() and pc.get_map_index() == 103 begin if game.get_event_flag("defend_and_destroy") == 0 then -- DESLIGADO warp_to_village() end -- if end -- when end -- state end -- quest Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now