Jump to content
  • 0

Kill Count Command


Eross

Question


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

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 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

-	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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.11
  • Content Count:  349
  • Reputation:   12
  • Joined:  04/05/20
  • Last Seen:  

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 

Link to comment
Share on other sites

  • 1

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2345
  • Joined:  10/28/11
  • Last Seen:  

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

 

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...