Jump to content

Daily Quest Based On Level


Go to solution Solved by Doose,

Recommended Posts

Hello, I was trying to make a daily quest based on the character's level. I found one here, except that when I want the quest to show when you have level 30-40 it shows up even at max level.  I tried to make it so it only shows up to level 30, but it still shows up at any level. What can I do?

Spoiler

quest Daily_quest begin
    state start begin
        when login or levelup with pc.level <=30  begin
            if pc.getqf("daily_quest") <= get_time() then
                set_state(information)
            elseif pc.getqf("daily_quest") == 0 then
                set_state(information)
            end
        end
    end
    
    state information begin
        when letter begin
            -- Select the NPC who gives the task
            local npc = find_npc_by_vnum(20359)
            if npc != 0 then
                target.vid("__TARGET__", npc, "Piece of Gem Quest!")
            end
        end
        
        when letter begin
            send_letter("Daily Quest #1")
        end
        
        when button or info begin
            say_title("Piece of Gem Quest!")
            say("")        
            say("The pharmacist is looking for you")
            say("and I think he needs your help.")
            say("If you're interested, you can find him")
            say("on the small map!")
            say("")
        end
        
        when __TARGET__.target.click or 20359.chat."Piece of Gem Quest!" begin
            target.delete("__TARGET__")
            say("Welcome, adventurer!")
            say("")
            say("It's great to see you here!")
            say("We don't know each other very well,")
            say("but I need something from you.")
            say("I need 20 Piece of Gems.")
            
            say("")
            wait()
            say("")
            say("Our heroic soldier is dying, and only")
            say("Piece of Gems can help him.")
            say("If you complete the quest, your reward is:")
            say("Exactly......")
            say("60,000,000 EXP. & Dragon Bone Earrings")
            say("")
            wait("")
            say("")
            say("I believe the reward is significant for you,")
            say("and I don't think I need to explain more!")
            say("")
            say("Will you accept the quest?")
            say("")
            local choice = select("Yes", "No")
            if choice == 1 then
                say("Ultimately, I need 20 of these items!")
                say("")
                say_item_vnum(30021)
                say("")
                set_state(action)
            else
                say("I'm sorry, I think someone else can help!")
                say("")
                return
            end
        end
    end
    
    state action begin
        when 503.kill begin
            local chance = number(1, 200)
            if chance <= 2 and pc.count_item(30021) < 20 then
                pc.give_item2(30021)
            end
        end
        
        when letter begin
            send_letter("Piece of Gem Quest!")
        end
        
        when button or info begin
            say_title("Piece of Gem Quest!")
            say("")
            say("The pharmacist gave you a task")
            say("and the task is to find 20 Piece of Gems.")
            say("Let's get to work!")
            say("")
            say_item_vnum(30021)
            say("")
        end
        
        when 20359.chat."Piece of Gem Quest!" begin
            if pc.count_item(30021) >= 20 then
                say("Thank you, brave warrior!")
                say("Here's the reward I promised:")
                say("60,000,000 EXP!")
                say("")
                pc.remove_item(30021, 20)
                pc.give_exp2(60000000)
                pc.give_item2(72704, 1)
                clear_letter()
                if pc.is_gm() then
                    pc.setqf("daily_quest", get_time() + 10)
                else
                    pc.setqf("daily_quest", get_time() + 24 * 60 * 60)
                end
                restart_quest()
            else
                say("Hurry, time is running out!!")
                say("You know what to look for:")
                say_item_vnum(30021)
                say("")
                return
            end
        end
    end
end

 

Link to comment
Share on other sites

I think I did that. I tried this thing earlier but for some reason if I set a character's level (not GM) to a level that is not 30-40 it does not show up, which is what I wanted. But then, if I set the level 30-40, then 40+ it still shows up. But then... I tried on GM account. In the end, I believe you just have to do the mission even you are higher than level 40 then it will not show up anymore regarding if you are level 41 or higher after completion.

Spoiler

        when login or levelup with pc.level >=30 and pc.level <=40 begin
 

I thought you can skip the mission if you ignore it and after you would have leveled up to 41 it would have disappeard by itself.

Does that make sense? Anyway, thanks for replying.

Link to comment
Share on other sites

  • Active+ Member

You can do it like that.

Let's say you have a quest that starts with "when login or levelup with level >=35 and level <= 40" 

The reason the quest does not disappear is that the state is initiated when you level up between 35 & 40

Even after you get to level 50 let's say, you still have that state active.

To delete a quest when your level is higher than 40, you need to call the COMPLETE state func.

something like this:

is pc.get_level >40 then

Add here state quest completion funcs

end

 

 

  • Good 1

spacer.png

Link to comment
Share on other sites

3 hours ago, UrsuPolar said:

I thought you can skip the mission if you ignore it and after you would have leveled up to 41 it would have disappeard by itself.

Solution:

Find:

state information begin

Add below:

when login or levelup with not (pc.level >=30 and pc.level <=40) begin
	clear_letter()
	restart_quest()
end

 

Edited by caanmasu
  • Good 1
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.