jedwynne Posted June 8, 2012 Posted June 8, 2012 is there any way i could disable a specific monster in @commands. for example you cant summon a poring using @monster poring. if it possible, how? Quote
MarkZD Posted July 5, 2012 Posted July 5, 2012 (edited) In src/map/atcommand.c: Find: /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; char eventname[EVENT_NAME_LENGTH] = ""; int mob_id; int number = 0; Before add: static int monsterBlock(int compareid){ FILE *fp; char line[1024]; int ln=0; int nameid; char filename[255]; snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path); if( (fp=fopen(filename,"r"))==NULL ){ ShowError("can't read %s\n", filename); return -1; } while(fgets(line, sizeof(line), fp)) { if(line[0] == '\n' || line[0] == '\r' || line[0] == ' ' || (line[0]=='/' && line[1]=='/')) continue; nameid = atoi(line); if(compareid == nameid) { fclose(fp); return 1; // Monster Blocked } } fclose(fp); return 0; // Monster Accepted } Within ACMD_FUNC(monster) find: int mob_id; Replace with: int mob_id, mB = 0; Find: if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned. return -1; } After add: if(pc_get_group_level(sd) < 99 && (mB = monsterBlock(mob_id))) if(mB == 1){ clif_displaymessage(fd, "Acess_Restriction: Administrator restricted this monster from being called by @monster direct command."); return -1; } Go to db path and create a file called: monster_block.txt Put into it ID from monsters you want to block, like this: //Comments 1001 //Scorpion 1002 1003 //etc -------------------------------------------------------------------------------------------------------- Admin level 99 can still summon any monster, if you don't want it change it: if(pc_get_group_level(sd) < 99 && (mB = monsterBlock(mob_id))) To: if((mB = monsterBlock(mob_id))) Edit: fixed the fclose part which could lead to file descriptor staying opened "forever". Edited August 9, 2012 by MarkZD Quote
GM Incarnation Posted August 4, 2012 Posted August 4, 2012 In src/map/atcommand.c: Find: /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; char eventname[EVENT_NAME_LENGTH] = ""; int mob_id; int number = 0; Before add: static int monsterBlock(int compareid){ FILE *fp; char line[1024]; int ln=0; int nameid; char filename[255]; snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path); if( (fp=fopen(filename,"r"))==NULL ){ ShowError("can't read %s\n", filename); return -1; } while(fgets(line, sizeof(line), fp)) { if(line[0] == '\n' || line[0] == '\r' || line[0] == ' ' || (line[0]=='/' && line[1]=='/')) continue; nameid = atoi(line); if(compareid == nameid) return 1; // Monster Blocked } fclose(fp); return 0; // Monster Accepted } Within ACMD_FUNC(monster) find: int mob_id; Replace with: int mob_id, mB = 0; Find: if (mob_id == MOBID_EMPERIUM) { clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned. return -1; } After add: if(pc_get_group_level(sd) < 99 && (mB = monsterBlock(mob_id))) if(mB == 1){ clif_displaymessage(fd, "Acess_Restriction: Administrator restricted this monster from being called by @monster direct command."); return -1; } Go to db path and create a file called: monster_block.txt Put into it ID from monsters you want to block, like this: //Comments 1001 //Scorpion 1002 1003 //etc -------------------------------------------------------------------------------------------------------- Admin level 99 can still summon any monster, if you don't want it change it: if(pc_get_group_level(sd) < 99 && (mB = monsterBlock(mob_id))) To: if((mB = monsterBlock(mob_id))) Hi MarkZD Pls adivse where i must pu Before add: thanks Quote
MarkZD Posted August 4, 2012 Posted August 4, 2012 (edited) Before the found part: HERE /*========================================== * *------------------------------------------*/ ACMD_FUNC(monster) { char name[NAME_LENGTH]; char monster[NAME_LENGTH]; char eventname[EVENT_NAME_LENGTH] = ""; int mob_id; int number = 0; Edited August 4, 2012 by MarkZD Quote
GM Incarnation Posted August 5, 2012 Posted August 5, 2012 Hi MarkZD what u mean by Here pls advise more detail because got error when i compile Or u can help me to combine all in 1 script. Thanks Pls advise. Quote
Euphy Posted August 5, 2012 Posted August 5, 2012 MarkZD already provided a very clear explanation on how to add this modification. http://rathena.org/wiki/Diff Quote
GM Incarnation Posted August 6, 2012 Posted August 6, 2012 Hi Euphy Here the error please advise Quote
Limestone Posted August 6, 2012 Posted August 6, 2012 i think he still uses ea.. if ea.. change the pc_get_group_level to pc_isGM. Quote
GM Incarnation Posted August 13, 2012 Posted August 13, 2012 Hi Rage Still got error pls advise Please adivse this error thanks. Quote
Limestone Posted August 13, 2012 Posted August 13, 2012 (edited) remove the "DBPATH" on "%s/"DBPATH"monster_block.txt", db_path); Edited August 13, 2012 by Rage Quote
GM Incarnation Posted August 15, 2012 Posted August 15, 2012 remove the "DBPATH" on "%s/"DBPATH"monster_block.txt", db_path); Hi Rage Can u explain more detail Thanks Quote
MarkZD Posted August 16, 2012 Posted August 16, 2012 Change this line from the code I posted above: snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path); To this: snprintf(filename, 255, "%s/monster_block.txt", db_path); And recompile. Quote
Question
jedwynne
is there any way i could disable a specific monster in @commands. for example you cant summon a poring using @monster poring. if it possible, how?
15 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.