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

Need help with my Trigger

Status
Not open for further replies.
Level 8
Joined
Jul 17, 2004
Messages
283
There is only 1 unit type of every unit inside these unit groups, so it's okay if the unit groups are nested, right? Other wise, how would I set this up without nested unit groups? What would be most efficient? And is this leakless as well?

  • Change Job - Ninja
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Ninja
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
      • (Triggering unit) Equal to SoldierRED[1]
    • Actions
      • Set TempUnit = (Triggering unit)
      • Set TempAttribute_STR = (Strength of TempUnit (Exclude bonuses))
      • Set TempAttribute_AGI = (Agility of TempUnit (Exclude bonuses))
      • Set TempAttribute_INT = (Intelligence of TempUnit (Exclude bonuses))
      • Unit - Remove Change Job from TempUnit
      • Set TempPoint = (Position of TempUnit)
      • Set TempPoint2 = (Center of JOBS RED GROUP1 <gen>)
      • Unit - Move TempUnit instantly to TempPoint2, facing 270.00 degrees
      • Custom script: call RemoveLocation( udg_TempPoint2)
      • Set TempUnitGroup = (Units in JOBS RED GROUP1 <gen> matching ((Unit-type of (Matching unit)) Equal to Thief))
      • Unit Group - Pick every unit in TempUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Hero level of (Picked unit)) Greater than or equal to 4
            • Then - Actions
              • Set TempUnitGroup2 = (Units in JOBS RED GROUP1 <gen> matching ((Unit-type of (Matching unit)) Equal to Archer))
              • Unit Group - Pick every unit in TempUnitGroup2 and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Hero level of (Picked unit)) Greater than or equal to 3
                    • Then - Actions
                      • Set TempUnitGroup3 = (Units in JOBS RED GROUP1 <gen> matching ((Unit-type of (Matching unit)) Equal to Oracle))
                      • Unit Group - Pick every unit in TempUnitGroup3 and do (Actions)
                        • Loop - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • (Hero level of (Picked unit)) Greater than or equal to 2
                            • Then - Actions
                              • Set TempUnitGroup4 = (Units in JOBS RED GROUP1 <gen> matching ((Unit-type of (Matching unit)) Equal to Ninja))
                              • Unit Group - Pick every unit in TempUnitGroup4 and do (Actions)
                                • Loop - Actions
                                  • Set SoldierRED[1] = (Picked unit)
                                  • Hero - Modify Strength of SoldierRED[1]: Set to TempAttribute_STR
                                  • Hero - Modify Agility of SoldierRED[1]: Set to TempAttribute_AGI
                                  • Hero - Modify Intelligence of SoldierRED[1]: Set to TempAttribute_INT
                                  • Unit - Move SoldierRED[1] instantly to TempPoint, facing 270.00 degrees
                                  • Selection - Select SoldierRED[1] for (Owner of TempUnit)
                                  • Special Effect - Create a special effect attached to the origin of SoldierRED[1] using Abilities\Spells\Undead\DeathPact\DeathPactTarget.mdl
                                  • Special Effect - Destroy (Last created special effect)
                              • Custom script: call DestroyGroup(udg_TempUnitGroup4)
                            • Else - Actions
                      • Custom script: call DestroyGroup(udg_TempUnitGroup3)
                    • Else - Actions
              • Custom script: call DestroyGroup(udg_TempUnitGroup2)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of SoldierRED[1]) Equal to Ninja
        • Then - Actions
          • Unit - Add Change Job to TempUnit
        • Else - Actions
          • Unit - Move TempUnit instantly to TempPoint, facing 270.00 degrees
          • Set TempPlayerGroup = (Player group((Owner of TempUnit)))
          • Game - Display to TempPlayerGroup for 0.50 seconds the text: |cffffcc00You don't...
          • Game - Display to TempPlayerGroup for 0.50 seconds the text:
          • Custom script: call DestroyForce(udg_TempPlayerGroup)
      • Custom script: call RemoveLocation( udg_TempPoint)
      • Custom script: call DestroyGroup(udg_TempUnitGroup)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
It's just heavier and slower, and it's a bad practice to do things unefficiently when you can do it in a better way.
 
Status
Not open for further replies.
Top