Jump to content
  • 0

Check if monster is attacking a player


Reborn

Question


  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

*getunitdata <GID>,<arrayname>;
  UMOB_TARGETID

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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

  • 0

  • Group:  Content Moderator
  • Topic Count:  55
  • Topics Per Day:  0.02
  • Content Count:  1676
  • Reputation:   702
  • Joined:  12/21/14
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  104
  • Topics Per Day:  0.03
  • Content Count:  290
  • Reputation:   3
  • Joined:  09/29/13
  • Last Seen:  

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

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