Need Help Gradually Increasing Spawn Rate

monsterModule.SpawnMonster = function(folder, level)
	local newLevel = level / originalLevel -- originalLevel = 1 (the start level)
	local spawnRate = math.round(newLevel)
	if spawnRate > 1 and spawnRate ~= level then
		for i = 1, spawnRate do
			SpawnMonsterFunction(folder)
		end
	else
		SpawnMonsterFunction(folder)
	end
end

Let me give context to this, so far I want to slowly scale the spawn rate of these "monsters" to the "level."
(for example if the level is 4, then spawn 2 monsters. If the level is 29, then spawn 5 or 6 monsters)

The complicated part is to slowly DECREASE the amount it scales to not have 30 monsters spawn when you hit level 50. (to keep it balanced)

I’m horrible at math so any help is appreciated. Please ask questions if you’re confused

2 Likes

So, you want the amount of monsters to increase to a point and then decrease or? If so, what is that point?

try this math.floor(((Level*(Level - 1))/3--A) * 100) + 100--B this will give you 100 in level 1 and 166 in level 2 , increase the value A to get smaller numbers and decrease value B to get smaller numbers , just play with A and B value

I tried this and messed around with the numbers, and it worked, thanks!

2 Likes

glad to hear that it worked !
Weird interesting text because of a weirder limit

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.