Jump to content
  • 0
Alayne

Determine when a mob's died

Question

Hi peoples,

I'm currently working on a bunch of instances. 

For one of those, I have to pop a certain amount of monsters, which can then pop a skill on a boss one.

For that, when invoking those monsters, I get their ideas from areamonster command's output, store them in a custom array, and use those as base for a unitskill. The problem is that when one of monsters died, I then got an error on unitskill command cause the mob's dead, and therefor, not available for command application.

So I'd like to clean the array when a mobs died. but I can't find a way to get the GID of a monster that died to pop it out of the array, killedrid in the NPCKillEvent being the monster's class.

Is there's a way to do so?

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

right before using unitskill() you could call getmapxy() with GID of the mob. If the GID is not found the command will return -1 (while it returns 0 on success). If it returns -1 you would then call deletearray() to remove it from the array while shifting; You can also use the array manipulation function, namely array_shift()

 

Share this post


Link to post
Share on other sites
  • 0

As meko is correct, this script command wouldnt be more appropiate?

areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, <skill id>, <skill level>, <cast time>, <cancelable>, <emotion>, <target type>)
*areamobuseskill("<map name>", <x>, <y>, <range>, <mob id>, "<skill name>", <skill level>, <cast time>, <cancelable>, <emotion>, <target type>)

This command will make all monsters of the specified mob ID in the 
specified area use the specified skill. Map name, x, and y define the 
center of the area, which extending <range> cells in each direction (ex: a 
range of 3 would create a 7x7 square). The skill can be specified by skill 
ID or name. <cast time> is in milliseconds (1000 = 1 second), and the rest 
should be self-explanatory. 

<target type> can be: 
	0 = self
	1 = the mob's current target
	2 = the mob's master
	3 = random target

Example:

	// spawn 1 Shining Plant in the 5x5 area centered on (155,188)
	areamonster("prontera", 153, 186, 157, 190, "Shining Plant", SHINING_PLANT, 1);
	// make the plant cast level 10 Cold Bolt on a random target
	areamobuseskill("prontera", 155, 188, 2, SHINING_PLANT, MG_COLDBOLT, 10, 3000, 1, e_gg, 3)

 

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.