ID:164910
 
In my game, Kingdom Build, there are dungeons, with many rooms. I was wondering, is there a way that I can make it spawn a certain amount of monsters in each room?
Michael3131 wrote:
In my game, Kingdom Build, there are dungeons, with many rooms. I was wondering, is there a way that I can make it spawn a certain amount of monsters in each room?

It might be better to spawn them only in a certain percentage of rooms. Some rooms should really be empty. But otherwise, for rooms with monsters you can simply spawn a semi-random number of them.

// if exploring for the first time
// 20% chance of 1 monster
if(prob(20))
for(var/i = rand(2,5), i>0, --i)
SpawnMonster(area)
// 50% of remaining 80% = 40% total chance of 1 monster
else if(prob(50))
SpawnMonster(area)
// remaining 40% chance is empty room


Lummox JR