Sign in to follow this  
Arkonick

Check and rebuild spawn code for WU

Recommended Posts

I've looked threw this code and I'm no java programmer but What I do see is a mess in the code I will try to explain with out dropping your code on the screen.

In the Creatures class you have a addCreature method as well as a permanentlyDelete method these two methods spawn and delete mobs on the map for the system, but then way over in the Zone class file you have a similar add and remove creature method as well as a stand alone method for spawning the new sea creatures not long ago added. These mobs are always on track all but the shark which uses a different method to check and spawn. The problem I see is the seaserpant has a if statement that checks if the serpant aka seamonster goes over the count of 4 this makes the temp.setMaxPopulationOfCreatures(4) useless from the way I understand it then the Octopus, Blue Whale, and Dolphin call a specific method called getOpenSpawnSlotsForCreatureType. This method is way over in the Creatures class which checks if the template of the mob is using max pop or max percent. My point here is these 3 mobs are the only mobs in the game that use the method getOpenSpawnSlotsForCreatureType to check and these 3 mobs regardless if you use max pop or max percent are always keep accurate cause they use this method to check. How ever every other mob in the game you do not call this method and there always to low or over there percentage.

 

Then we have another issue with the 2 addCreature methods. Every time you have a restart the server spawns a small portion of mobs before the server launches this is coming from one of these add creature methods Which I didn't track down which one is doing it right now. It doesn't do any mob checks it spawns them regardless of there populations limit or percentage.

 

My question is why did we have to have 2 sets of add and remove creatures? 1 for the old mobs and 1 for the new sea creatures recently added? then why does the new ones have a check and the others do not? We have this massive issue where mobs are going over there limit or percentage and X amount being spawned at every restart.

 

What should be happening here is several checks some which are not present. 

Before a Creature can spawn it needs to check the database to see if the max limit or percentage is met for that mob it is about to add

Check  threw all the creatures to see which one is the lowest percentage and to plus it first. This needs to be performed before every spawn.

Once the creatures has met it's maxed limit or percentage it needs to remove it from the database spawning the creatures

Then another check that every time a mob is killed by player or system deletes it it goes threw the new database which should be holding the id for mobs not to spawn and checking if the mob can spawn again if so it removes it from this database record and adds it back to the spawn database record so it can spawn again until it reaches it's max again.

 

None of this do I see going on, which tells me this is the source of the problem. Where are the checks? I see only one check used by 3 mobs out of all the mobs spawned and that's the 3 mobs under the method getRandomSeaCreatureID in the Zone class using the  getOpenSpawnSlotsForCreatureType method check. This method checks if the mob is using the max population and if it is less than or equal to max percentage then use max population else use the max percentage. Problem I see in this method is that's all it does it is missing if it goes over, what to do, "I don't no like delete what went over sounds good or stop spawning for this id and record it in a new database like i mentioned above."

 

All in all this is the route of all evil in your code can we please get a fix soon. I know no one on your team want to have to deal with this but it has to be done. You'll might be very busy but I took the time to trace down the issue so don't think of this as being hateful or mean or take this post in the wrong way. I'm just simply trying to help.

Share this post


Link to post
Share on other sites

wonder if this is why my dragon lairs were dropping a few hundred dragons all of a sudden

i would love full control over all spawns at some point =)

Share this post


Link to post
Share on other sites
23 minutes ago, Aum said:

wonder if this is why my dragon lairs were dropping a few hundred dragons all of a sudden

i would love full control over all spawns at some point =)

Dragon lairs? If you put dragons under lairs there going to spit out like a normal mob dragons don't use lairs for this reason. What you want to do is add temp.setMaxPopulationOfCreatures(4); the number 4 being the int of dragons you want to spawn you don't need a lair to control the population, just this method called for that dragon or for each dragon type you are trying to spawn. Not sure how you call it in modloader but I don't use modloader myself all modding on my server is done in straight code. Hope this helps your unique issue.

 

Out of curiosity why do you need to control the unique spawns? They work fine on there own. If you are having issues with them spawning you might need to check the mods you are using one of them can be killing the spawn of uniques. Like i said I don't use mods I alter my own code without modloader. My map spawn uniques like they should or as Rolf intended them to spawn. Only issue I've seen is the base mobs described above not keeping track of their limits.

Edited by Arkonick

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this