Jump to content
  • 0

Check if monster is attacking a player


Question

Posted

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.

5 answers to this question

Recommended Posts

  • 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
  • 0
Posted

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

  • 0
Posted
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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...