Jump to content
  • 0

Kill Count Command


Question

Posted

Hi ! I would like to request for a script that counts mob kills .. 

 @killcount <mob id> or @killcount <mobname>
 

For example. @killcount 1002 / @killcount Poring or poring (not case sensitive) . Everytime I kill poring a bottom message will show on my bottom chat saying "Poring kill: <number of kills>" .. When I type @killcount without monster name or ID it should show "Killed Porings: <kill count>" ..With @killcount reset function. Thanks 

4 answers to this question

Recommended Posts

  • 1
Posted
On 9/16/2021 at 7:30 AM, Eross said:

How about making it up to max 5 mob id ???

-	script	atcmd_example	-1,{
OnInit:
	.max_slot = 5;
	bindatcmd "killcount", strnpcinfo(3) + "::OnAtcommand";
	end;
	
OnAtcommand:
	if (compare(.@atcmd_parameters$[0], "reset")) {
		if (.@atcmd_parameters$[1] == "all") {
			for (.@i = 0; .@i < .max_slot; .@i++)
				dispbottom .@atcmd_command$+" removed "+getmonsterinfo(#killcount_mob_id[.@i], MOB_NAME)+" from slot "+.@i+" successfully.";
			deletearray #killcount_mob_id;
			deletearray #killcount_amount;
		}
		else if (.@atcmd_parameters$[1] != "") {
			.@index = atoi(.@atcmd_parameters$[1]);
			if (.@index < 0 || .@index >= .max_slot) {
				dispbottom .@atcmd_command$+" invalid slot #"+.@index+" (min = 0, max = "+.max_slot+").";
				end;
			}
		}
		else {
			dispbottom .@atcmd_command$+" removed "+getmonsterinfo(#killcount_mob_id[.@index], MOB_NAME)+" from slot "+.@index+" successfully.";
			#killcount_mob_id[.@index] = 0;
			#killcount_amount[.@index] = 0;
		}
		#killcount_mob_id$ = "#";
		for (.@i = 0; .@i < .max_slot; .@i++)
			#killcount_mob_id$ = #killcount_mob_id$ + #killcount_mob_id[.@i] + "#";
	}
	else if (getmonsterinfo(atoi(.@atcmd_parameters$[0]), MOB_NAME) != "null") {
		.@killcount_mob_id = atoi(.@atcmd_parameters$[0]);
		if (.@atcmd_parameters$[1] != "") {
			.@index = atoi(.@atcmd_parameters$[1]);
			if (.@index < 0 || .@index >= .max_slot) {
				dispbottom .@atcmd_command$+" invalid slot #"+.@index+" (min = 0, max = "+.max_slot+").";
				end;
			}
		}
		
		.@temp_index = inarray(#killcount_mob_id, .@killcount_mob_id);
		if (.@temp_index != -1) {
			dispbottom .@atcmd_command$+" already registerd "+getmonsterinfo(#killcount_mob_id[.@temp_index], MOB_NAME)+" at slot "+.@temp_index+" with current "+F_InsertComma(#killcount_amount[.@index])+" kills.";
			end;
		}
		
		if (.@killcount_mob_id != #killcount_mob_id) {
			#killcount_mob_id[.@index] = .@killcount_mob_id;
			#killcount_amount[.@index] = 0;
			dispbottom .@atcmd_command$+" registered "+getmonsterinfo(#killcount_mob_id[.@index], MOB_NAME)+" at slot "+.@temp_index+", will start counting.";
		}
		#killcount_mob_id$ = "#";
		for (.@i = 0; .@i < .max_slot; .@i++)
			#killcount_mob_id$ = #killcount_mob_id$ + #killcount_mob_id[.@i] + "#";
	}
	else if (compare(.@atcmd_parameters$[0], "list")) {
		for (.@i = 0; .@i < .max_slot; .@i++)
			dispbottom getmonsterinfo(#killcount_mob_id[.@i], MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount[.@i]);
	}
	else {
		dispbottom .@atcmd_command$+" failed. Usage: "+.@atcmd_command$+" <list|reset|mob_id> {slot}";
	}
	end;
	
OnNPCKillEvent:
	.@killedrid = killedrid;
	if (compare(#killcount_mob_id$, "#"+.@killedrid+"#")) {
		.@index = inarray(#killcount_mob_id, .@killedrid);
		#killcount_amount[.@index]++;
		dispbottom getmonsterinfo(.@killedrid, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount[.@index]);
	}
	end;
}

 

  • 0
Posted
-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "killcount", strnpcinfo(3) + "::OnAtcommand";
	end;
	
OnAtcommand:
	if (compare(.@atcmd_parameters$, "reset")) {
		#killcount_mob_id = 0;
		#killcount_amount = 0;
		dispbottom .@atcmd_command$+" reset successfully.";
	}
	else if (getmonsterinfo(atoi(.@atcmd_parameters$), MOB_NAME) != "null") {
		.@killcount_mob_id = atoi(.@atcmd_parameters$);
		if (.@killcount_mob_id != #killcount_mob_id) {
			#killcount_mob_id = .@killcount_mob_id;
			#killcount_amount = 0;
			dispbottom .@atcmd_command$+" will start count "+getmonsterinfo(#killcount_mob_id, MOB_NAME)+".";
		}
	}
	else if (#killcount_mob_id) {
		dispbottom getmonsterinfo(#killcount_mob_id, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount);
	}
	else {
		dispbottom .@atcmd_command$+" failed. Usage: "+.@atcmd_command$+" <mob_id/reset>";
	}
	end;
	
OnNPCKillEvent:
	if (killedrid == #killcount_mob_id) {
		#killcount_amount++;
		dispbottom getmonsterinfo(#killcount_mob_id, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount);
	}
	end;
}

 

  • Upvote 3
  • 0
Posted
6 hours ago, Emistry said:
-	script	atcmd_example	-1,{
OnInit:
	bindatcmd "killcount", strnpcinfo(3) + "::OnAtcommand";
	end;
	
OnAtcommand:
	if (compare(.@atcmd_parameters$, "reset")) {
		#killcount_mob_id = 0;
		#killcount_amount = 0;
		dispbottom .@atcmd_command$+" reset successfully.";
	}
	else if (getmonsterinfo(atoi(.@atcmd_parameters$), MOB_NAME) != "null") {
		.@killcount_mob_id = atoi(.@atcmd_parameters$);
		if (.@killcount_mob_id != #killcount_mob_id) {
			#killcount_mob_id = .@killcount_mob_id;
			#killcount_amount = 0;
			dispbottom .@atcmd_command$+" will start count "+getmonsterinfo(#killcount_mob_id, MOB_NAME)+".";
		}
	}
	else if (#killcount_mob_id) {
		dispbottom getmonsterinfo(#killcount_mob_id, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount);
	}
	else {
		dispbottom .@atcmd_command$+" failed. Usage: "+.@atcmd_command$+" <mob_id/reset>";
	}
	end;
	
OnNPCKillEvent:
	if (killedrid == #killcount_mob_id) {
		#killcount_amount++;
		dispbottom getmonsterinfo(#killcount_mob_id, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount);
	}
	end;
}

 

Thankyou sir !!! I will try this later ... One more question .. How about making it up to max 5 mob id ??? like for example I type @killcount Poring and @killcount Fabre and 3 other they all work but on 6th it should say , @killcount max is 5 only . with @killcount reset 1 to 5 ,,and @killcount will show 5 mobs ..Thankyou sir 

  • 0
Posted
On 3/6/2022 at 5:11 PM, Emistry said:
-	script	atcmd_example	-1,{
OnInit:
	.max_slot = 5;
	bindatcmd "killcount", strnpcinfo(3) + "::OnAtcommand";
	end;
	
OnAtcommand:
	if (compare(.@atcmd_parameters$[0], "reset")) {
		if (.@atcmd_parameters$[1] == "all") {
			for (.@i = 0; .@i < .max_slot; .@i++)
				dispbottom .@atcmd_command$+" removed "+getmonsterinfo(#killcount_mob_id[.@i], MOB_NAME)+" from slot "+.@i+" successfully.";
			deletearray #killcount_mob_id;
			deletearray #killcount_amount;
		}
		else if (.@atcmd_parameters$[1] != "") {
			.@index = atoi(.@atcmd_parameters$[1]);
			if (.@index < 0 || .@index >= .max_slot) {
				dispbottom .@atcmd_command$+" invalid slot #"+.@index+" (min = 0, max = "+.max_slot+").";
				end;
			}
		}
		else {
			dispbottom .@atcmd_command$+" removed "+getmonsterinfo(#killcount_mob_id[.@index], MOB_NAME)+" from slot "+.@index+" successfully.";
			#killcount_mob_id[.@index] = 0;
			#killcount_amount[.@index] = 0;
		}
		#killcount_mob_id$ = "#";
		for (.@i = 0; .@i < .max_slot; .@i++)
			#killcount_mob_id$ = #killcount_mob_id$ + #killcount_mob_id[.@i] + "#";
	}
	else if (getmonsterinfo(atoi(.@atcmd_parameters$[0]), MOB_NAME) != "null") {
		.@killcount_mob_id = atoi(.@atcmd_parameters$[0]);
		if (.@atcmd_parameters$[1] != "") {
			.@index = atoi(.@atcmd_parameters$[1]);
			if (.@index < 0 || .@index >= .max_slot) {
				dispbottom .@atcmd_command$+" invalid slot #"+.@index+" (min = 0, max = "+.max_slot+").";
				end;
			}
		}
		
		.@temp_index = inarray(#killcount_mob_id, .@killcount_mob_id);
		if (.@temp_index != -1) {
			dispbottom .@atcmd_command$+" already registerd "+getmonsterinfo(#killcount_mob_id[.@temp_index], MOB_NAME)+" at slot "+.@temp_index+" with current "+F_InsertComma(#killcount_amount[.@index])+" kills.";
			end;
		}
		
		if (.@killcount_mob_id != #killcount_mob_id) {
			#killcount_mob_id[.@index] = .@killcount_mob_id;
			#killcount_amount[.@index] = 0;
			dispbottom .@atcmd_command$+" registered "+getmonsterinfo(#killcount_mob_id[.@index], MOB_NAME)+" at slot "+.@temp_index+", will start counting.";
		}
		#killcount_mob_id$ = "#";
		for (.@i = 0; .@i < .max_slot; .@i++)
			#killcount_mob_id$ = #killcount_mob_id$ + #killcount_mob_id[.@i] + "#";
	}
	else if (compare(.@atcmd_parameters$[0], "list")) {
		for (.@i = 0; .@i < .max_slot; .@i++)
			dispbottom getmonsterinfo(#killcount_mob_id[.@i], MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount[.@i]);
	}
	else {
		dispbottom .@atcmd_command$+" failed. Usage: "+.@atcmd_command$+" <list|reset|mob_id> {slot}";
	}
	end;
	
OnNPCKillEvent:
	.@killedrid = killedrid;
	if (compare(#killcount_mob_id$, "#"+.@killedrid+"#")) {
		.@index = inarray(#killcount_mob_id, .@killedrid);
		#killcount_amount[.@index]++;
		dispbottom getmonsterinfo(.@killedrid, MOB_NAME)+" Kill: "+F_InsertComma(#killcount_amount[.@index]);
	}
	end;
}

 

hello @Emistry somethings wrong with this script. when i listed 5 mobs, everytime i register a mob it would say i am adding it to slot #-1.
Numbering is also very confusing. shouldn't it be 1 to 5? script thinks its #0 to #4.

image.png.7fcfa903350156d3e9410019a47114a6.png

 

also @killcount reset only erases slot #0.
nothing happens if i try:
@killcount reset 0
@killcount reset 1
@killcount reset 2
@killcount reset 3
@killcount reset 4

I can only delete the first registered mob with @killcount reset
image.png.9268556e877c265bc02f9d95e54f38be.png

i can't erase 1 by 1. have to remove all using @killcount reset all which works.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...