Jump to content
  • 0
Timokha

Kill monster loop event within specific area

Question

Hi all,

 

I'd like to write the script, that will kill all monster (except for 2-3 IDs) with 2-3 cells area around NPC.

Do anyone have idea how it should look like?

 

I prepared loop event, but dont know how can I write auto-killing monster within this area..

 

Quote

map_name,200,214,5    script    test    4_M_JOB_KNIGHT1,{
end;

 

OnInit:
startnpctimer;
.@interval = 1;
    while    (1)    {
sleep .@interval * 1000;
getmapxy .@map$,.@x,.@y, 1;// XY npc sample
for ( .@i = -4; .@i <= 4; .@i++ )// x
for ( .@j = -4; .@j <= 4; .@j++ )// y

????

????
}
initnpctimer;
end;

}

Thank you. 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

You can use OnTouchNPC.

map_name,200,214,5	script	test	4_M_JOB_KNIGHT1,3,3,{
	end;

//Will trigger when a monster gets close
OnTouchNPC:

	//gets the monster ID
	.@mob_id = getunitdata(mobattached(), UDT_CLASS);
	
	//checking if it's not a Poring, Zombie or Orc Warrior
	if (.@mob_id != 1002 && .@mob_id != 1015 && .@mob_id != 1023) {

		//kill the monster since it's not one of those
		killmonstergid mobattached();
	}
	
	end;
}

 

 

Share this post


Link to post
Share on other sites
  • 0
7 hours ago, Racaae said:

You can use OnTouchNPC.

map_name,200,214,5 script test 4_M_JOB_KNIGHT1,3,3,{ end; //Will trigger when a monster gets close OnTouchNPC: //gets the monster ID .@mob_id = getunitdata(mobattached(), UDT_CLASS); //checking if it's not a Poring, Zombie or Orc Warrior if (.@mob_id != 1002 && .@mob_id != 1015 && .@mob_id != 1023) { //kill the monster since it's not one of those killmonstergid mobattached(); } end; }

 

Thank you Racaae, highly appreciate your help!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.