Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

¨¨[Help] Spawn monsters when player on map

Junior Spellweaver
Joined
Sep 20, 2019
Messages
108
Reaction score
8
Hi, me again with more noob question i guess..

Back on the days i started to play private servers of Maplestory i remember playing a private server v83 that used to spawn mobs and bosses only when a player comes to the map, so i wanted to implement that feature on my server as well.

One of the reasons why i would like to make it that way is beacause sometimes when i come to a map (For example the lower portal at perion that leads you to sleepywood and some others at random i guess) some mobs start to fall from heaven(?) so i assumed if i make the mobs spawn after i go to the map that glitch could be solved. But even spending an hour reading MapleMonster and MapleMap on Netbeans couldnt figure a way to make it works as i want to..

So if someone knows where should i edit and would like to share it'll be aprecciated, please go easy on me i'm noob :D . Thanks in advance.

Edit: By the way, i'm using HeavenMS v83 source.
 
Last edited:
Mythic Archon
Joined
Jul 2, 2013
Messages
723
Reaction score
70
Mobs falling are often due to spawn positions being too low or close to the platform itself. If you want to fix this, the easiest fix is just spawn them higher. As for monsters not spawning, find the worker that respawns monsters. Generally the condition to respawn on spawn points are if the monster assigned is null. Add a check before the loop that checks spawn points and see if there are any players in the map first. If there is no one, remove all the monsters. If there are players, continue as normal.
 
Upvote 0
Newbie Spellweaver
Joined
Sep 19, 2018
Messages
14
Reaction score
26
So if someone knows where should i edit and would like to share it'll be aprecciated, please go easy on me i'm noob :D . Thanks in advance.

Mobs falling when entering maps is a common bug. This is caused by Mob::EnterField holding incorrect x/y cords or foothold. Because of this, the client then sends a MobMovement packet of them falling. I've noticed that this mostly occurs on sloped footholds with incorrect server handling of incoming movement packets or spawning.

First, verify you're pulling mob data from your data source(xml/wz/bin/json/w.e.) directly. Then check how you're pulling it into the map. Some sources use Map::calcPointBelow to get a point for a foothold instead of using the x/y from the data source.

Second, in your mob movement handler, verify you're setting the position correctly from incoming movement packets. Odin sources iterate all movements in a movement path and set the y position -1 from actual:
Code:
MoveLifeHandler:
...
updatePosition(res, dragon, -1); // You should replace this with CMob::SetMovePosition (WvsGame)
...
protected void updatePosition(MovePath path, AnimatedMapleMapObject target, int yoffset){
        for(Elem elem : path.lElem){
            if(elem.x != 0 && elem.y != 0){
                target.setPosition(new Point(elem.x, elem.y + yoffset)); // Notice how the new y position is + yoffset?

You could also just disregard the movement packet if the movement path startX == endX && startY > endY, but it's easier just to fix the issue instead.

Hopefully it gives you a place to look going forward.
 
Upvote 0
Junior Spellweaver
Joined
Sep 20, 2019
Messages
108
Reaction score
8
Well, the problem of the mobs falling was a source issue and it got solved when the owner of HeavenMS patched it.. But would be awesome to make the mobs spawn just only when the player goes into it instead spawn them in every map when the bat file loads the resources of the server.

Thanks for your help. :D
 
Upvote 0
Junior Spellweaver
Joined
Feb 18, 2018
Messages
117
Reaction score
10
Well, the problem of the mobs falling was a source issue and it got solved when the owner of HeavenMS patched it.. But would be awesome to make the mobs spawn just only when the player goes into it instead spawn them in every map when the bat file loads the resources of the server.Thanks for your help. :D
Post your Respawn function, and how is handled because in the source i have is like this:
if (map.characterSize() > 0) {
if (map.canSpawn(now) && map.characterSize() > 0) {
map.respawn(false, now);
}

if you don't know from where is coming those spawns just add a print in console in all spawnmonster function, as for the initial spawn i can't just remove it because it requires to kill a previous monster to make the respawn work fine
 
Last edited:
Upvote 0
Mythic Archon
Joined
Jul 2, 2013
Messages
723
Reaction score
70
Mobs falling are often due to spawn positions being too low or close to the platform itself. If you want to fix this, the easiest fix is just spawn them higher. As for monsters not spawning, find the worker that respawns monsters. Generally the condition to respawn on spawn points are if the monster assigned is null. Add a check before the loop that checks spawn points and see if there are any players in the map first. If there is no one, remove all the monsters. If there are players, continue as normal.
Well, the problem of the mobs falling was a source issue and it got solved when the owner of HeavenMS patched it.. But would be awesome to make the mobs spawn just only when the player goes into it instead spawn them in every map when the bat file loads the resources of the server. Thanks for your help. :D

-.- ...
 
Upvote 0
Back
Top