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;
[email protected] = 1;
    while    (1)    {
sleep [email protected] * 1000;
getmapxy [email protected]$,[email protected],[email protected], 1;// XY npc sample
for ( [email protected] = -4; [email protected] <= 4; [email protected]++ )// x
for ( [email protected] = -4; [email protected] <= 4; [email protected]++ )// 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 [email protected]_id = getunitdata(mobattached(), UDT_CLASS); //checking if it's not a Poring, Zombie or Orc Warrior if ([email protected]_id != 1002 && [email protected]_id != 1015 && [email protected]_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

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

  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.

Loading...

×
×
  • Create New...

Important Information

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