Jump to content

Quest exchange items problem.


Recommended Posts

 

Hello, I created this quest so that when I pick up 10 items from the ground, I can exchange these 10 items for another one and remove the 10, but it only works when I log in to TP, it doesn't work directly when I pick up the 10 that I did wrong?

 

quest metins_quest begin
    state start begin
        when login with pc.level >= 1 begin
            local item_count = pc.count_item(501009)
            local exchange_count = math.floor(item_count / 10)
            if exchange_count > 0 then
                pc.remove_item(501009, exchange_count * 10) 
                pc.give_item2(501004, exchange_count) 
            end
        end

        when 501009.use or 501009.get begin
            local item_count = pc.count_item(501009)
            local exchange_count = math.floor(item_count / 10) 
            if exchange_count > 0 then
                pc.remove_item(501009, exchange_count * 10) 
                pc.give_item2(501004, exchange_count) 
            end
        end
    end
end
 

  • Love 1
Link to comment
Share on other sites

  • Premium

Because.. you are only executing this code on login.

.get

doesn't exist as a trigger.

 

Edited by Syreldar

 

"Nothing's free in this life.

Ignorant people have an obligation to make up for their ignorance by paying those who help them.

Either you got the brains or cash, if you lack both you're useless."

Syreldar

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.