Jump to content

Drop items from table but remove that item when someone droped


Recommended Posts

  • Contributor

I don't reccomend to open a text file every time and delete from it, we have eventflags for that.

quest m2dev begin
    state start begin
        when 101.kill begin
             if get_game.get_event_flag("drop1") == 0 and math.random(100) >= 50 then
                 game.drop_item_with_ownership(19, 1)
                 game.set_event_flag("drop1", 1)
             end
             if get_game.get_event_flag("drop2") == 0 and math.random(100) >= 50 then
                 game.drop_item_with_ownership(149, 1)
                 game.set_event_flag("drop2", 1)
            end
            if get_game.get_event_flag("drop3") == 0 and math.random(100) >= 50 then
                 game.drop_item_with_ownership(279, 1)
                 game.set_event_flag("drop3", 1)
            end
        end
    end
end

math.random(100) >= 50 <-- This is the chance, so it will generate a number up to 100 and if it 50 or greater, it will drop. So basicly 50% chance.

 

If you want re-enable a drop, write "/e drop1 0" with a GM character for re-enabling drop1.

You can re-enable with a quest too game.set_event_flag("drop1", 0)

Edited by TMP4
  • Love 2
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.