SC2Mapster Forums

Development > Triggers

Filtering out cloaked and burrowed units?

  • 5 posts
    #1 Dec 19, 2012 at 06:35 UTC - 0 likes

    So I ran into a problem with my current project and I'm stuck. Been working on trigger variations for like 2 days and can't get it.

    What I want is for a computer army to attack the closest unit to it's base. Now that is a pretty simple trigger... What I had was this:

    Unit - Order all units in (Any units in (Entire map) owned by player Alpha matching 
    Excluded: Air, Structure, Missile, Dead, Hidden, Detector, with at most Any Amount) to 
    ( Attack targeting (Position of (Closest unit to SpawnPoint in (Any units in (Entire map) 
    owned by player Any Player matching Required: Visible; Excluded: Player, Ally, Neutral, Air, 
    Missile, Dead, Hidden, with at most Any Amount)))) (Replace Existing Orders)
    

    Now, the problem with this trigger is if the closest unit is like say, a burrowed roach, the computer units will just move to that position and sit there. I thought that using "Required: Visible" would filter out cloaked/burrowed units. However apparently that filter doesn't work that way, or perhaps it's because the way the trigger is setup it doesn't know which players visibility to check? Either way it doesn't work.

    The alternative I am using, is simply telling the units to attack toward the other base, however then the computer army will just ignore your units if your not in their direct attack path. Which is absolutely not what I want considering flanking will occur fairly often.

    Now, because the computer player can have detection sometimes, its important that cloaked/burrowed units are attacked if/when detection is around, and ignored the rest of the time.

    So does anyone know a way to filter out cloaked or burrowed units but only when there is no detection present? My current thought is to build it around 3-4 conditions like "closest unit has behavior burrowed" or unit filters checking for detectors. But I really don't think it needs to be that complex. Especially since this is a trigger that will be running fairly often to update the current objectives of the computers units.

    #2 Dec 19, 2012 at 06:41 UTC - 0 likes

    why not use the filters to exclude buried and cloaked?

    What will happen in that instance is they will not be the target of the initial order, but if your attack wave has detection and they are on the path of the attack order, they will be attacked

    Unit - Order All units to ( Attack targeting (Closest unit to Point in (Any units in Unit Group owned by player Any Player matching Excluded: Missile, Buried, Cloaked, Dead, Hidden, with at most Any Amount))) (Replace Existing Orders)
    
    Last edited Dec 19, 2012 by nevjmac

    Current Project: Community Project

    #3 Dec 19, 2012 at 07:14 UTC - 0 likes

    Hmm, that does seem reasonable. I guess I am just overly concerned with players flanking with 2-3 dt's and then the computer not responding to it.

    #4 Dec 19, 2012 at 08:03 UTC - 0 likes

    Alright, got it. Ty for help.

    Incase anyone in the future is looking for something similar, here is what I came up with.

            General - If (Conditions) then do (Actions) else do (Actions)
                If
                    (Number of Living units in (Any units in (Region((Position of (Closest unit to Point in (Any units in (Entire map) owned by player Beta matching Required: Visible; Excluded: Air, Missile, Dead, Hidden, with at most Any Amount))), 10.0)) owned by player Alpha matching Required: Detector; Excluded: Structure, Missile, Dead, Hidden, with at most Any amount)) >= 1
                Then
                    Unit - Order all units in (Any units in (Entire map) owned by player Computer North matching Excluded: Air, Structure, Missile, Buried, Cloaked, Dead, Hidden, Detector, with at most Any Amount) to ( Attack targeting (Position of (Closest unit to North in (Any units in (Entire map) owned by player Computer South matching Required: Visible; Excluded: Air, Missile, Dead, Hidden, with at most Any Amount)))) (Replace Existing Orders)
                Else
                    Unit - Order all units in (Any units in (Entire map) owned by player Alpha matching Excluded: Air, Structure, Missile, Dead, Hidden, Detector, with at most Any Amount) to ( Attack targeting Point) (Replace Existing Orders)
    

    So basically, checks the number of detectors owned by the computer withing 10 range of your closest unit, if it finds one it orders his units to attack any and all of the nearest units including cloaked/burrowed, if it doesn't find a detector withing range 10 of your closest unit it orders the computers units to attack toward the closest unit excluding burrowed/cloaked.

    I think that will work for now. If there is any vulnerability or exploitable nature of this trigger I don't immediately see it. It's working great so far. Thanks again for your help :)

    #5 Dec 19, 2012 at 09:37 UTC - 0 likes

    No worries, Glad to have helped

  • 5 posts

You must login to post a comment. Don't have an account? Register to get one!