antiblock
diamwall
  • Chatbox

    You don't have permission to chat.
    Load More
Sign in to follow this  
Criteriongames

[Quest Da Arena Pvp]

2 posts in this topic

antiblock
Cyphriun
quest arena_manager begin
        state start begin
                when 20017.chat."Combate de Treino" begin
                        if game.get_event_flag("arena_close") > 0 then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("A arena foi destruída devido a uma")
                                say("terrível batalha.")
                                say("")
                                return
                        end
 
                        if not npc.lock() then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Alguém se inscreveu para o combate de treino.")
                                say("")
                                say("")
                                return
                        end
 
                        local useMinLevel = game.get_event_flag("arena_use_min_level")
 
                        if useMinLevel == 0 then
                                useMinLevel = 25 ;
                        end
 
                        if pc.get_level() < useMinLevel then
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Ainda não és do nível "..useMinLevel..";")
                                say("não podes entrar num combate ")
                                say("")
                                npc.unlock()
                                return
                        else
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Por favor, escolhe o nome do teu adversário ")
                                say("para o combate de treino.")
                                say("")
                                say("")
 
                                local sname = input()
 
                                if sname == "" then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Não sabes com quem queres lutar?")
                                say("")
                                        npc.unlock()
                                        return
                                else
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say(pc.name.." pediu um combate de treino")
                                say("com "..sname..".")
                                wait("")
 
                                        local opp_vid = find_pc_by_name(sname)
 
                                        if opp_vid == 0 then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say(sname.." não está disponível.")
                                say("")
                                                npc.unlock()
                                                return
                                        elseif opp_vid == pc.get_vid() then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Tens a certeza, queres lutar contigo?")
                                say("")
                                say("")
                                                npc.unlock()
                                                return
                                        end
 
                                        local old = pc.select(opp_vid)
                                        local opp_level = pc.get_level()
                                        pc.select(old)
 
                                        if opp_level < useMinLevel then
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("O nível do teu adversário é menor que "..useMinLevel..".")
                                say("")
                                                npc.unlock()
                                                return
                                        end
                                        if not npc.is_near_vid(opp_vid, 10) then
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Para começar o combate ")
                                say(sname.." tem de se aproximar.")
                                say("")
                                                npc.unlock()
                                                return ;
                                        end
 
                                        local a = arena.is_in_arena(opp_vid)
                                        if a == 0 then
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say(sname.." está neste momento em um combate.")
                                say("")
                                                npc.unlock()
                                                return ;
                                        end
                                say_title("Decisão")
                                say("")
                                say(pc.name.." aguarda "..sname.." para")
                                say("aceitar o combate.")
                                        local agree = confirm(opp_vid, sname.." queres combater com "..pc.name.."", 30)
                                        if agree!= CONFIRM_OK then
                                say_title("Yuhwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say(sname.." não quer lutar contigo.")
                                say("")
                                                npc.unlock()
                                                return
                                        end
 
                                        s = arena.start_duel(sname, 3)
 
                                        if s == 0 then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("Houve um problema.")
                                say("Queres combater mais tarde?")
                                say("")
                                        elseif s == 2 then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("As arenas estão cheias, volta mais tarde.")
                                say("")
                                        elseif s == 3 then
                                say_title("Yu-Hwan:")
                                say("")
                                ----"12345678901234567890123456789012345678901234567890"|
                                say("A Arena de Duelos está neste momento em uso.")
                                say("Tenta novamente mais tarde.")
                                say("")
                                        end
                                end
                        end
                        npc.unlock()
                end
 
                when 20017.chat."Ver um combate de treino" begin
                        local g = arena.get_duel_list()
                        local arena_name = {}
                        local arena_observer = {}
 
                        table.foreachi(g,
                                function(n, p)
                                        arena_name[n] = p[1].." contra "..p[2]
                                        arena_observer[n] = { p[3], p[4], p[5] }
                                end
                        )
 
                        table.insert(arena_name, "Fechar")
                        table.insert(arena_observer, 0)
 
                        local count = table.getn(g)
                        if count == 0 then
                        say_title("Yu-Hwan:")
                        say("")
                        ----"12345678901234567890123456789012345678901234567890"|
                        say("Não há neste momento nenhum combate.")
                        say("")
                        return ;
                        else
                        say_title("Yu-Hwan:")
                        say("")
                        ----"12345678901234567890123456789012345678901234567890"|
                        say("Neste momento há "..count.." combates de treino.")
                        say("")
                        wait()
                        end
 
                        if table.getn(g)!= 0 then
                                local s = select_table(arena_name)
 
                                if table.getn(arena_observer) == s then
                                        return ;
                                end
 
                                if table.getn(arena_observer) >= s then
                                        arena.add_observer(arena_observer[1], arena_observer[2], arena_observer[3])
                                end
                        end
                end
        end
end

Share this post


Link to post
Share on other sites
Sign in to follow this