Jump to content

Recommended Posts

quest drop begin
    state start begin
        when kill with not npc.is_pc() and math.random(100) >= 99 begin
            local mob_lvl=npc.get_level()
            local player_level=pc.get_level()
                if player_level - mob_lvl <= 15 and player_level - mob_lvl >= -15 then
                    game.drop_item_with_ovnership(50133,1)
                end
        end
    end
end

Why quest dont work i kill many spot monster and any drop box why ?

 

And wher change % drop ?

 

 

Link to comment
Share on other sites

  • Active Member

NO!
From 100 kill the script runs only 2 times. I think that you have to check the level BEFORE number/math.random.

quest drop begin
state start begin
  when kill with not npc.is_pc() begin
   local mob_lvl=npc.get_level()
   local player_level=pc.get_level()
   if player_level - mob_lvl <= 15 and player_level - mob_lvl >= -15 then
    local chance = 2 -- percent, change if you want!
    if number(1,100) > (100-chance) then
     game.drop_item_with_ovnership(50133,1)
    end
   end
  end
end
end
Link to comment
Share on other sites

  • Active Member
$ lua51
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> print(math.random(100))
85
>

 

math.random ([m [, n]])

This function is an interface to the simple pseudo-random generator function rand provided by ANSI C. (No guarantees can be given for its statistical properties.)

When called without arguments, returns a uniform pseudo-random real number in the range [0,1). When called with an integer number m, math.random returns a uniform pseudo-random integer in the range [1, m]. When called with two integer numbers m and n, math.random returns a uniform pseudo-random integer in the range [m, n].

 

I don't know how it works in 5.0, but i think it's the same...

 

Link to comment
Share on other sites

quest drop begin
	state start begin
		when kill with not npc.is_pc() and math.random(1,100) >= 99 begin
			local mob_lvl=npc.get_level(npc.get_race())
			local player_level=pc.get_level()
			if player_level - mob_lvl <= 15 and player_level - mob_lvl >= -15 then
				game.drop_item_with_ownership(50133,1)
			end
		end
	end
end

this work

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.