Better Filtering for this Action.

Level 6
Joined
Apr 15, 2016
Messages
118
It's known that doing things like this:
  • Actions
    • Unit Group - Pick Every Unit in MyGroup
      • Set TempUnit = Picked Unit
      • If All Conditions are true then do (Actions):
      • Conditions
        • TempUnit is a Filter
        • TempUnitnit is filter 2
      • Actions
        • Dance with TempUnit

is somewhat faster than using Matching Condition (Matching Unit is a Filter).

However, how would you do something like the first Trigger Filtering in a scenario like this:

  • Actions
    • Set MyGroup = Unit in range matching filters
    • Set LuckyOrCursedUnit = Random 1 Unit from ChosenGroup

And no, the following doesn't work:

  • Actions
    • Unit Group - Pick Every Unit in MyGroup
      • Set TempUnit = Picked Unit
      • If All Conditions are true then do (Actions):
      • Conditions
        • TempUnit is a Filter
        • TempUnitnit is filter 2
      • Actions
        • Set TempUnit = Random Unit from MyGroup
        • Dance with TempUnit
 
Level 24
Joined
Feb 27, 2019
Messages
833
The important part is that its easier to work with. Its pleasurable to view, easy to understand, easy to change. If it was slower, the benefit would still be worth it for most sane people.

To get a random unit by doing something like that one could:
1. Add the valid units to a secondary group, the units in the secondary group will be valid options.
2. Invert the conditions and remove units from the group, the units remaining in the group will be valid options.
 
Top