Jump to content

Quest de verificação de itens


igoriap
 Share

Recommended Posts

Olá , gostaria de saber se alguem tem uma quest que assim: 

Tenho um mapa vip por exemplo e nele precisará um certo item, que por via , o item tera um tempo de duração.

O player so permanecerá no mapa com o item, se ele se desfazer ou acabar o tempo sera expulso do mapa.

Da mesma forma para entrar que será necessário o item para a entrada.

Link to comment
Share on other sites

Acho que é isso que queres:

quest vip begin
    state start begin
	    function isConfig()
        return {        
            ["map_index"] = 200, -- index do mapa.
            ["map_warp"]={["x"]=83200,["y"]=0}, -- warp de entrada no mapa.
            ["vip_item"] = 71095, -- item vip, necessário para continuar no mapa.
            ["loop_temp"] = 60, -- verificação em 1 minuto.
        }
    end    
    
    function isVip()
        if pc.countitem(vip.isConfig().vip_item) != 0 then
            return true
        end
        if pc.is_gm() then
            return true
        end
        return false
    end
    
    function isMapIndex()
        if pc.get_map_index() == vip.isConfig().map_index then
            return true
        end
        if pc.is_gm() then
            return false
        end
        return false
    end
    
    when 20095.chat."Mapa VIP" begin
        say_title(mob_name(npc.get_race())..":")
        say("")
        say("Olá, "..pc.get_name())
        say("Para entrar é necessário:")
        say_item_vnum(vip.isConfig().vip_item)
        say("")
        local s=select("Eu tenho","Não tenho")
            if s==2 then
                return
            end
	            if vip.isVip() == false then
                say("Você não tem o item: "..item_name(vip.isConfig().vip_item)..".")
                return
            end
        pc.warp(vip.isConfig().map_warp.x, vip.isConfig().map_warp.y)
    end
    
    when logout with vip.isMapIndex() == true begin
        cleartimer("check_vip")
    end
    
    when login with vip.isMapIndex() == true begin
        if vip.isVip() == false then
            warp_to_village()
            return
        end
        loop_timer("check_vip", vip.isConfig().loop_temp)
    end
    
    when check_vip.timer begin
        if vip.isVip() == false then
            cleartimer("check_vip")
            warp_to_village()
            return
        end
    end
    
    end
end

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...