Jump to content

Random Dop Quest


Vaynz

Recommended Posts

  • Silver

M2 Download Center

This is the hidden content, please
( Internal )

This quest can be used for pvp servers in map farm or like pvm at final boss when spawn a chest click him and you will receive de drop ^ ^.

What you have to do: To make the mob like NPC and when this is clicked you will get a random drop.

If you want more than 8 drop's change local s = number and elseif's

 

quest droprandooom begin
	state start begin
		function antibug()
			local drprnd = 2
			pc.setqf("anti_bug", get_time()+drprnd)
		end
		when 11505.click begin 
			if pc.getqf("anti_bug") <= get_time() then
				npc.kill()
				droprandooom.antibug()
				local s = number(1,8) 
				if s == 1 then game.drop_item_with_ownership(Vnum Item,Quanity)
				elseif s == 2 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 3 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 4 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 5 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 6 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 7 then game.drop_item_with_ownership(Vnum ITEM,Quantity)
				elseif s == 8 then game.drop_item_with_ownership()
				chat("No drop.")
				end
			end
		end
	end
end

 

  • Metin2 Dev 12
  • Dislove 1
  • Good 4
  • Love 1
Link to comment
Share on other sites

  • 2 months later...
On 8/8/2020 at 10:08 PM, Finnael said:

Is there a reason to not write the code like this? Am I missing something?

 

 


        if s >= 1 and s <= 7 then
            game.drop_item_with_ownership(Vnum ITEM, Quantity)
        elseif s == 8 then
            game.drop_item_with_ownership()
        end

 

probably to be different (1 differs from 2 and etc)

anyway, If I want to do something like that

I would do it like this:

 

quest randdrop begin
	state start begin
		when 11505.click begin
			local randitems = {
				-- {vnum, count}
				{27001, 1},
				{27002, 1}
			}
			local rndnum = math.random(table.getn(randitems))
			game.drop_item_with_ownership(randitems[rndnum][1], randitems[rndnum][2])
		end
	end
end

 

Edited by Asentrix
  • Love 1
Link to comment
Share on other sites

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.