Hi! I am making a game not unlike Diablo 2. As such I need a script to handle the monsters.
My thoughts on the subject would be to create a global variable at 0 by default, when the game loads. This variable would be the current number of monsters in the area. As you move through the area, it will randomly create monster entities, going through random numbers to decide which kind of monster to spawn.
Depending on a variable loaded with each level, the max amount of monsters is created (not the exact second) as soon as you enter, so the monsters are placed before you have a chance to move.
What I had planned was, for each monster, a function checks the current number of monsters in the map, adds 1, and creates a variable for each of that monsters stats, health, etc. based off of that number.
So, if there are 23 monsters in an area and the enigine is about to make the 24th, it creates a variable named something like Health.Monster.24 and so on. After it's done, it adds one to the global variable, so the next check starts at 25.
My question is, is this too many variables for GS to handle? I know it can handle a fair amount, but were talking about maybe 700 variables created (not at once) pretty close to each-other. Is there a quicker way?
I also thought I might make the monsters as you walk through the area, or based on the time you've spent there, and when it reaches the max monster limit, it would stop creating them.
I would like to know which method you guys think would work better, and whether I am completly wrong on this topic or not. I also need a method to make sure that they don't spawn in walls or the character, but I can't even imagine how i would do that, short of shooting a ray (invisible, of course) from the player in all the directions and creating them that way, but wouldn't that make them spawn close to the character?
I really need a new way to check for collisions when they are spawned. Any comments or questions are more than welcome.
Cyrus