Frost Diver Posted December 27, 2018 Posted December 27, 2018 Hi, as title mentioned above, im trying to apply custom commands which is @mapmoblist and @whosell. but I got this error (refer picture). how to fix that? or, if anyone got a whole atcommands.c file with @mapmoblist and @whosell working, mind to share the files with me? im much appreciated. thanks in advance for your kindness. Quote
0 AnnieRuru Posted January 11, 2019 Posted January 11, 2019 1 hour ago, vilkhl said: 1. is it possible for @mapmoblist only update the current mob on the map that is not including the one is died? eg : I use the command at prt_fild04. let's say I've killed a vocal in the map, then if I use the command again, vocal will not display on bottom chat until next respawn. woot, just now @Radian also told me the same thing, now I have to double check you are right, somehow the permanent monster spawn script does let the *getmapunits script command catch the dead monsters as still being alive have to make Hp check this time // pre-re/mobs/fields/prontera.txt //================================================== // prt_fild07 - Prontera Field //================================================== prt_fild07,0,0 monster Rocker 1052,80 prt_fild07,0,0 monster Poporing 1031,30 prt_fild07,0,0 monster Vocal 1088,1,1800000,1200000 prt_fild07,225,110,5,5 monster Black Mushroom 1084,3,360000,180000 - script sdjflsdf -1,{ OnInit: bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa"; end; Onaaa: if ( .@atcmd_numparameters ) { if ( getmapusers(.@atcmd_parameters$) == -1 ) { dispbottom "Map not exist"; end; } .@map$ = .@atcmd_parameters$; } else .@map$ = strcharinfo(3); .@size = getmapunits( BL_MOB, .@map$, .@bl ); freeloop true; for ( .@i = 0; .@i < .@size; ++.@i ) { .@string$ = rid2name(.@bl[.@i]); if ( !getd(".@"+ .@string$) ) { .@mobname$[.@c] = .@string$; getunitdata .@bl[.@i], .@unitdata; .@mobx[.@c] = .@unitdata[UMOB_X]; .@moby[.@c] = .@unitdata[UMOB_Y]; .@mobhp[.@c] = .@unitdata[UMOB_HP]; .@mobmaxhp[.@c] = .@unitdata[UMOB_MAXHP]; ++.@c; } setd ".@"+ .@string$, getd(".@"+ .@string$) +1; } dispbottom " === These are monsters in "+ .@map$ +" ==="; for ( .@i = 0; .@i < .@c; ++.@i ) if ( getd(".@"+ .@mobname$[.@i]) > 1 || .@mobhp[.@i] ) dispbottom ( ++.@j )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x"; if ( getgmlevel() < 99 ) end; // admin only access, lucky you mention it so I make extra checks dispbottom " === Location of unique monsters === "; for ( .@i = 0; .@i < .@c; ++.@i ) if ( getd(".@"+ .@mobname$[.@i]) == 1 && .@mobhp[.@i] ) dispbottom .@mobname$[.@i] +" --> X = "+ .@mobx[.@i] +" Y = "+ .@moby[.@i] +" | Hp left = "+ .@mobhp[.@i] +"/"+ .@mobmaxhp[.@i]; end; } 1 hour ago, vilkhl said: 2. how to make @whosell search for vending items only? not cash items. then I have to take a look at the @whosell source code seriously =/ I was actually joking when I only use @whosell on the *searchstore script command hmm ... cash items means item type 18 ... means only look for items not IT_CASH type ... and I probably not going to do it, I think searchstore features is complete ... isn't it ? 1 Quote
0 n0tttt Posted December 27, 2018 Posted December 27, 2018 Show the code of the commands. I'm not sure if I may fix it, but I may help better if you did. 1 Quote
0 Frost Diver Posted December 28, 2018 Author Posted December 28, 2018 8 hours ago, n0tttt said: Show the code of the commands. I'm not sure if I may fix it, but I may help better if you did. @whosell at this thread : @mapmoblist at this thread : and this is my original atcommand.c file atcommand.cpp Quote
0 Haruka Mayumi Posted December 29, 2018 Posted December 29, 2018 (edited) Hmm. well i think you can just use the *searchstore. You can use it to buy directly from it too or disable them to buy and click on it to show who sell it on the map P.S Don't worry if you have extended vending implemented. it will still cost bronze coin when they buy from a bronze coin shop. Edited December 29, 2018 by Haruka Mayumi 1 1 Quote
0 n0tttt Posted January 10, 2019 Posted January 10, 2019 mapmoblist static int count_mob(struct block_list *bl, va_list ap) // [FE] { struct mob_data *md = (struct mob_data*)bl; short id = va_arg(ap, short); if (md->class_ == id) return 1; return 0; } ACMD_FUNC(mapmoblist) // [FE] { char temp[100]; bool mob_searched[MAX_MOB_DB]; bool mob_mvp[MAX_MOB_DB]; // Store mvp data.. struct s_mapiterator* it; unsigned short count = 0, i, mapindex = 0; int m = 0; memset(mob_searched, 0, MAX_MOB_DB); memset(mob_mvp, 0, MAX_MOB_DB); if (message && *message) { // Player input map name, search mob list for that map mapindex = mapindex_name2id(message); if (!mapindex) { clif_displaymessage(fd, "Map not found"); return -1; } m = map_mapindex2mapid(mapindex); } else { // Player doesn't input map name, search mob list in player current map mapindex = sd->mapindex; m = sd->bl.m; } clif_displaymessage(fd, "--------Monster List--------"); sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex)); clif_displaymessage(fd, temp); clif_displaymessage(fd, "Monsters: "); //Looping and search for mobs it = mapit_geteachmob(); while (true) { TBL_MOB* md = (TBL_MOB*)mapit_next(it); if (md == NULL) break; if (md->bl.m != m || md->status.hp <= 0) continue; if (mob_searched[md->mob_id] == true) continue; // Already found, skip it if (mob_db(md->mob_id)->mexp) { mob_searched[md->mob_id] = true; mob_mvp[md->mob_id] = true; // Save id for later continue; // It's MVP! } mob_searched[md->mob_id] = true; count = map_foreachinmap(count_mob, m, BL_MOB, md->class_); sprintf(temp, " %s[%d] : %d", mob_db(md->mob_id)->jname, md->mob_id, count); clif_displaymessage(fd, temp); } mapit_free(it); clif_displaymessage(fd, "MVP: "); // Looping again and search for mvp, not sure if this is the best way.. for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion) if (mob_mvp[i] == true) { count = map_foreachinmap(count_mob, m, BL_MOB, i); sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count); clif_displaymessage(fd, temp); } } return 0; } Hope it works. 1 Quote
0 AnnieRuru Posted January 10, 2019 Posted January 10, 2019 - script sdjflsdf -1,{ OnInit: bindatcmd "whosell", strnpcinfo(0)+"::Onbbb"; bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa"; end; Onbbb: searchstores 999, 1; // yeah I'm so cheap XD end; Onaaa: if ( .@atcmd_numparameters ) { if ( getmapusers(.@atcmd_parameters$) == -1 ) { dispbottom "Map not exist"; end; } .@map$ = .@atcmd_parameters$; } else .@map$ = strcharinfo(3); .@size = getmapunits( BL_MOB, .@map$, .@bl ); freeloop true; for ( .@i = 0; .@i < .@size; ++.@i ) { .@string$ = rid2name(.@bl[.@i]); if ( !getd(".@"+ .@string$) ) .@mobname$[.@c++] = .@string$; setd ".@"+ .@string$, getd(".@"+ .@string$) +1; } dispbottom " === These are monsters in "+ .@map$ +" ==="; for ( .@i = 0; .@i < .@c; ++.@i ) dispbottom ( .@i +1 )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x"; end; } 1 1 1 Quote
0 Frost Diver Posted January 11, 2019 Author Posted January 11, 2019 7 hours ago, n0tttt said: mapmoblist static int count_mob(struct block_list *bl, va_list ap) // [FE] { struct mob_data *md = (struct mob_data*)bl; short id = va_arg(ap, short); if (md->class_ == id) return 1; return 0; } ACMD_FUNC(mapmoblist) // [FE] { char temp[100]; bool mob_searched[MAX_MOB_DB]; bool mob_mvp[MAX_MOB_DB]; // Store mvp data.. struct s_mapiterator* it; unsigned short count = 0, i, mapindex = 0; int m = 0; memset(mob_searched, 0, MAX_MOB_DB); memset(mob_mvp, 0, MAX_MOB_DB); if (message && *message) { // Player input map name, search mob list for that map mapindex = mapindex_name2id(message); if (!mapindex) { clif_displaymessage(fd, "Map not found"); return -1; } m = map_mapindex2mapid(mapindex); } else { // Player doesn't input map name, search mob list in player current map mapindex = sd->mapindex; m = sd->bl.m; } clif_displaymessage(fd, "--------Monster List--------"); sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex)); clif_displaymessage(fd, temp); clif_displaymessage(fd, "Monsters: "); //Looping and search for mobs it = mapit_geteachmob(); while (true) { TBL_MOB* md = (TBL_MOB*)mapit_next(it); if (md == NULL) break; if (md->bl.m != m || md->status.hp <= 0) continue; if (mob_searched[md->mob_id] == true) continue; // Already found, skip it if (mob_db(md->mob_id)->mexp) { mob_searched[md->mob_id] = true; mob_mvp[md->mob_id] = true; // Save id for later continue; // It's MVP! } mob_searched[md->mob_id] = true; count = map_foreachinmap(count_mob, m, BL_MOB, md->class_); sprintf(temp, " %s[%d] : %d", mob_db(md->mob_id)->jname, md->mob_id, count); clif_displaymessage(fd, temp); } mapit_free(it); clif_displaymessage(fd, "MVP: "); // Looping again and search for mvp, not sure if this is the best way.. for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion) if (mob_mvp[i] == true) { count = map_foreachinmap(count_mob, m, BL_MOB, i); sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count); clif_displaymessage(fd, temp); } } return 0; } Hope it works. thanks buddy! I'll try this out. if there's any issue,i'll update here later Quote
0 Frost Diver Posted January 11, 2019 Author Posted January 11, 2019 6 hours ago, AnnieRuru said: - script sdjflsdf -1,{ OnInit: bindatcmd "whosell", strnpcinfo(0)+"::Onbbb"; bindatcmd "mapmoblist", strnpcinfo(0)+"::Onaaa"; end; Onbbb: searchstores 999, 1; // yeah I'm so cheap XD end; Onaaa: if ( .@atcmd_numparameters ) { if ( getmapusers(.@atcmd_parameters$) == -1 ) { dispbottom "Map not exist"; end; } .@map$ = .@atcmd_parameters$; } else .@map$ = strcharinfo(3); .@size = getmapunits( BL_MOB, .@map$, .@bl ); freeloop true; for ( .@i = 0; .@i < .@size; ++.@i ) { .@string$ = rid2name(.@bl[.@i]); if ( !getd(".@"+ .@string$) ) .@mobname$[.@c++] = .@string$; setd ".@"+ .@string$, getd(".@"+ .@string$) +1; } dispbottom " === These are monsters in "+ .@map$ +" ==="; for ( .@i = 0; .@i < .@c; ++.@i ) dispbottom ( .@i +1 )+". "+ .@mobname$[.@i] +" : "+ getd(".@"+ .@mobname$[.@i])+"x"; end; } thanks a lot Annie. the scripts worked. but got 2 questions : 1. is it possible for @mapmoblist only update the current mob on the map that is not including the one is died? eg : I use the command at prt_fild04. let's say I've killed a vocal in the map, then if I use the command again, vocal will not display on bottom chat until next respawn. 2. how to make @whosell search for vending items only? not cash items. 1 Quote
0 PapaZola Posted January 7, 2021 Posted January 7, 2021 got update for @mapmoblist? im trying now got error Quote atcommand.cpp:9417:11: error: 'mob_searched' was not declared in this scope memset(mob_searched, 0, MAX_MOB_DB); ^~~~~~~~~~~~ atcommand.cpp:9417:11: note: suggested alternative: 'hom_search' memset(mob_searched, 0, MAX_MOB_DB); ^~~~~~~~~~~~ hom_search atcommand.cpp:9418:11: error: 'mob_mvp' was not declared in this scope memset(mob_mvp, 0, MAX_MOB_DB); ^~~~~~~ atcommand.cpp:9418:11: note: suggested alternative: 'mob_db' memset(mob_mvp, 0, MAX_MOB_DB); ^~~~~~~ mob_db atcommand.cpp:9459:59: error: 'TBL_MOB {aka struct mob_data}' has no member name d 'class_' count = map_foreachinmap(count_mob, m, BL_MOB, md->class_); Quote
Question
Frost Diver
Hi, as title mentioned above, im trying to apply custom commands which is @mapmoblist and @whosell.
but I got this error (refer picture). how to fix that?
or, if anyone got a whole atcommands.c file with @mapmoblist and @whosell working, mind to share the files with me? im much appreciated.
thanks in advance for your kindness.
9 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.