• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] *Solved* Editing a filtering sytem

Hello Hive,

I was wondering if someone knew how to update the below system to make a "non structure" filter that is separate from the "organic" filter? Meaning that a spell using this system could be configured to target both organic and mechanical units but not structures.


edit: The end goal is to make a chain lightning style spell that gains bounces if certain conditions on the current target are met using the attached system, which is not mine but I can't figure out where I got it from to link to it.
 

Attachments

  • Chain.w3x
    48.1 KB · Views: 5
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
In the Sleight of Fist code you can see the filters are initialized inside of the onInit() function at the very bottom:
vJASS:
        private static method onInit takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
            call TriggerAddCondition(t, Condition(function thistype.onCast))
            set t = null
          
            set cp = ChainPriority.create()
            /*
            *   Sample Target Priority
            *   Heroes are picked first, if the chain can't find any hero,
            *   it tries to pick non-heroes
            */
            set cp.next = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO
            set cp.next = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_NON_HERO
        endmethod
FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO
FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_NON_HERO


Both of these would need to be customized to include whatever you want. Here are the filters you have available:
vJASS:
 - These are the filters available:
    *
    *    FS_UNIT_ENEMY
    *    FS_UNIT_ALLY
    *    FS_UNIT_ALIVE
    *    FS_UNIT_DEAD
    *    FS_UNIT_ORGANIC
    *    FS_UNIT_STRUCTURE
    *    FS_UNIT_MECHANICAL
    *    FS_UNIT_HERO
    *    FS_UNIT_NON_HERO
    *    FS_UNIT_IMMUNE        //magic immunity, ofcourse!
    *    FS_UNIT_NON_IMMUNE    
    *    FS_UNIT_SUMMONED      
    *    FS_UNIT_NON_SUMMONED    
    *    FS_UNIT_VISIBLE      
    *    FS_UNIT_INVISIBLE    
    *    FS_UNIT_WARD      
    *    FS_UNIT_NON_WARD  
    *    FS_UNIT_ANCIENT      
    *    FS_UNIT_NON_ANCIENT    
    *    FS_UNIT_GROUND        
    *    FS_UNIT_FLYING        
    *    FS_UNIT_MELEE        
    *    FS_UNIT_RANGED        
    *    FS_UNIT_UNDEAD
    *    FS_UNIT_NON_UNDEAD
    *
    *    FS_ITEM_OWNED      
    *    FS_ITEM_NON_OWNED      
    *    FS_ITEM_RUNE        //includes runes, tomes, powerups, etc.
    *    FS_ITEM_NON_RUNE  
    *    FS_ITEM_SELLABLE    
    *    FS_ITEM_NON_SELLABLE    
    *    FS_ITEM_PAWNABLE        
    *    FS_ITEM_NON_PAWNABLE
    *    FS_ITEM_PERMANENT    
    *    FS_ITEM_NON_PERMANENT  
    *    FS_ITEM_CHARGED      
    *    FS_ITEM_NON_CHARGED  
    *    FS_ITEM_POWERUP      
    *    FS_ITEM_NON_POWERUP  
    *    FS_ITEM_ARTIFACT    
    *    FS_ITEM_NON_ARTIFACT  
    *    FS_ITEM_PURCHASABLE    
    *    FS_ITEM_NON_PURCHASABLE  
    *    FS_ITEM_CAMPAIGN        
    *    FS_ITEM_NON_CAMPAIGN    
    *    FS_ITEM_MISC            
    *    FS_ITEM_NON_MISC      
    *    FS_ITEM_VISIBLE      
    *    FS_ITEM_HIDDEN
    *
    *    FS_PLAYER_ENEMY      
    *    FS_PLAYER_ALLY      
    *    FS_PLAYER_USER    
    *    FS_PLAYER_COMPUTER  
    *    FS_PLAYER_PLAYING  
    *    FS_PLAYER_LEFT     //also includes non-used slots.
    *    FS_PLAYER_NEUTRAL    
    *    FS_PLAYER_NON_NEUTRAL
    *    FS_PLAYER_VISION       //shared vision.
    *    FS_PLAYER_NON_VISION
    *    FS_PLAYER_CONTROL        //shared unit control.
    *    FS_PLAYER_NON_CONTROL
 
In the Sleight of Fist code you can see the filters are initialized inside of the onInit() function at the very bottom:
vJASS:
        private static method onInit takes nothing returns nothing
            local trigger t = CreateTrigger()
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT)
            call TriggerAddCondition(t, Condition(function thistype.onCast))
            set t = null
          
            set cp = ChainPriority.create()
            /*
            *   Sample Target Priority
            *   Heroes are picked first, if the chain can't find any hero,
            *   it tries to pick non-heroes
            */
            set cp.next = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO
            set cp.next = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_NON_HERO
        endmethod
FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO
FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_NON_HERO


Both of these would need to be customized to include whatever you want.
Not quite what I meant. If you look at the filtering system I linked there isn't a FS_UNIT_NON_STRUCTURE option which is what I want to add.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I tried that and it hits nothing
Alright, try this then, I updated the Filter code to include FS_UNIT_NON_STRUCTURE
vJASS:
//TESH.scrollpos=174
//TESH.alwaysfold=0
 library FilteringSystem /* v3.4.0 */ 
    /*
    ************************************************************************************************************************
    *        Filtering System's API v3.4.0
    *        by The Wrecker
    *
    *        Credits:
    *               - God : God supports anyone.
    *               - Nestharus : Algorithm of this system is
    *                 shaped in time by ideas of him, and as you
    *                 see, the algorithm is perfect; many other
    *                 thanks to him for many other useful hints.
    *                 THIS SYSTEM OWES ITS QUALITY TO Nestharus.
    *               - Magtheridon96 : His hints made the way
    *                 to create this system easier and more
    *                 efficient, many thanks to him. His
    *                 advocacy for this system was awesome:
    *                 [url]http://www.hiveworkshop.com/forums/jass-resources-412/filtering-system-240887/index7.html#post2471786[/url]
    *
    *                    by TheWrecker
    *
    *        [url]http://www.hiveworkshop.com/forums/jass-resources-412/filtering-system-240887/[/url]
    *
    *    Contents:
    *
    *        - Functions
    *        - How to use Filters
    *        - How to use Filtering System
    *        - Settings
    *        - Full Example
    *        - Side Functions
    *        - Constants (filters)
    *
    ************************************************************************************************************************
    *    Functions:
    *
    *        - function UnitFilter takes unit whichUnit, player whichPlayer, integer filter returns boolean
    *
    *            + It will check if 'whichUnit' meets given conditions or not.
    *            + 'whichPlayer' is only required when Alliance and Visibility filters
    *              are applied and must be passed 'null' when not using Alliance and
    *              Visibility filters.
    *            + 'filter' is an integer explained in section "How to use Filters".
    * 
    *        - function ItemFilter takes item whichItem, integer filter returns boolean
    *
    *            + It checks if 'whichItem' passes given filters or not.
    *            + 'filter' is an integer explained in section "How to use Filters".
    *
    *        - function PlayerFilter takes player whichPlayer, player otherPlayer, integer filter returns boolean
    *
    *            + It checks whether 'whichPlayer' meets given filters or not.
    *            + 'otherPlayer' is the other player used to check two-player related
    *              filters: Shared Units, Shared Vision, Alliance.
    *              if not using the above filters, you can pass 'null' as 'otherPlayer'.
    *            + 'filter' is an integer explained in section "How to use Filters".
    *
    ************************************************************************************************************************
    *    How to use Filters:
    *
    *        - 'filter' is an hexadecimal integer which is made like this:
    *            Filter1 + Filter2 + Filter3 + ...
    *                + You don't have to do any mathematics, only type your
    *                  desired filters' names like above.
    *
    *        - Filters in Filtring System are in 3 groups: Unit, Item, Player.
    *            + Use each group only with its related filtering function.
    *
    *        - Filter rules are as below:
    *            <Filter1 and Filter2 are opposites like Dead and Alive>
    *            + Filter1: Units matching it will pass.
    *            + Filter1 + Filter 2: NO UNIT WILL PASS.
    *            + nothing: All units will pass.
    *            + If you didn't get what above means take a look to section
    *              "Full Example"
    *
    ************************************************************************************************************************
    *    How to use Filtering System:
    *
    *        - vJass and Jass:
    *            + A simple line:
    *                if [Unit/Player/Item]Filter(argument1,argument2[if exists],'filter') then
    *                //Scripts
    *                endif
    *
    *        - GUI:
    *            + A Custom Script (New Action -> General -> Custom Script) line:
    *                Custom Script : if [Unit/Player/Item]Filter(argument1,argument2[if exists],'filter') then
    *                //Scripts
    *                Custom Script : endif
    *
    ************************************************************************************************************************
    *    Settings:
    *
    *        - Ward and Dummy classificators:
    *
    * */globals/*
    * 
    *           CONFIGURABLE PART
    * 
    *     */
            constant integer ABILITY_WARD_CLASSIFIER = 'Alit'/*
    *       This system checks for a spell to realize the fact that a unit is
    *       a ward or not, because perhaps you add a ward classification to a unit
    *       to remove its spell icons, but that unit is not really a ward, so instead
    *       of checking for classification we use a spell to define ward classification;
    *       change it to your desired spell or leave it as it is.
    *     
    *     */
            constant integer ABILITY_DUMMY_CLASSIFIER = 'Aloc'/*
    *       This system checks for a spell to realize the fact that a unit is
    *       a dummy or not, change this to your desired spell or leave it as it is, note
    *       that this system doesn't do anything about dummies, in fact when it finds this
    *       spell in a unit, it completely ignores that unit and that unit will not pass
    *       the filtering, so if you want a specific unit to not pass this filtering, add
    *       this spell to it.
    *     
    *           END OF CONFIGURABLE PART
    *
    ************************************************************************************************************************
    *    Full Example:
    *
    *        - Alive, enemy ranged heroes:
    *            + if UnitFilter(Target,Caster,FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO + FS_UNIT_RANGED) then
    *            + NOTE : ORDER OF FILTERS IS NOT IMPORTANT.
    *
    *        - Non-Summoned undead units:
    *            + if UnitFilter(Target,null,FS_UNIT_UNDEAD + FS_UNIT_NON_SUMMONED) then
    *
    *        - All units:
    *            + if UnitFilter(Target,null,0) then
    *            + Pay attention to zero (0).
    *
    *        - No unit:
    *            + if UnitFilter(Target,null,FS_UNIT_ALIVE + FS_UNIT_DEAD) then
    *            + 'FS_UNIT_HERO + FS_UNIT_NON_HERO','FS_UNIT_ALLY + FS_UNIT_ENEMY' and
    *              other opposites can be placed as 'FS_UNIT_ALIVE + FS_UNIT_DEAD'.
    *
    *        - Ally computer players with shared vision:
    *            + if PlayerFilter(Player1,Player2,FS_PLAYER_ALLY + FS_PLAYER_COMPUTER + FS_PLAYER_VISION) then
    *
    *        - Sellable, Campaign class items which are not owned:
    *            + if ItemFilter(Item,FS_ITEM_SELLABLE + FS_ITEM_CAMPAIGN + FS_ITEM_NON_OWNED) then
    *
    ************************************************************************************************************************
    *    Side Functions:
    *
    *        Because of the unique algorithm of this system, there are unpredicted functions
    *        that this system can have, one of them is known and others may be found later.
    *
    *            - Mixing the filters into single filter (Constraints):
    *              (found by Magtheridon96)
    *
    *                This is the method of mixing some filters and converting them into a
    *                single filter to use that single filter instead of using many filters
    *                more and more again. An example should show you the way:
    *             
    *                    integer USUAL = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_ORGANIC
    *
    *                this way, you will type in 'USUAL' everytime your filter contain these
    *                three filters instead of typing all three of them.
    *
    *                    + Be sure that no filter is repeated two times in a single
    *                      constraint.
    *                    + If sum of some constraints contain repeated filters, be sure
    *                      to substract that filter until there is only one filter of that
    *                      type left, an example is needed:
    *
    *                          USUAL = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_ORGANIC
    *                          HERO_2 = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_IMMUNE
    *                          UNDEAD_9 = FS_UNIT_ALIVE + FS_UNIT_UNDEAD
    *                          USUAL_HERO = USUAL + FS_UNIT_HERO
    *
    *                          If you want to use USUAL + HERO_2 + UNDEAD_9, be sure to
    *                          use it this way (FS_UNIT_ALIVE is repeated 3 times,
    *                          FS_UNIT_ENEMY is repeated 2 times):
    *                          USUAL + HERO_2 + UNDEAD_9 - 2*FS_UNIT_ALIVE - FS_UNIT_ENEMY
    *
    *                To use this method, you have to define your own constraints using
    *                this way:
    *
    *                    globals
    *                        constant integer CONSTRAINT_NAME = COND1 + COND2 + ...
    *                    endglobals
    *
    *                If you are GUI, you have to put these three lines in three adjacent
    *                Custom Script lines.
    *
    ************************************************************************************************************************
    *    Constants (filters):
    *        - These are the filters available:
    *
    *    FS_UNIT_ENEMY
    *    FS_UNIT_ALLY
    *    FS_UNIT_ALIVE
    *    FS_UNIT_DEAD
    *    FS_UNIT_ORGANIC
    *    FS_UNIT_STRUCTURE
    *    FS_UNIT_MECHANICAL
    *    FS_UNIT_HERO
    *    FS_UNIT_NON_HERO
    *    FS_UNIT_IMMUNE        //magic immunity, ofcourse!
    *    FS_UNIT_NON_IMMUNE   
    *    FS_UNIT_SUMMONED     
    *    FS_UNIT_NON_SUMMONED   
    *    FS_UNIT_VISIBLE     
    *    FS_UNIT_INVISIBLE   
    *    FS_UNIT_WARD     
    *    FS_UNIT_NON_WARD 
    *    FS_UNIT_ANCIENT     
    *    FS_UNIT_NON_ANCIENT   
    *    FS_UNIT_GROUND       
    *    FS_UNIT_FLYING       
    *    FS_UNIT_MELEE       
    *    FS_UNIT_RANGED       
    *    FS_UNIT_UNDEAD
    *    FS_UNIT_NON_UNDEAD
    *    FS_UNIT_NON_STRUCTURE // NEW
    *
    *    FS_ITEM_OWNED     
    *    FS_ITEM_NON_OWNED     
    *    FS_ITEM_RUNE        //includes runes, tomes, powerups, etc.
    *    FS_ITEM_NON_RUNE 
    *    FS_ITEM_SELLABLE   
    *    FS_ITEM_NON_SELLABLE   
    *    FS_ITEM_PAWNABLE       
    *    FS_ITEM_NON_PAWNABLE
    *    FS_ITEM_PERMANENT   
    *    FS_ITEM_NON_PERMANENT 
    *    FS_ITEM_CHARGED     
    *    FS_ITEM_NON_CHARGED 
    *    FS_ITEM_POWERUP     
    *    FS_ITEM_NON_POWERUP 
    *    FS_ITEM_ARTIFACT   
    *    FS_ITEM_NON_ARTIFACT 
    *    FS_ITEM_PURCHASABLE   
    *    FS_ITEM_NON_PURCHASABLE 
    *    FS_ITEM_CAMPAIGN       
    *    FS_ITEM_NON_CAMPAIGN   
    *    FS_ITEM_MISC           
    *    FS_ITEM_NON_MISC     
    *    FS_ITEM_VISIBLE     
    *    FS_ITEM_HIDDEN
    *
    *    FS_PLAYER_ENEMY     
    *    FS_PLAYER_ALLY     
    *    FS_PLAYER_USER   
    *    FS_PLAYER_COMPUTER 
    *    FS_PLAYER_PLAYING 
    *    FS_PLAYER_LEFT     //also includes non-used slots.
    *    FS_PLAYER_NEUTRAL   
    *    FS_PLAYER_NON_NEUTRAL
    *    FS_PLAYER_VISION       //shared vision.
    *    FS_PLAYER_NON_VISION
    *    FS_PLAYER_CONTROL        //shared unit control.
    *    FS_PLAYER_NON_CONTROL
    *
    ************************************************************************************************************************
    *                          -----END OF API-----
    */
          
            constant integer    FS_UNIT_ENEMY              = 0x1
            constant integer    FS_UNIT_ALLY               = 0x2
            constant integer    FS_UNIT_ALIVE              = 0x4
            constant integer    FS_UNIT_DEAD               = 0x8
            constant integer    FS_UNIT_ORGANIC            = 0x10
            constant integer    FS_UNIT_STRUCTURE          = 0x20
            constant integer    FS_UNIT_MECHANICAL         = 0x40
            constant integer    FS_UNIT_HERO               = 0x80
            constant integer    FS_UNIT_NON_HERO           = 0x100
            constant integer    FS_UNIT_IMMUNE             = 0x200
            constant integer    FS_UNIT_NON_IMMUNE         = 0x400
            constant integer    FS_UNIT_SUMMONED           = 0x800
            constant integer    FS_UNIT_NON_SUMMONED       = 0x1000
            constant integer    FS_UNIT_VISIBLE            = 0x2000
            constant integer    FS_UNIT_INVISIBLE          = 0x4000
            constant integer    FS_UNIT_WARD               = 0x8000
            constant integer    FS_UNIT_NON_WARD           = 0x10000
            constant integer    FS_UNIT_ANCIENT            = 0x20000
            constant integer    FS_UNIT_NON_ANCIENT        = 0x40000
            constant integer    FS_UNIT_GROUND             = 0x80000
            constant integer    FS_UNIT_FLYING             = 0x100000
            constant integer    FS_UNIT_MELEE              = 0x200000
            constant integer    FS_UNIT_RANGED             = 0x400000
            constant integer    FS_UNIT_UNDEAD             = 0x800000
            constant integer    FS_UNIT_NON_UNDEAD         = 0x1000000
            constant integer    FS_UNIT_NON_STRUCTURE      = 0x2000000 // NEW
          
            constant integer    FS_ITEM_OWNED              = 0x1
            constant integer    FS_ITEM_NON_OWNED          = 0x2
            constant integer    FS_ITEM_RUNE               = 0x4
            constant integer    FS_ITEM_NON_RUNE           = 0x8
            constant integer    FS_ITEM_SELLABLE           = 0x10
            constant integer    FS_ITEM_NON_SELLABLE       = 0x20
            constant integer    FS_ITEM_PAWNABLE           = 0x40
            constant integer    FS_ITEM_NON_PAWNABLE       = 0x80
            constant integer    FS_ITEM_PERMANENT          = 0x100
            constant integer    FS_ITEM_NON_PERMANENT      = 0x200
            constant integer    FS_ITEM_CHARGED            = 0x400
            constant integer    FS_ITEM_NON_CHARGED        = 0x800
            constant integer    FS_ITEM_POWERUP            = 0x1000
            constant integer    FS_ITEM_NON_POWERUP        = 0x2000
            constant integer    FS_ITEM_ARTIFACT           = 0x4000
            constant integer    FS_ITEM_NON_ARTIFACT       = 0x8000
            constant integer    FS_ITEM_PURCHASABLE        = 0x10000
            constant integer    FS_ITEM_NON_PURCHASABLE    = 0x20000
            constant integer    FS_ITEM_CAMPAIGN           = 0x40000
            constant integer    FS_ITEM_NON_CAMPAIGN       = 0x80000
            constant integer    FS_ITEM_MISC               = 0x100000
            constant integer    FS_ITEM_NON_MISC           = 0x200000
            constant integer    FS_ITEM_VISIBLE            = 0x400000
            constant integer    FS_ITEM_HIDDEN             = 0x800000
          
            constant integer    FS_PLAYER_ENEMY            = 0x1
            constant integer    FS_PLAYER_ALLY             = 0x2
            constant integer    FS_PLAYER_USER             = 0x4
            constant integer    FS_PLAYER_COMPUTER         = 0x8
            constant integer    FS_PLAYER_PLAYING          = 0x10
            constant integer    FS_PLAYER_LEFT             = 0x20
            constant integer    FS_PLAYER_NEUTRAL          = 0x40
            constant integer    FS_PLAYER_NON_NEUTRAL      = 0x80
            constant integer    FS_PLAYER_VISION           = 0x100
            constant integer    FS_PLAYER_NON_VISION       = 0x200
            constant integer    FS_PLAYER_CONTROL          = 0x400
            constant integer    FS_PLAYER_NON_CONTROL      = 0x800
        endglobals
      
        function UnitFilter takes unit whichUnit, player whichPlayer, integer filter returns boolean
            set filter = filter + 0x1
            if filter > 0x2000 then
                // NEW, NON-STRUCTURE
                if filter > 0x2000000 then
                    set filter = filter - 0x2000000
                    if IsUnitType(whichUnit, UNIT_TYPE_STRUCTURE) then
                        return false
                    endif
                endif
                if filter > 0x1000000 then
                    set filter = filter - 0x1000000
                    if IsUnitType(whichUnit, UNIT_TYPE_UNDEAD) then
                        return false
                    endif
                endif
                if filter > 0x800000 then
                    set filter = filter - 0x800000
                    if not IsUnitType(whichUnit, UNIT_TYPE_UNDEAD) then
                        return false
                    endif
                endif
                if filter > 0x400000 then
                    set filter = filter - 0x40000
                    if not IsUnitType(whichUnit, UNIT_TYPE_RANGED_ATTACKER) then
                        return false
                    endif
                endif
                if filter > 0x200000 then
                    set filter = filter - 0x200000
                    if not IsUnitType(whichUnit, UNIT_TYPE_MELEE_ATTACKER) then
                        return false
                    endif
                endif
                if filter > 0x100000 then
                    set filter = filter - 0x100000
                    if not IsUnitType(whichUnit, UNIT_TYPE_FLYING) then
                        return false
                    endif
                endif
                if filter > 0x80000 then
                    set filter = filter - 0x80000
                    if not IsUnitType(whichUnit, UNIT_TYPE_GROUND) then
                        return false
                    endif
                endif
                if filter > 0x40000 then
                    set filter = filter - 0x40000
                    if IsUnitType(whichUnit, UNIT_TYPE_ANCIENT) then
                        return false
                    endif
                endif
                if filter > 0x20000 then
                    set filter = filter - 0x20000
                    if not IsUnitType(whichUnit, UNIT_TYPE_ANCIENT) then
                        return false
                    endif
                endif
                if filter > 0x10000 then
                    set filter = filter - 0x10000
                    if GetUnitAbilityLevel(whichUnit,ABILITY_WARD_CLASSIFIER)!=0 then
                        return false
                    endif
                endif
                if filter > 0x8000 then
                    set filter = filter - 0x8000
                    if GetUnitAbilityLevel(whichUnit,ABILITY_WARD_CLASSIFIER)==0 then
                        return false
                    endif
                endif
                if filter > 0x4000 then
                    set filter = filter - 0x4000
                    if IsUnitVisible(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
                if filter > 0x2000 then
                    set filter = filter - 0x2000
                    if not IsUnitVisible(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
            endif
            if filter < 0x2001 then
                if filter > 0x1000 then
                    set filter = filter - 0x1000
                    if IsUnitType(whichUnit, UNIT_TYPE_SUMMONED) then
                        return false
                    endif
                endif
                if filter > 0x800 then
                    set filter = filter - 0x800
                    if not IsUnitType(whichUnit, UNIT_TYPE_SUMMONED) then
                        return false
                    endif
                endif
                if filter > 0x400 then
                    set filter = filter - 0x400
                    if IsUnitType(whichUnit, UNIT_TYPE_MAGIC_IMMUNE) then
                        return false
                    endif
                endif
                if filter > 0x200 then
                    set filter = filter - 0x200
                    if not IsUnitType(whichUnit, UNIT_TYPE_MAGIC_IMMUNE) then
                        return false
                    endif
                endif
                if filter > 0x100 then
                    set filter = filter - 0x100
                    if IsUnitType(whichUnit, UNIT_TYPE_HERO) then
                        return false
                    endif
                endif
                if filter > 0x80 then
                    set filter = filter - 0x80
                    if not IsUnitType(whichUnit, UNIT_TYPE_HERO) then
                        return false
                    endif
                endif
                if filter > 0x40 then
                    set filter = filter - 0x40
                    if not IsUnitType(whichUnit,UNIT_TYPE_MECHANICAL) then
                        return false
                    endif
                endif
                if filter > 0x20 then
                    set filter = filter - 0x20
                    if not IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) then
                        return false
                    endif
                endif
                if filter > 0x10 then
                    set filter = filter - 0x10
                    if IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) or IsUnitType(whichUnit,UNIT_TYPE_MECHANICAL) then
                        return false
                    endif
                endif
                if filter > 0x8 then
                    set filter = filter - 0x8
                    if GetWidgetLife(whichUnit)>0.405 and IsUnitType(whichUnit,UNIT_TYPE_DEAD)==false then
                        return false
                    endif
                endif
                if filter > 0x4 then
                    set filter = filter - 0x4
                    if GetWidgetLife(whichUnit)<=0.405 or IsUnitType(whichUnit,UNIT_TYPE_DEAD) then
                        return false
                    endif
                endif
                if filter > 0x2 then
                    set filter = filter - 0x2
                    if IsUnitEnemy(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
                if filter > 0x1 then
                    set filter = filter - 0x1
                    if not IsUnitEnemy(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
            endif
            if GetUnitAbilityLevel(whichUnit,ABILITY_DUMMY_CLASSIFIER)!=0 then
                return false
            endif
            return true
        endfunction
      
        function ItemFilter takes item whichItem, integer filter returns boolean
            set filter = filter + 0x1
            if filter > 0x2000 then
                if filter > 0x800000 then
                    set filter = filter - 0x800000
                    if not IsItemVisible(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x400000 then
                    set filter = filter - 0x40000
                    if IsItemVisible(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x200000 then
                    set filter = filter - 0x200000
                    if GetItemType(whichItem)==ITEM_TYPE_MISCELLANEOUS then
                        return false
                    endif
                endif
                if filter > 0x100000 then
                    set filter = filter - 0x100000
                    if GetItemType(whichItem)!=ITEM_TYPE_MISCELLANEOUS then
                        return false
                    endif
                endif
                if filter > 0x80000 then
                    set filter = filter - 0x80000
                    if GetItemType(whichItem)==ITEM_TYPE_CAMPAIGN then
                        return false
                    endif
                endif
                if filter > 0x40000 then
                    set filter = filter - 0x40000
                    if GetItemType(whichItem)!=ITEM_TYPE_CAMPAIGN then
                        return false
                    endif
                endif
                if filter > 0x20000 then
                    set filter = filter - 0x20000
                    if GetItemType(whichItem)==ITEM_TYPE_PURCHASABLE then
                        return false
                    endif
                endif
                if filter > 0x10000 then
                    set filter = filter - 0x10000
                    if GetItemType(whichItem)!=ITEM_TYPE_PURCHASABLE then
                        return false
                    endif
                endif
                if filter > 0x8000 then
                    set filter = filter - 0x8000
                    if GetItemType(whichItem)==ITEM_TYPE_ARTIFACT then
                        return false
                    endif
                endif
                if filter > 0x4000 then
                    set filter = filter - 0x4000
                    if GetItemType(whichItem)!=ITEM_TYPE_ARTIFACT then
                        return false
                    endif
                endif
                if filter > 0x2000 then
                    set filter = filter - 0x2000
                    if GetItemType(whichItem)==ITEM_TYPE_POWERUP then
                        return false
                    endif
                endif
            endif
            if filter < 0x2001 then
                if filter > 0x1000 then
                    set filter = filter - 0x1000
                    if GetItemType(whichItem)!=ITEM_TYPE_POWERUP then
                        return false
                    endif
                endif
                if filter > 0x800 then
                    set filter = filter - 0x800
                    if GetItemType(whichItem)==ITEM_TYPE_CHARGED then
                        return false
                    endif
                endif
                if filter > 0x400 then
                    set filter = filter - 0x400
                    if GetItemType(whichItem)!=ITEM_TYPE_CHARGED then
                        return false
                    endif
                endif
                if filter > 0x200 then
                    set filter = filter - 0x200
                    if GetItemType(whichItem)==ITEM_TYPE_PERMANENT then
                        return false
                    endif
                endif
                if filter > 0x100 then
                    set filter = filter - 0x100
                    if GetItemType(whichItem)!=ITEM_TYPE_PERMANENT then
                        return false
                    endif
                endif
                if filter > 0x80 then
                    set filter = filter - 0x80
                    if IsItemPawnable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x40 then
                    set filter = filter - 0x40
                    if not IsItemPawnable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x20 then
                    set filter = filter - 0x20
                    if IsItemSellable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x10 then
                    set filter = filter - 0x10
                    if not IsItemSellable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x8 then
                    set filter = filter - 0x8
                    if IsItemPowerup(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x4 then
                    set filter = filter - 0x4
                    if not IsItemPowerup(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x2 then
                    set filter = filter - 0x2
                    if IsItemOwned(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x1 then
                    set filter = filter - 0x1
                    if not IsItemOwned(whichItem) then
                        return false
                    endif
                endif
            endif
            return true
        endfunction
      
        function PlayerFilter takes player whichPlayer, player otherPlayer, integer filter returns boolean
            if filter > 0x800 then
                set filter = filter - 0x800
                if GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_CONTROL) then
                    return false
                endif
            endif
            if filter > 0x400 then
                set filter = filter - 0x400
                if not GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_CONTROL) then
                    return false
                endif
            endif
            if filter > 0x200 then
                set filter = filter - 0x200
                if GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_VISION) then
                    return false
                endif
            endif
            if filter > 0x100 then
                set filter = filter - 0x100
                if not GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_VISION) then
                    return false
                endif
            endif
            if filter > 0x80 then
                set filter = filter - 0x80
                if (whichPlayer==Player(12) or whichPlayer==Player(13) or whichPlayer==Player(14) or whichPlayer==Player(15)) then
                    return false
                endif
            endif
            if filter > 0x40 then
                set filter = filter - 0x40
                if (not(whichPlayer==Player(12) or whichPlayer==Player(13) or whichPlayer==Player(14) or whichPlayer==Player(15))) then
                    return false
                endif
            endif
            if filter > 0x20 then
                set filter = filter - 0x20
                if GetPlayerSlotState(whichPlayer)!=PLAYER_SLOT_STATE_LEFT then
                    return false
                endif
            endif
            if filter > 0x10 then
                set filter = filter - 0x10
                if GetPlayerSlotState(whichPlayer)!=PLAYER_SLOT_STATE_PLAYING then
                    return false
                endif
            endif
            if filter > 0x8 then
                set filter = filter - 0x8
                if GetPlayerController(whichPlayer)!=MAP_CONTROL_COMPUTER then
                    return false
                endif
            endif
            if filter > 0x4 then
                set filter = filter - 0x4
                if GetPlayerController(whichPlayer)!=MAP_CONTROL_USER then
                    return false
                endif
            endif
            if filter > 0x2 then
                set filter = filter - 0x2
                if IsPlayerEnemy(whichPlayer,otherPlayer) then
                    return false
                endif
            endif
            if filter > 0x1 then
                set filter = filter - 0x1
                if IsPlayerAlly(whichPlayer,otherPlayer) then
                    return false
                endif
            endif
            return true
        endfunction
    endlibrary
 
Alright, try this then, I updated the Filter code to include FS_UNIT_NON_STRUCTURE
vJASS:
//TESH.scrollpos=174
//TESH.alwaysfold=0
 library FilteringSystem /* v3.4.0 */
    /*
    ************************************************************************************************************************
    *        Filtering System's API v3.4.0
    *        by The Wrecker
    *
    *        Credits:
    *               - God : God supports anyone.
    *               - Nestharus : Algorithm of this system is
    *                 shaped in time by ideas of him, and as you
    *                 see, the algorithm is perfect; many other
    *                 thanks to him for many other useful hints.
    *                 THIS SYSTEM OWES ITS QUALITY TO Nestharus.
    *               - Magtheridon96 : His hints made the way
    *                 to create this system easier and more
    *                 efficient, many thanks to him. His
    *                 advocacy for this system was awesome:
    *                 [url]http://www.hiveworkshop.com/forums/jass-resources-412/filtering-system-240887/index7.html#post2471786[/url]
    *
    *                    by TheWrecker
    *
    *        [url]http://www.hiveworkshop.com/forums/jass-resources-412/filtering-system-240887/[/url]
    *
    *    Contents:
    *
    *        - Functions
    *        - How to use Filters
    *        - How to use Filtering System
    *        - Settings
    *        - Full Example
    *        - Side Functions
    *        - Constants (filters)
    *
    ************************************************************************************************************************
    *    Functions:
    *
    *        - function UnitFilter takes unit whichUnit, player whichPlayer, integer filter returns boolean
    *
    *            + It will check if 'whichUnit' meets given conditions or not.
    *            + 'whichPlayer' is only required when Alliance and Visibility filters
    *              are applied and must be passed 'null' when not using Alliance and
    *              Visibility filters.
    *            + 'filter' is an integer explained in section "How to use Filters".
    *
    *        - function ItemFilter takes item whichItem, integer filter returns boolean
    *
    *            + It checks if 'whichItem' passes given filters or not.
    *            + 'filter' is an integer explained in section "How to use Filters".
    *
    *        - function PlayerFilter takes player whichPlayer, player otherPlayer, integer filter returns boolean
    *
    *            + It checks whether 'whichPlayer' meets given filters or not.
    *            + 'otherPlayer' is the other player used to check two-player related
    *              filters: Shared Units, Shared Vision, Alliance.
    *              if not using the above filters, you can pass 'null' as 'otherPlayer'.
    *            + 'filter' is an integer explained in section "How to use Filters".
    *
    ************************************************************************************************************************
    *    How to use Filters:
    *
    *        - 'filter' is an hexadecimal integer which is made like this:
    *            Filter1 + Filter2 + Filter3 + ...
    *                + You don't have to do any mathematics, only type your
    *                  desired filters' names like above.
    *
    *        - Filters in Filtring System are in 3 groups: Unit, Item, Player.
    *            + Use each group only with its related filtering function.
    *
    *        - Filter rules are as below:
    *            <Filter1 and Filter2 are opposites like Dead and Alive>
    *            + Filter1: Units matching it will pass.
    *            + Filter1 + Filter 2: NO UNIT WILL PASS.
    *            + nothing: All units will pass.
    *            + If you didn't get what above means take a look to section
    *              "Full Example"
    *
    ************************************************************************************************************************
    *    How to use Filtering System:
    *
    *        - vJass and Jass:
    *            + A simple line:
    *                if [Unit/Player/Item]Filter(argument1,argument2[if exists],'filter') then
    *                //Scripts
    *                endif
    *
    *        - GUI:
    *            + A Custom Script (New Action -> General -> Custom Script) line:
    *                Custom Script : if [Unit/Player/Item]Filter(argument1,argument2[if exists],'filter') then
    *                //Scripts
    *                Custom Script : endif
    *
    ************************************************************************************************************************
    *    Settings:
    *
    *        - Ward and Dummy classificators:
    *
    * */globals/*
    *
    *           CONFIGURABLE PART
    *
    *     */
            constant integer ABILITY_WARD_CLASSIFIER = 'Alit'/*
    *       This system checks for a spell to realize the fact that a unit is
    *       a ward or not, because perhaps you add a ward classification to a unit
    *       to remove its spell icons, but that unit is not really a ward, so instead
    *       of checking for classification we use a spell to define ward classification;
    *       change it to your desired spell or leave it as it is.
    *    
    *     */
            constant integer ABILITY_DUMMY_CLASSIFIER = 'Aloc'/*
    *       This system checks for a spell to realize the fact that a unit is
    *       a dummy or not, change this to your desired spell or leave it as it is, note
    *       that this system doesn't do anything about dummies, in fact when it finds this
    *       spell in a unit, it completely ignores that unit and that unit will not pass
    *       the filtering, so if you want a specific unit to not pass this filtering, add
    *       this spell to it.
    *    
    *           END OF CONFIGURABLE PART
    *
    ************************************************************************************************************************
    *    Full Example:
    *
    *        - Alive, enemy ranged heroes:
    *            + if UnitFilter(Target,Caster,FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_HERO + FS_UNIT_RANGED) then
    *            + NOTE : ORDER OF FILTERS IS NOT IMPORTANT.
    *
    *        - Non-Summoned undead units:
    *            + if UnitFilter(Target,null,FS_UNIT_UNDEAD + FS_UNIT_NON_SUMMONED) then
    *
    *        - All units:
    *            + if UnitFilter(Target,null,0) then
    *            + Pay attention to zero (0).
    *
    *        - No unit:
    *            + if UnitFilter(Target,null,FS_UNIT_ALIVE + FS_UNIT_DEAD) then
    *            + 'FS_UNIT_HERO + FS_UNIT_NON_HERO','FS_UNIT_ALLY + FS_UNIT_ENEMY' and
    *              other opposites can be placed as 'FS_UNIT_ALIVE + FS_UNIT_DEAD'.
    *
    *        - Ally computer players with shared vision:
    *            + if PlayerFilter(Player1,Player2,FS_PLAYER_ALLY + FS_PLAYER_COMPUTER + FS_PLAYER_VISION) then
    *
    *        - Sellable, Campaign class items which are not owned:
    *            + if ItemFilter(Item,FS_ITEM_SELLABLE + FS_ITEM_CAMPAIGN + FS_ITEM_NON_OWNED) then
    *
    ************************************************************************************************************************
    *    Side Functions:
    *
    *        Because of the unique algorithm of this system, there are unpredicted functions
    *        that this system can have, one of them is known and others may be found later.
    *
    *            - Mixing the filters into single filter (Constraints):
    *              (found by Magtheridon96)
    *
    *                This is the method of mixing some filters and converting them into a
    *                single filter to use that single filter instead of using many filters
    *                more and more again. An example should show you the way:
    *            
    *                    integer USUAL = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_ORGANIC
    *
    *                this way, you will type in 'USUAL' everytime your filter contain these
    *                three filters instead of typing all three of them.
    *
    *                    + Be sure that no filter is repeated two times in a single
    *                      constraint.
    *                    + If sum of some constraints contain repeated filters, be sure
    *                      to substract that filter until there is only one filter of that
    *                      type left, an example is needed:
    *
    *                          USUAL = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_ORGANIC
    *                          HERO_2 = FS_UNIT_ALIVE + FS_UNIT_ENEMY + FS_UNIT_IMMUNE
    *                          UNDEAD_9 = FS_UNIT_ALIVE + FS_UNIT_UNDEAD
    *                          USUAL_HERO = USUAL + FS_UNIT_HERO
    *
    *                          If you want to use USUAL + HERO_2 + UNDEAD_9, be sure to
    *                          use it this way (FS_UNIT_ALIVE is repeated 3 times,
    *                          FS_UNIT_ENEMY is repeated 2 times):
    *                          USUAL + HERO_2 + UNDEAD_9 - 2*FS_UNIT_ALIVE - FS_UNIT_ENEMY
    *
    *                To use this method, you have to define your own constraints using
    *                this way:
    *
    *                    globals
    *                        constant integer CONSTRAINT_NAME = COND1 + COND2 + ...
    *                    endglobals
    *
    *                If you are GUI, you have to put these three lines in three adjacent
    *                Custom Script lines.
    *
    ************************************************************************************************************************
    *    Constants (filters):
    *        - These are the filters available:
    *
    *    FS_UNIT_ENEMY
    *    FS_UNIT_ALLY
    *    FS_UNIT_ALIVE
    *    FS_UNIT_DEAD
    *    FS_UNIT_ORGANIC
    *    FS_UNIT_STRUCTURE
    *    FS_UNIT_MECHANICAL
    *    FS_UNIT_HERO
    *    FS_UNIT_NON_HERO
    *    FS_UNIT_IMMUNE        //magic immunity, ofcourse!
    *    FS_UNIT_NON_IMMUNE  
    *    FS_UNIT_SUMMONED    
    *    FS_UNIT_NON_SUMMONED  
    *    FS_UNIT_VISIBLE    
    *    FS_UNIT_INVISIBLE  
    *    FS_UNIT_WARD    
    *    FS_UNIT_NON_WARD
    *    FS_UNIT_ANCIENT    
    *    FS_UNIT_NON_ANCIENT  
    *    FS_UNIT_GROUND      
    *    FS_UNIT_FLYING      
    *    FS_UNIT_MELEE      
    *    FS_UNIT_RANGED      
    *    FS_UNIT_UNDEAD
    *    FS_UNIT_NON_UNDEAD
    *    FS_UNIT_NON_STRUCTURE // NEW
    *
    *    FS_ITEM_OWNED    
    *    FS_ITEM_NON_OWNED    
    *    FS_ITEM_RUNE        //includes runes, tomes, powerups, etc.
    *    FS_ITEM_NON_RUNE
    *    FS_ITEM_SELLABLE  
    *    FS_ITEM_NON_SELLABLE  
    *    FS_ITEM_PAWNABLE      
    *    FS_ITEM_NON_PAWNABLE
    *    FS_ITEM_PERMANENT  
    *    FS_ITEM_NON_PERMANENT
    *    FS_ITEM_CHARGED    
    *    FS_ITEM_NON_CHARGED
    *    FS_ITEM_POWERUP    
    *    FS_ITEM_NON_POWERUP
    *    FS_ITEM_ARTIFACT  
    *    FS_ITEM_NON_ARTIFACT
    *    FS_ITEM_PURCHASABLE  
    *    FS_ITEM_NON_PURCHASABLE
    *    FS_ITEM_CAMPAIGN      
    *    FS_ITEM_NON_CAMPAIGN  
    *    FS_ITEM_MISC          
    *    FS_ITEM_NON_MISC    
    *    FS_ITEM_VISIBLE    
    *    FS_ITEM_HIDDEN
    *
    *    FS_PLAYER_ENEMY    
    *    FS_PLAYER_ALLY    
    *    FS_PLAYER_USER  
    *    FS_PLAYER_COMPUTER
    *    FS_PLAYER_PLAYING
    *    FS_PLAYER_LEFT     //also includes non-used slots.
    *    FS_PLAYER_NEUTRAL  
    *    FS_PLAYER_NON_NEUTRAL
    *    FS_PLAYER_VISION       //shared vision.
    *    FS_PLAYER_NON_VISION
    *    FS_PLAYER_CONTROL        //shared unit control.
    *    FS_PLAYER_NON_CONTROL
    *
    ************************************************************************************************************************
    *                          -----END OF API-----
    */
         
            constant integer    FS_UNIT_ENEMY              = 0x1
            constant integer    FS_UNIT_ALLY               = 0x2
            constant integer    FS_UNIT_ALIVE              = 0x4
            constant integer    FS_UNIT_DEAD               = 0x8
            constant integer    FS_UNIT_ORGANIC            = 0x10
            constant integer    FS_UNIT_STRUCTURE          = 0x20
            constant integer    FS_UNIT_MECHANICAL         = 0x40
            constant integer    FS_UNIT_HERO               = 0x80
            constant integer    FS_UNIT_NON_HERO           = 0x100
            constant integer    FS_UNIT_IMMUNE             = 0x200
            constant integer    FS_UNIT_NON_IMMUNE         = 0x400
            constant integer    FS_UNIT_SUMMONED           = 0x800
            constant integer    FS_UNIT_NON_SUMMONED       = 0x1000
            constant integer    FS_UNIT_VISIBLE            = 0x2000
            constant integer    FS_UNIT_INVISIBLE          = 0x4000
            constant integer    FS_UNIT_WARD               = 0x8000
            constant integer    FS_UNIT_NON_WARD           = 0x10000
            constant integer    FS_UNIT_ANCIENT            = 0x20000
            constant integer    FS_UNIT_NON_ANCIENT        = 0x40000
            constant integer    FS_UNIT_GROUND             = 0x80000
            constant integer    FS_UNIT_FLYING             = 0x100000
            constant integer    FS_UNIT_MELEE              = 0x200000
            constant integer    FS_UNIT_RANGED             = 0x400000
            constant integer    FS_UNIT_UNDEAD             = 0x800000
            constant integer    FS_UNIT_NON_UNDEAD         = 0x1000000
            constant integer    FS_UNIT_NON_STRUCTURE      = 0x2000000 // NEW
         
            constant integer    FS_ITEM_OWNED              = 0x1
            constant integer    FS_ITEM_NON_OWNED          = 0x2
            constant integer    FS_ITEM_RUNE               = 0x4
            constant integer    FS_ITEM_NON_RUNE           = 0x8
            constant integer    FS_ITEM_SELLABLE           = 0x10
            constant integer    FS_ITEM_NON_SELLABLE       = 0x20
            constant integer    FS_ITEM_PAWNABLE           = 0x40
            constant integer    FS_ITEM_NON_PAWNABLE       = 0x80
            constant integer    FS_ITEM_PERMANENT          = 0x100
            constant integer    FS_ITEM_NON_PERMANENT      = 0x200
            constant integer    FS_ITEM_CHARGED            = 0x400
            constant integer    FS_ITEM_NON_CHARGED        = 0x800
            constant integer    FS_ITEM_POWERUP            = 0x1000
            constant integer    FS_ITEM_NON_POWERUP        = 0x2000
            constant integer    FS_ITEM_ARTIFACT           = 0x4000
            constant integer    FS_ITEM_NON_ARTIFACT       = 0x8000
            constant integer    FS_ITEM_PURCHASABLE        = 0x10000
            constant integer    FS_ITEM_NON_PURCHASABLE    = 0x20000
            constant integer    FS_ITEM_CAMPAIGN           = 0x40000
            constant integer    FS_ITEM_NON_CAMPAIGN       = 0x80000
            constant integer    FS_ITEM_MISC               = 0x100000
            constant integer    FS_ITEM_NON_MISC           = 0x200000
            constant integer    FS_ITEM_VISIBLE            = 0x400000
            constant integer    FS_ITEM_HIDDEN             = 0x800000
         
            constant integer    FS_PLAYER_ENEMY            = 0x1
            constant integer    FS_PLAYER_ALLY             = 0x2
            constant integer    FS_PLAYER_USER             = 0x4
            constant integer    FS_PLAYER_COMPUTER         = 0x8
            constant integer    FS_PLAYER_PLAYING          = 0x10
            constant integer    FS_PLAYER_LEFT             = 0x20
            constant integer    FS_PLAYER_NEUTRAL          = 0x40
            constant integer    FS_PLAYER_NON_NEUTRAL      = 0x80
            constant integer    FS_PLAYER_VISION           = 0x100
            constant integer    FS_PLAYER_NON_VISION       = 0x200
            constant integer    FS_PLAYER_CONTROL          = 0x400
            constant integer    FS_PLAYER_NON_CONTROL      = 0x800
        endglobals
     
        function UnitFilter takes unit whichUnit, player whichPlayer, integer filter returns boolean
            set filter = filter + 0x1
            if filter > 0x2000 then
                // NEW, NON-STRUCTURE
                if filter > 0x2000000 then
                    set filter = filter - 0x2000000
                    if IsUnitType(whichUnit, UNIT_TYPE_STRUCTURE) then
                        return false
                    endif
                endif
                if filter > 0x1000000 then
                    set filter = filter - 0x1000000
                    if IsUnitType(whichUnit, UNIT_TYPE_UNDEAD) then
                        return false
                    endif
                endif
                if filter > 0x800000 then
                    set filter = filter - 0x800000
                    if not IsUnitType(whichUnit, UNIT_TYPE_UNDEAD) then
                        return false
                    endif
                endif
                if filter > 0x400000 then
                    set filter = filter - 0x40000
                    if not IsUnitType(whichUnit, UNIT_TYPE_RANGED_ATTACKER) then
                        return false
                    endif
                endif
                if filter > 0x200000 then
                    set filter = filter - 0x200000
                    if not IsUnitType(whichUnit, UNIT_TYPE_MELEE_ATTACKER) then
                        return false
                    endif
                endif
                if filter > 0x100000 then
                    set filter = filter - 0x100000
                    if not IsUnitType(whichUnit, UNIT_TYPE_FLYING) then
                        return false
                    endif
                endif
                if filter > 0x80000 then
                    set filter = filter - 0x80000
                    if not IsUnitType(whichUnit, UNIT_TYPE_GROUND) then
                        return false
                    endif
                endif
                if filter > 0x40000 then
                    set filter = filter - 0x40000
                    if IsUnitType(whichUnit, UNIT_TYPE_ANCIENT) then
                        return false
                    endif
                endif
                if filter > 0x20000 then
                    set filter = filter - 0x20000
                    if not IsUnitType(whichUnit, UNIT_TYPE_ANCIENT) then
                        return false
                    endif
                endif
                if filter > 0x10000 then
                    set filter = filter - 0x10000
                    if GetUnitAbilityLevel(whichUnit,ABILITY_WARD_CLASSIFIER)!=0 then
                        return false
                    endif
                endif
                if filter > 0x8000 then
                    set filter = filter - 0x8000
                    if GetUnitAbilityLevel(whichUnit,ABILITY_WARD_CLASSIFIER)==0 then
                        return false
                    endif
                endif
                if filter > 0x4000 then
                    set filter = filter - 0x4000
                    if IsUnitVisible(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
                if filter > 0x2000 then
                    set filter = filter - 0x2000
                    if not IsUnitVisible(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
            endif
            if filter < 0x2001 then
                if filter > 0x1000 then
                    set filter = filter - 0x1000
                    if IsUnitType(whichUnit, UNIT_TYPE_SUMMONED) then
                        return false
                    endif
                endif
                if filter > 0x800 then
                    set filter = filter - 0x800
                    if not IsUnitType(whichUnit, UNIT_TYPE_SUMMONED) then
                        return false
                    endif
                endif
                if filter > 0x400 then
                    set filter = filter - 0x400
                    if IsUnitType(whichUnit, UNIT_TYPE_MAGIC_IMMUNE) then
                        return false
                    endif
                endif
                if filter > 0x200 then
                    set filter = filter - 0x200
                    if not IsUnitType(whichUnit, UNIT_TYPE_MAGIC_IMMUNE) then
                        return false
                    endif
                endif
                if filter > 0x100 then
                    set filter = filter - 0x100
                    if IsUnitType(whichUnit, UNIT_TYPE_HERO) then
                        return false
                    endif
                endif
                if filter > 0x80 then
                    set filter = filter - 0x80
                    if not IsUnitType(whichUnit, UNIT_TYPE_HERO) then
                        return false
                    endif
                endif
                if filter > 0x40 then
                    set filter = filter - 0x40
                    if not IsUnitType(whichUnit,UNIT_TYPE_MECHANICAL) then
                        return false
                    endif
                endif
                if filter > 0x20 then
                    set filter = filter - 0x20
                    if not IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) then
                        return false
                    endif
                endif
                if filter > 0x10 then
                    set filter = filter - 0x10
                    if IsUnitType(whichUnit,UNIT_TYPE_STRUCTURE) or IsUnitType(whichUnit,UNIT_TYPE_MECHANICAL) then
                        return false
                    endif
                endif
                if filter > 0x8 then
                    set filter = filter - 0x8
                    if GetWidgetLife(whichUnit)>0.405 and IsUnitType(whichUnit,UNIT_TYPE_DEAD)==false then
                        return false
                    endif
                endif
                if filter > 0x4 then
                    set filter = filter - 0x4
                    if GetWidgetLife(whichUnit)<=0.405 or IsUnitType(whichUnit,UNIT_TYPE_DEAD) then
                        return false
                    endif
                endif
                if filter > 0x2 then
                    set filter = filter - 0x2
                    if IsUnitEnemy(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
                if filter > 0x1 then
                    set filter = filter - 0x1
                    if not IsUnitEnemy(whichUnit,whichPlayer) then
                        return false
                    endif
                endif
            endif
            if GetUnitAbilityLevel(whichUnit,ABILITY_DUMMY_CLASSIFIER)!=0 then
                return false
            endif
            return true
        endfunction
     
        function ItemFilter takes item whichItem, integer filter returns boolean
            set filter = filter + 0x1
            if filter > 0x2000 then
                if filter > 0x800000 then
                    set filter = filter - 0x800000
                    if not IsItemVisible(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x400000 then
                    set filter = filter - 0x40000
                    if IsItemVisible(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x200000 then
                    set filter = filter - 0x200000
                    if GetItemType(whichItem)==ITEM_TYPE_MISCELLANEOUS then
                        return false
                    endif
                endif
                if filter > 0x100000 then
                    set filter = filter - 0x100000
                    if GetItemType(whichItem)!=ITEM_TYPE_MISCELLANEOUS then
                        return false
                    endif
                endif
                if filter > 0x80000 then
                    set filter = filter - 0x80000
                    if GetItemType(whichItem)==ITEM_TYPE_CAMPAIGN then
                        return false
                    endif
                endif
                if filter > 0x40000 then
                    set filter = filter - 0x40000
                    if GetItemType(whichItem)!=ITEM_TYPE_CAMPAIGN then
                        return false
                    endif
                endif
                if filter > 0x20000 then
                    set filter = filter - 0x20000
                    if GetItemType(whichItem)==ITEM_TYPE_PURCHASABLE then
                        return false
                    endif
                endif
                if filter > 0x10000 then
                    set filter = filter - 0x10000
                    if GetItemType(whichItem)!=ITEM_TYPE_PURCHASABLE then
                        return false
                    endif
                endif
                if filter > 0x8000 then
                    set filter = filter - 0x8000
                    if GetItemType(whichItem)==ITEM_TYPE_ARTIFACT then
                        return false
                    endif
                endif
                if filter > 0x4000 then
                    set filter = filter - 0x4000
                    if GetItemType(whichItem)!=ITEM_TYPE_ARTIFACT then
                        return false
                    endif
                endif
                if filter > 0x2000 then
                    set filter = filter - 0x2000
                    if GetItemType(whichItem)==ITEM_TYPE_POWERUP then
                        return false
                    endif
                endif
            endif
            if filter < 0x2001 then
                if filter > 0x1000 then
                    set filter = filter - 0x1000
                    if GetItemType(whichItem)!=ITEM_TYPE_POWERUP then
                        return false
                    endif
                endif
                if filter > 0x800 then
                    set filter = filter - 0x800
                    if GetItemType(whichItem)==ITEM_TYPE_CHARGED then
                        return false
                    endif
                endif
                if filter > 0x400 then
                    set filter = filter - 0x400
                    if GetItemType(whichItem)!=ITEM_TYPE_CHARGED then
                        return false
                    endif
                endif
                if filter > 0x200 then
                    set filter = filter - 0x200
                    if GetItemType(whichItem)==ITEM_TYPE_PERMANENT then
                        return false
                    endif
                endif
                if filter > 0x100 then
                    set filter = filter - 0x100
                    if GetItemType(whichItem)!=ITEM_TYPE_PERMANENT then
                        return false
                    endif
                endif
                if filter > 0x80 then
                    set filter = filter - 0x80
                    if IsItemPawnable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x40 then
                    set filter = filter - 0x40
                    if not IsItemPawnable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x20 then
                    set filter = filter - 0x20
                    if IsItemSellable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x10 then
                    set filter = filter - 0x10
                    if not IsItemSellable(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x8 then
                    set filter = filter - 0x8
                    if IsItemPowerup(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x4 then
                    set filter = filter - 0x4
                    if not IsItemPowerup(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x2 then
                    set filter = filter - 0x2
                    if IsItemOwned(whichItem) then
                        return false
                    endif
                endif
                if filter > 0x1 then
                    set filter = filter - 0x1
                    if not IsItemOwned(whichItem) then
                        return false
                    endif
                endif
            endif
            return true
        endfunction
     
        function PlayerFilter takes player whichPlayer, player otherPlayer, integer filter returns boolean
            if filter > 0x800 then
                set filter = filter - 0x800
                if GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_CONTROL) then
                    return false
                endif
            endif
            if filter > 0x400 then
                set filter = filter - 0x400
                if not GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_CONTROL) then
                    return false
                endif
            endif
            if filter > 0x200 then
                set filter = filter - 0x200
                if GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_VISION) then
                    return false
                endif
            endif
            if filter > 0x100 then
                set filter = filter - 0x100
                if not GetPlayerAlliance(whichPlayer,otherPlayer,ALLIANCE_SHARED_VISION) then
                    return false
                endif
            endif
            if filter > 0x80 then
                set filter = filter - 0x80
                if (whichPlayer==Player(12) or whichPlayer==Player(13) or whichPlayer==Player(14) or whichPlayer==Player(15)) then
                    return false
                endif
            endif
            if filter > 0x40 then
                set filter = filter - 0x40
                if (not(whichPlayer==Player(12) or whichPlayer==Player(13) or whichPlayer==Player(14) or whichPlayer==Player(15))) then
                    return false
                endif
            endif
            if filter > 0x20 then
                set filter = filter - 0x20
                if GetPlayerSlotState(whichPlayer)!=PLAYER_SLOT_STATE_LEFT then
                    return false
                endif
            endif
            if filter > 0x10 then
                set filter = filter - 0x10
                if GetPlayerSlotState(whichPlayer)!=PLAYER_SLOT_STATE_PLAYING then
                    return false
                endif
            endif
            if filter > 0x8 then
                set filter = filter - 0x8
                if GetPlayerController(whichPlayer)!=MAP_CONTROL_COMPUTER then
                    return false
                endif
            endif
            if filter > 0x4 then
                set filter = filter - 0x4
                if GetPlayerController(whichPlayer)!=MAP_CONTROL_USER then
                    return false
                endif
            endif
            if filter > 0x2 then
                set filter = filter - 0x2
                if IsPlayerEnemy(whichPlayer,otherPlayer) then
                    return false
                endif
            endif
            if filter > 0x1 then
                set filter = filter - 0x1
                if IsPlayerAlly(whichPlayer,otherPlayer) then
                    return false
                endif
            endif
            return true
        endfunction
    endlibrary
Solved thanks ( :
 
Top