Davros Posted September 10, 2012 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 14 Reputation: 0 Joined: 04/22/12 Last Seen: August 29, 2015 Share Posted September 10, 2012 Hi everyone, I would like to change my killmonster2 cmd to, when I use this command, kill all monsters around the server, ALL monster including MVP, mini-boss, etc. If it's possible please teach me how. Here is the code: void atcommand_killmonster_sub(const int fd, struct map_session_data* sd, const char* message, const int drop) { int map_id; char map_name[MAP_NAME_LENGTH_EXT]; if (!sd) return; memset(map_name, '\0', sizeof(map_name)); if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; else { if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, drop); clif_displaymessage(fd, msg_txt(165)); // All monsters killed! return; } /*========================================== * *------------------------------------------*/ ACMD_FUNC(killmonster2) { atcommand_killmonster_sub(fd, sd, message, 0); return 0; } Quote Link to comment Share on other sites More sharing options...
clydelion Posted September 10, 2012 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 754 Reputation: 186 Joined: 05/22/12 Last Seen: October 15, 2022 Share Posted September 10, 2012 Index: atcommand.c =================================================================== --- atcommand.c (revision 16608) +++ atcommand.c (working copy) @@ -2276,15 +2276,27 @@ memset(map_name, '\0', sizeof(map_name)); - if (!message || !*message || sscanf(message, "%15s", map_name) < 1) - map_id = sd->bl.m; - else { - if ((map_id = map_mapname2mapid(map_name)) < 0) + if(drop) { + if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; + else { + if ((map_id = map_mapname2mapid(map_name)) < 0) + map_id = sd->bl.m; + } + + map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, drop); } + else { + struct mob_data* md; + struct s_mapiterator* iter; + iter = mapit_geteachmob(); + for( md = (TBL_MOB*)mapit_first(iter); mapit_exists(iter); md = (TBL_MOB*)mapit_next(iter) ){ + if (!md->guardian_data && md->spawn) + status_kill(&md->bl); + } + mapit_free(iter); + } - map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, drop); - clif_displaymessage(fd, msg_txt(165)); // All monsters killed! return; 1 Quote Link to comment Share on other sites More sharing options...
Davros Posted September 11, 2012 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 14 Reputation: 0 Joined: 04/22/12 Last Seen: August 29, 2015 Author Share Posted September 11, 2012 I don't get it. How should the script look like? Quote Link to comment Share on other sites More sharing options...
clydelion Posted September 11, 2012 Group: Members Topic Count: 17 Topics Per Day: 0.00 Content Count: 754 Reputation: 186 Joined: 05/22/12 Last Seen: October 15, 2022 Share Posted September 11, 2012 void atcommand_killmonster_sub(const int fd, struct map_session_data* sd, const char* message, const int drop) { int map_id; char map_name[MAP_NAME_LENGTH_EXT]; if (!sd) return; memset(map_name, '\0', sizeof(map_name)); if(drop) { if (!message || !*message || sscanf(message, "%15s", map_name) < 1) map_id = sd->bl.m; else { if ((map_id = map_mapname2mapid(map_name)) < 0) map_id = sd->bl.m; } map_foreachinmap(atkillmonster_sub, map_id, BL_MOB, drop); } else { struct mob_data* md; struct s_mapiterator* iter; iter = mapit_geteachmob(); for( md = (TBL_MOB*)mapit_first(iter); mapit_exists(iter); md = (TBL_MOB*)mapit_next(iter) ){ if (!md->guardian_data && strlen(md->npc_event) < 4) status_kill(&md->bl); } mapit_free(iter); } clif_displaymessage(fd, msg_txt(165)); // All monsters killed! return; } 1 Quote Link to comment Share on other sites More sharing options...
Davros Posted September 12, 2012 Group: Members Topic Count: 6 Topics Per Day: 0.00 Content Count: 14 Reputation: 0 Joined: 04/22/12 Last Seen: August 29, 2015 Author Share Posted September 12, 2012 Thanks it worked. Quote Link to comment Share on other sites More sharing options...
Question
Davros
Hi everyone, I would like to change my killmonster2 cmd to, when I use this command, kill all monsters around the server, ALL monster including MVP, mini-boss, etc.
If it's possible please teach me how.
Here is the code:
Link to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.