Eross Posted May 24, 2020 Group: Members Topic Count: 166 Topics Per Day: 0.09 Content Count: 377 Reputation: 12 Joined: 04/05/20 Last Seen: Monday at 11:47 AM Share Posted May 24, 2020 link is broken Quote Link to comment Share on other sites More sharing options...
Boss Robs Posted July 18, 2020 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 0 Joined: 07/16/20 Last Seen: February 7 Share Posted July 18, 2020 (edited) /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; char eventname[EVENT_NAME_LENGTH] = ""; int mob_id; int number = 0; int count; int i, range; short mx, my; unsigned int size; nullpo_retr(-1, sd); memset(name, '\0', sizeof(name)); memset(monster, '\0', sizeof(monster)); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { clif_displaymessage(fd, msg_txt(sd,80)); // Give the display name or monster name/id please. return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %11d", name, monster, &number) > 1 || sscanf(message, "%23s \"%23[^\"]\" %11d", monster, name, &number) > 1) { //All data can be left as it is. } else if ((count=sscanf(message, "%23s %11d %23s", monster, &number, name)) > 1) { //Here, it is possible name was not given and we are using monster for it. if (count < 3) //Blank mob's name. name[0] = '\0'; } else if (sscanf(message, "%23s %23s %11d", name, monster, &number) > 1) { //All data can be left as it is. } else if (sscanf(message, "%23s", monster) > 0) { //As before, name may be already filled. name[0] = '\0'; } else { clif_displaymessage(fd, msg_txt(sd,80)); // Give a display name and monster name/id please. return -1; } if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = mobdb_checkid(atoi(monster)); if (mob_id == 0) { clif_displaymessage(fd, msg_txt(sd,40)); // Invalid monster ID or name. return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(sd,83)); // Monster 'Emperium' cannot be spawned. return -1; } if (number <= 0) number = 1; if( !name[0] ) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; parent_cmd = atcommand_alias_db.checkAlias(command+1); if (strcmp(parent_cmd, "monstersmall") == 0) size = SZ_MEDIUM; // This is just gorgeous [mkbu95] else if (strcmp(parent_cmd, "monsterbig") == 0) size = SZ_BIG; else size = SZ_SMALL; if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y); count = 0; range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { int k; map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0); k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE); if(k) { //mapreg_setreg(reference_uid(add_str("$@mobid"), i),k); //retain created mobid in array uncomment if needed count ++; } } if (count != 0) if (number == count){ if(pc_get_group_level(sd)==99){ // Checks if the GM level is below 99 Announcement is made [Vengeance] clif_displaymessage(fd, msg_txt(sd,39)); // All monster summoned! } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); //sprintf(atcmd_output, msg_txt(sd,240), count); // %d monster(s) summoned! // <-- ORIG CODE //clif_displaymessage(fd, atcmd_output); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); clif_displaymessage(fd, msg_txt(sd,39)); // All monster summoned! } } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); sprintf(atcmd_output, msg_txt(sd,240), count); // %d monster(s) summoned! //clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_txt(sd,40)); // Invalid monster ID or name. return -1; } return 0; } Working in the latest git just replace the Monster Command at /src/map/atcommand.cpp Tried and tested Edited July 18, 2020 by Boss Robs Minor fix in code Quote Link to comment Share on other sites More sharing options...
Eross Posted July 18, 2020 Group: Members Topic Count: 166 Topics Per Day: 0.09 Content Count: 377 Reputation: 12 Joined: 04/05/20 Last Seen: Monday at 11:47 AM Share Posted July 18, 2020 7 hours ago, Boss Robs said: /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; char eventname[EVENT_NAME_LENGTH] = ""; int mob_id; int number = 0; int count; int i, range; short mx, my; unsigned int size; nullpo_retr(-1, sd); memset(name, '\0', sizeof(name)); memset(monster, '\0', sizeof(monster)); memset(atcmd_output, '\0', sizeof(atcmd_output)); if (!message || !*message) { clif_displaymessage(fd, msg_txt(sd,80)); // Give the display name or monster name/id please. return -1; } if (sscanf(message, "\"%23[^\"]\" %23s %11d", name, monster, &number) > 1 || sscanf(message, "%23s \"%23[^\"]\" %11d", monster, name, &number) > 1) { //All data can be left as it is. } else if ((count=sscanf(message, "%23s %11d %23s", monster, &number, name)) > 1) { //Here, it is possible name was not given and we are using monster for it. if (count < 3) //Blank mob's name. name[0] = '\0'; } else if (sscanf(message, "%23s %23s %11d", name, monster, &number) > 1) { //All data can be left as it is. } else if (sscanf(message, "%23s", monster) > 0) { //As before, name may be already filled. name[0] = '\0'; } else { clif_displaymessage(fd, msg_txt(sd,80)); // Give a display name and monster name/id please. return -1; } if ((mob_id = mobdb_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number) mob_id = mobdb_checkid(atoi(monster)); if (mob_id == 0) { clif_displaymessage(fd, msg_txt(sd,40)); // Invalid monster ID or name. return -1; } if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(sd,83)); // Monster 'Emperium' cannot be spawned. return -1; } if (number <= 0) number = 1; if( !name[0] ) strcpy(name, "--ja--"); // If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit) number = battle_config.atc_spawn_quantity_limit; parent_cmd = atcommand_alias_db.checkAlias(command+1); if (strcmp(parent_cmd, "monstersmall") == 0) size = SZ_MEDIUM; // This is just gorgeous [mkbu95] else if (strcmp(parent_cmd, "monsterbig") == 0) size = SZ_BIG; else size = SZ_SMALL; if (battle_config.etc_log) ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y); count = 0; range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around) for (i = 0; i < number; i++) { int k; map_search_freecell(&sd->bl, 0, &mx, &my, range, range, 0); k = mob_once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE); if(k) { //mapreg_setreg(reference_uid(add_str("$@mobid"), i),k); //retain created mobid in array uncomment if needed count ++; } } if (count != 0) if (number == count){ if(pc_get_group_level(sd)==99){ // Checks if the GM level is below 99 Announcement is made [Vengeance] clif_displaymessage(fd, msg_txt(sd,39)); // All monster summoned! } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); //sprintf(atcmd_output, msg_txt(sd,240), count); // %d monster(s) summoned! // <-- ORIG CODE //clif_displaymessage(fd, atcmd_output); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); clif_displaymessage(fd, msg_txt(sd,39)); // All monster summoned! } } else { sprintf(atcmd_output, "%s summoned %d %s in %s,%d,%d", sd->status.name,number, monster, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); sprintf(atcmd_output, msg_txt(sd,240), count); // %d monster(s) summoned! //clif_displaymessage(fd, atcmd_output); } else { clif_displaymessage(fd, msg_txt(sd,40)); // Invalid monster ID or name. return -1; } return 0; } Working in the latest git just replace the Monster Command at /src/map/atcommand.cpp Tried and tested Hi thankyou ! may I ask if its possible also on Recall command ?? Quote Link to comment Share on other sites More sharing options...
Boss Robs Posted July 23, 2020 Group: Members Topic Count: 0 Topics Per Day: 0 Content Count: 9 Reputation: 0 Joined: 07/16/20 Last Seen: February 7 Share Posted July 23, 2020 (edited) On 7/19/2020 at 1:34 AM, erjsanmiguel said: Hi thankyou ! may I ask if its possible also on Recall command ?? yes it's possible /src/map/atcommand.cpp search for ACMD_FUNC(recall) then find sprintf(atcmd_output, msg_txt(sd,46), pl_sd->status.name); // U WILL FIND THIS AT THE BOTTOM OF RECALL COMMAND add this sprintf(atcmd_output, "%s recalled %s at %s %d %d", sd->status.name,pl_sd->status.name,mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y); // I UPDATE IT WITH MAPNAME AND COORDINATES intif_broadcast(atcmd_output, strlen(atcmd_output) + 1, 0); then recompile voila Edited July 23, 2020 by Boss Robs Minor fix in code Quote Link to comment Share on other sites More sharing options...
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.