Jump to content

Quest cooldown for dungeon


Go to solution Solved by Beforekk,

Recommended Posts

  • Premium

Hello,

I know only basics around quests. I tried some simple "dungeon" quest, which is working good, but now I want to implement a cooldown in it. 

I tried to figured it out myself, but without success. Can someone please help me with explanation? ❤️

Here's quest:

Spoiler

quest orcdung begin
    state start begin

        when 20356.chat."Král orků " with pc.get_level() >= 30 begin
            say_reward("Já: ")
            say("Hm... Chudák. Sbíral zde listí ")
            say("a orci ho napadli. ")
            say("Musím ho pomstít! ")
            say("")
            say("Nejprve potřebuji nějakou stopu! ")
            say_item_vnum(30160)
            local a= select("Mám! ","Nemám ")
        if 1==a then
            if party.is_party() then
                say_important("")
                say_important("Toto je solo dungeon, který můžeš projít ")
                say_important("pouze sám! Opusť prosím skupinu.")
            elseif not party.is_party() then
                if pc.count_item(30160) >= 1 then
                    say_reward("Já: ")
                    say("Našel jsem poznámky sběrače, ")
                    say("ve kterých zmiňuje, kde se ")
                    say("nachází samotný král orků! ")
                    say("")
                    pc.remove_item(30160)
                    wait()
                    d.join(306, 3495, 238)
                    d.regen_file("data/dungeon/orc/orc_regen.txt")
                else
                    say_reward("Já: ")
                    say("Nejprve musím najít nějaké ")
                    say("vodítko, abych mohl pokračovat... ")
                    say_item_vnum(30160)
                    return
                end
        if 2==a then
                say_reward("Já: ")
                say("")
                say("Tak jo... ")
                say("Kde začít hledat? ")
                end
            end
        end
    end

        when 8008.kill with pc.in_dungeon() begin
            d.regen_file("data/dungeon/orc/orc_regen1.txt")
            d.setf("mobs_left", d.count_monster())
            d.spawn_mob(638, 339, 250, 1)
        end


        when 638.kill with pc.in_dungeon() begin
            local count = d.getf("mobs_left")-1
            d.setf("mobs_left", count)
                if count <= 0 then
                    d.clear_regen()
                    syschat("Porazil si vlnu orků! ")
                    d.spawn_mob(8009, 339, 250, 1)
            end
        end

        when 8009.kill with pc.in_dungeon() begin
            d.spawn_mob(692, 339, 250, 1)
        end

        when 692.kill with pc.in_dungeon() begin
            d.spawn_mob(694, 339, 250, 1)
        end

        when 694.kill with pc.in_dungeon() begin
            syschat("Úspěšně si porazil krále orků a dokončil dungeon! ")
        end
    end
end

Like this, its working without any problem. Thank you in advance...

I always wanted to be a hero, but destiny given me a role of a villain throw my whole life

- Tenebris Viator

 

spacer.png

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Premium
  • Solution

Well, I figured it out myself, and it was easier, than I tought.

Here is how to make cooldown for dungeons:

First part is in NPC talk (When porting to dungeon)

Add this -  if pc.getqf("last_complete_time") and os.time() - pc.getqf("last_complete_time") < 60 then

 

Spoiler

quest orcdung begin
    state start begin

        when 20356.chat."Král orků " with pc.get_level() >= 30 begin
            if pc.getqf("last_complete_time") and os.time() - pc.getqf("last_complete_time") < 60 then 
                say("Musíš počkat, než budeš moci znovu vstoupit do dungeonu.") --- Here is text, to inform, that cooldown is active
                return
            end

--- Here continues the original quest

            say_reward("Já: ")
            say("Hm... Chudák. Sbíral zde listí ")
            say("a orci ho napadli. ")
            say("Musím ho pomstít! ")
            say("")
            say("Nejprve potřebuji nějakou stopu! ")
            say_item_vnum(30160)
            local a= select("Mám! ","Nemám ")
        if 1==a then

And now add to the end of the quest, where you kill boss

Add this - pc.setqf("last_complete_time", os.time())

 

Spoiler

        when 694.kill with pc.in_dungeon() begin
            syschat("Úspěšně si porazil krále orků a dokončil dungeon! ")
            pc.setqf("last_complete_time", os.time())
        end
    end
end

And... thats everything.

 

I always wanted to be a hero, but destiny given me a role of a villain throw my whole life

- Tenebris Viator

 

spacer.png

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.