View Single Post
  #13  
Old 02-25-2022, 11:30 AM
Firepaw's Avatar
Firepaw
Fire Beetle
 
Join Date: Dec 2012
Location: USA
Posts: 4
Smile

Heres a simple way of doing that where level is taken into account.

Note youll have to change some of it since its tailored to a custom server but left in comments to debug and explain what each part does



Code:
function event_spawn(e)
	local levelMod = math.ceil(e.self:GetLevel()/10);
	local ran = math.random(1,100);
	--e.self:Shout(tostring(levelMod)); debug
	if (ran > 90) then
		--local levelMod = math.ceil(e.self:GetLevel()/10);
		local ran2 = math.random(0,52);
                --which item in the tier drops, had 52 items in each tier

		--e.self:Shout(tostring(ran2)); debug
		if (ran < 99) then
			levelMod = levelMod - 1;
		end
		if (levelMod > 7) then
			levelMod = 7;
		end
		local lootdrop = levelMod * 52 + ran2 + 300000;
                -- decides what item goes on a mob. first item I wanted to drop was 300,000 ... 52 * tier

		--e.self:Shout(tostring(lootdrop)); debug
		e.self:AddItem(lootdrop, -1);
                --gives mob item

		--e.self:Shout(tostring(levelMod)); debug
	end
end
Reply With Quote