1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Dismiss Notice
  5. The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Convenient Unit Group Filtering in GUI

Discussion in 'Trigger (GUI) Editor Tutorials' started by KILLCIDE, Apr 23, 2016.

  1. KILLCIDE

    KILLCIDE

    Administrator

    Joined:
    Jul 22, 2015
    Messages:
    3,504
    Resources:
    20
    Models:
    2
    Icons:
    10
    Spells:
    7
    Tutorials:
    1
    Resources:
    20
    Good idea! I will update it when I decide to fix the tutorial up a little bit more.
     
  2. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,413
    Resources:
    18
    Tools:
    2
    Maps:
    3
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    18
    The recommented way is also more efficent in question of performance.

    Cause the matching And/Or which you can't avoid when using matching, will test each insert condition regardless, if the result is already final.
    While the if conditions will skip further conditions if the result is final.

    Proof in attached map.
     

    Attached Files:

  3. Daffa

    Daffa

    Joined:
    Jan 30, 2013
    Messages:
    7,746
    Resources:
    28
    Packs:
    1
    Maps:
    8
    Spells:
    17
    Tutorials:
    2
    Resources:
    28
    Does nobody want to recommend the two trigger solution version? :p

    At least that would be useful for Spell Section.
     
  4. Tasyen

    Tasyen

    Joined:
    Jul 18, 2010
    Messages:
    1,413
    Resources:
    18
    Tools:
    2
    Maps:
    3
    Spells:
    8
    Tutorials:
    4
    JASS:
    1
    Resources:
    18
    Some time ago I also played around with this second trigger as condition Idea it can be a nice structed approach, if one is capable of such structed triggering. But I personaly had 2 problems with it.
    The first problem is it floots the trigger variableslist(probably also a problem of spell system), this problem can be weakened/countered by having a good naming for everything.

    You can't use all filters in any situation in one you check for friendship of trigger Unit to matching unit in the other you need attacking <> picked unit. This problem now requires either 2 filterTriggers or by introtrucing an unit variable. That same thing expands to you compared currently to picking or matching unit. Both require a different filter

    But after you found a good structed way to create all that your filters in the group filters are quite small and not as redundant as normaly.

    An example when casting holy light near organic non spell immune allies also should be healed by 100 Life.
    This is the filter for types it does not include the ally test so it can be used inside any matching filter:
    • Filter matching not Struct not Mech not SpellImmune
      • Events
      • Conditions
        • ((Matching unit) is A structure) Equal to False
        • ((Matching unit) is Mechanical) Equal to False
        • ((Matching unit) is Magic Immune) Equal to False
      • Actions

    Reuse the matching and check for allies
    • Filter Spell Holy Light
      • Events
      • Conditions
        • ((Matching unit) belongs to an ally of (Triggering player)) Equal to True
        • (Evaluate Filter matching not Struct not Mech not SpellImmune <gen> conditions) Equal to True
      • Actions

    The spellcast Trigger
    • SpellCast Holy Light
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to Holy Light
      • Actions
        • Set Loc = (Position of (Target unit of ability being cast))
        • Set Group = (Units within 512.00 of Loc matching ((Evaluate Filter Spell Holy Light <gen> conditions) Equal to True))
        • Unit Group - Remove (Target unit of ability being cast) from Group
        • Unit Group - Pick every unit in Group and do (Actions)
          • Loop - Actions
            • Unit - Set life of (Picked unit) to ((Life of (Picked unit)) + 100.00)
        • Custom script: call RemoveLocation(udg_Loc)
        • Custom script: call DestroyGroup(udg_Group)

    I think it looks pretty nice when one is capable of doing it and can handle so many triggers.

    Performance wise it is slower then the other 2 versions (tested using Lua os.clock() with 100 executions), although that does not matter much if it does not happen dozens of times a second.
     
    Last edited: Nov 9, 2019