Jump to content
  • Register Now

    Sign up and take advantage of the features of our community! Some forums are only accessible to our members!

Random drop quest.


Recommended Posts

  • VIP

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

 

Link to post
  • 2 months later...
  • VIP

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

Link to post
  • VIP
Posted (edited)
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 (see edit history)
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.