Jump to content
  • 0
Sign in to follow this  
neXus

Check if monster is attacking a player

Question

How can I be able to check if a monster is attacking a player?

I have this kind of script wherein if monster 1 is in idle or not attacking a player, the monster 2 will only receive 1 damage. But if the monster 1 is attacking a player, monster 2 will take a damage.

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0
*getunitdata <GID>,<arrayname>;
  UMOB_TARGETID

 

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
14 minutes ago, sader1992 said:
*getunitdata <GID>,<arrayname>;
  UMOB_TARGETID

 

@sader1992 But this one should be run by a script right and it will function only each time the player touches the npc.

The Monster 1 should have a target so that the monster 2 will be vulnerable because as soon as the Monster 1 become idle or not attacking a player, the Monster will be taking 1 damage only.

Edited by neXus

Share this post


Link to post
Share on other sites
  • 0

without src edit and creating a custom event for each time like on attack event (I don't recommend that ) You can't do Exactly what you are thinking of

however you can create a while loop that check all the GIDs of the mobs that you want to check (ofc don't forget the sleep in the while loop)

I would say once every 250~500 is good , just make sure that your scripts in the while loop cover all the exceptions like (unitexists <GID>;) 

Share this post


Link to post
Share on other sites
  • 0
14 minutes ago, sader1992 said:

without src edit and creating a custom event for each time like on attack event (I don't recommend that ) You can't do Exactly what you are thinking of

however you can create a while loop that check all the GIDs of the mobs that you want to check (ofc don't forget the sleep in the while loop)

I would say once every 250~500 is good , just make sure that your scripts in the while loop cover all the exceptions like (unitexists <GID>;) 

Ill try this one. Ill update you what happen

Share this post


Link to post
Share on other sites
  • 0
On 5/8/2020 at 3:14 AM, sader1992 said:
*getunitdata <GID>,<arrayname>;
  UMOB_TARGETID

 

@sader1992 I just tested it today and its working the way I want it to be. Thanks...

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

Sign in to follow this  

×
×
  • Create New...

Important Information

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