This event fires when a unit starts attacking. Use "Attacking Unit" or "Triggering Unit" to get the attacker. Use "Triggering Player" to get the owner of the attacker.

I know how to get the attacker, but how do I get that is targeted by the attacker?

This is what I've done so far (see attachment). It gets the unit that is going to be hit by Lurker attack and moves it away.

The problem is that it only moves the unit that is going to be hit by the Lurker's attack and it does not move the other nearby units that will be affected by the Lurker's attack. Is there a solution to solve this problem?

Thanks for the advice. I know how to find the angles of the zerglings (btw, angles are from -180 to 180, not 0 to 360), I don't think I need a loop for that. But indeed it's a good idea to find the largest difference.

I'm trying to do it noww, but I'm not exactly sure how.

Will work on it maybe tomorrow. I made a video featuring my marine bot ()

The strange thing that happens everytime I run 15 Marines vs 50 Zerglings is that sometimes the Marines win by a narrow margin, sometimes the Zerglings win by a narrow margin, and a few times, the Zerglings win very one-sidedly. So that's a bit odd.

After thinking about it for a while, I think I need to change the equation to something else that is more accurate and reliable, especially for more than 2 zerglings. For more than 2 zerglings, there are many unexpected things that can happen. For example:

That's just one example. There are many other glitches when there are more than 2 nearby zerglings.

EDIT:

I just saw your new post. I think that changing the equation is still the way to go.

Could you elaborate on "divide the angles around the marine to a certain number of equal spaces and see which zerglings fall into these spaces."? I don't quite understand it, maybe a pic?

The unit custom value was unnecessary, I thought that I would need it in future.

Basically the zerglings' opposite angles are the safe angles for each individual zergling. So I divide by the number of zerglings to get the average of these safe angles, and the marine will face this average angle (which is, in most cases, the safest angle)

Maybe it's easier to see visually:

By the way, by identifying the safe angle using my method, I came up with this little marine bot. Not the best one though, but still quite impressive. Attached below:

I'm not sure if this is better than the previous code (see previous post). It seems less glitchy when there are more than 2 zerglings but there are still a couple of glitches to fix. In your opinion, which code is preferred, the code in this post, or the code in the previous post?

(See my post above for the explanation for the "(Angle from (Position of (Picked unit)) to (Position of Marine))" part.)

This is the compilation of my Marine's behaviour:

As you can see, the Marine is acting very strangely when there are 3 Zerglings, but perfect when there are 2 Zerglings. Would appreciate it if someone can find a solution to the Marine's strange behaviour when there are 3 Zerlings.

0

@FunkyUserName: Go

Hmm... I'm not exactly sure on how to do it. Would you mind to provide the exact parameters?

0

Unit Starts AttackingThis event fires when a unit starts attacking. Use "Attacking Unit" or "Triggering Unit" to get the attacker. Use "Triggering Player" to get the owner of the attacker.I know how to get the attacker, but how do I get that is targeted by the attacker?

0

This is what I've done so far (see attachment). It gets the unit that is going to be hit by Lurker attack and moves it away.

The problem is that it only moves the unit that is going to be hit by the Lurker's attack and it does not move the other nearby units that will be affected by the Lurker's attack. Is there a solution to solve this problem?

0

How do I get the units that will be affected by Lurker attack (the hots lurker in the campaign)?

My first thought is to get the units in a line but I don't know how and where to start... anyone knows how?

0

@DaBernMon: Go

It doesn't. Will be great if there's a workaround to solve this issue, but I'm not in desperate need of it though.

0

@MaskedImposter: Go

I think your previous one (Angle from + Center of unit group) works the best. Check this out:

I think for a (sort of) kiting AI, that is good enough.

0

@DaBernMon: Go

Thanks for the advice. I know how to find the angles of the zerglings (btw, angles are from -180 to 180, not 0 to 360), I don't think I need a loop for that. But indeed it's a good idea to find the largest difference.

I'm trying to do it noww, but I'm not exactly sure how.

EDIT: Well, I tried but it somehow didnt work

0

Are there any other "better" ways to get the safe angle?

0

@MaskedImposter: Go

Wow, actually, yours seems pretty good. I haven't found any bugs so far. Good job.

EDIT 1:

Oops, I just found a bug:

By the way, I had edited the map such that the Zerglings and the Marine all belong to me, makes it easier for testing.

0

@Trieva: Go

Will work on it maybe tomorrow. I made a video featuring my marine bot ()

The strange thing that happens everytime I run 15 Marines vs 50 Zerglings is that sometimes the Marines win by a narrow margin, sometimes the Zerglings win by a narrow margin, and a few times, the Zerglings win very one-sidedly. So that's a bit odd.

0

@Trieva: Go

Sounds like a really cool idea, but I'm not sure if it's possible, or if I am able to implement such a thing using the editor.

0

@Trieva: Go

After thinking about it for a while, I think I need to change the equation to something else that is more accurate and reliable, especially for more than 2 zerglings. For more than 2 zerglings, there are many unexpected things that can happen. For example:

That's just one example. There are many other glitches when there are more than 2 nearby zerglings.

EDIT:

I just saw your new post. I think that changing the equation is still the way to go.

Could you elaborate on "divide the angles around the marine to a certain number of equal spaces and see which zerglings fall into these spaces."? I don't quite understand it, maybe a pic?

0

@Trieva: Go

The unit custom value was unnecessary, I thought that I would need it in future.

Basically the zerglings' opposite angles are the safe angles for each individual zergling. So I divide by the number of zerglings to get the average of these safe angles, and the marine will face this average angle (which is, in most cases, the safest angle)

Maybe it's easier to see visually:

By the way, by identifying the safe angle using my method, I came up with this little marine bot. Not the best one though, but still quite impressive. Attached below:

0

Sorry for the spam :D but I found the most elegant method that is the least "glitchy". Here are the triggers:

Change Marine Angle Experimental:

And a function Get Opposite Angle:

I'm not sure if this is better than the previous code (see previous post). It seems less glitchy when there are more than 2 zerglings but there are still a couple of glitches to fix. In your opinion, which code is preferred, the code in this post, or the code in the previous post?

0

I modified my trigger and this works for 2 zerglings, with strange behaviour for 3 / 4 zerglings. This is so awesome :)

This is the full trigger now:

(See my post above for the explanation for the "(Angle from (Position of (Picked unit)) to (Position of Marine))" part.)

This is the compilation of my Marine's behaviour:

As you can see, the Marine is acting very strangely when there are 3 Zerglings, but perfect when there are 2 Zerglings. Would appreciate it if someone can find a solution to the Marine's strange behaviour when there are 3 Zerlings.