Jump to content
  • 0

Killmonster2


Davros

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  04/22/12
  • Last Seen:  

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;
}

Link to comment
Share on other sites

4 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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;

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  04/22/12
  • Last Seen:  

I don't get it.

How should the script look like?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  754
  • Reputation:   186
  • Joined:  05/22/12
  • Last Seen:  

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;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  04/22/12
  • Last Seen:  

Thanks it worked.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...