• 0

    posted a message on Get target unit for "Unit Starts Attacking" event

    @FunkyUserName: Go

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

    Posted in: Triggers
  • 0

    posted a message on Get target unit for "Unit Starts Attacking" event

    Unit Starts Attacking

    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?

    Posted in: Triggers
  • 0

    posted a message on Gets units that will be affected by Lurker attack?

    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?

    Posted in: Triggers
  • 0

    posted a message on Gets units that will be affected by Lurker attack?

    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?

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @MaskedImposter: Go

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

    Embed Removed: https://www.youtube.com/v/mHbloVZ15Pc?fs=1

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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @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:

    http://i.imgur.com/mPVq7gV.png

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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @Trieva: Go

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

    Embed Removed: https://www.youtube.com/v/SZawUuAccnc?fs=1

    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.

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

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

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @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:

    http://i.imgur.com/jTiGfgG.png

    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?

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    @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:

    http://i.imgur.com/o55aswL.png

    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:

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    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:

    Change Marine Angle Experimental
        Events
            Timer - Every 0.1 seconds of Game Time
        Local Variables
            nearby units = (Empty unit group) <Unit Group>
            number of nearby units = 0 <Integer>
            nearby units angles = 0.0 <Real>
            angle = 0.0 <Real>
        Conditions
        Actions
            Variable - Set nearby units = (Zergling units in (Region((Position of Marine), 3.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
            Variable - Set number of nearby units = (Number of Living units in nearby units)
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    number of nearby units == 0
                Then
                    Variable - Set angle = -90.0
                    Handle Marine Angle(angle)
                    General - Skip remaining actions
                Else
            Unit Group - Pick each unit in nearby units and do (Actions)
                Actions
                    Unit - Set (Picked unit) custom value 0 to (Angle from (Position of Marine) to (Position of (Picked unit)))
                    Variable - Set nearby units angles = (nearby units angles + (Get Opposite Angle((Angle from (Position of Marine) to (Position of (Picked unit))))))
            Variable - Set angle = (nearby units angles / number of nearby units)
            Handle Marine Angle(angle)
    

    And a function Get Opposite Angle:

    Get Opposite Angle
        Options: Function
        Return Type: Real
        Parameters
            Angle = 0.0 <Real>
        Grammar Text: Get Opposite Angle(Angle)
        Hint Text: (None)
        Custom Script Code
        Local Variables
            return value = 0.0 <Real>
        Actions
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    Angle <= 0.0
                    Angle >= -180.0
                Then
                    Variable - Set return value = (Angle + 180.0)
                Else
                    Variable - Set return value = (Angle - 180.0)
            General - Return return value
    

    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?

    Posted in: Triggers
  • 0

    posted a message on Darglein's Marine AI - How to find the safest angle for a Marine to face?

    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:

    Change Marine Angle
        Events
            Timer - Every 0.1 seconds of Game Time
        Local Variables
            nearby units = (Empty unit group) <Unit Group>
            number of nearby units = 0 <Integer>
            nearby units angles = 0.0 <Real>
            angle = 0.0 <Real>
        Conditions
        Actions
            Variable - Set nearby units = (Zergling units in (Region((Position of Marine), 2.0)) owned by player Any Player matching Excluded: Missile, Dead, Hidden, with at most Any Amount)
            Variable - Set number of nearby units = (Number of Living units in nearby units)
            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    number of nearby units == 0
                Then
                    Variable - Set angle = -90.0
                    Handle Marine Angle(angle)
                    General - Skip remaining actions
                Else
            Unit Group - Pick each unit in nearby units and do (Actions)
                Actions
                    Unit - Set (Picked unit) custom value 0 to (Angle from (Position of (Picked unit)) to (Position of Marine))
                    Variable - Set nearby units angles = (nearby units angles + (Angle from (Position of (Picked unit)) to (Position of Marine)))
            Variable - Set angle = (nearby units angles / number of nearby units)
            Handle Marine Angle(angle)
    

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

    Posted in: Triggers
  • To post a comment, please or register a new account.