[Trigger] Spell - Anything Wrong with these triggers?

Status
Not open for further replies.
Level 7
Joined
Aug 5, 2010
Messages
147
Created a custom aura ability that creates a random minion using a corpse. Their are 3 different minions that can be created.
  • Spell Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Corpse Aura --------
      • Set Corpse_Archer[1] = Skeletal Archer
      • Set Corpse_Archer[2] = Skeletal Archer
      • Set Corpse_Archer[3] = Skeletal Archer
      • Set Corpse_Archer[4] = Skeletal Archer
      • Set Corpse_Archer[5] = Skeletal Archer
      • Set Corpse_Archer[6] = Skeletal Archer
      • Set Corpse_Archer[7] = Skeletal Archer
      • Set Corpse_Archer[8] = Skeletal Archer
      • Set Corpse_Archer[9] = Skeletal Archer
      • Set Corpse_Archer[10] = Skeletal Archer
      • Set Corpse_Mage[1] = Skeletal Mage
      • Set Corpse_Mage[2] = Skeletal Mage
      • Set Corpse_Mage[3] = Skeletal Mage
      • Set Corpse_Mage[4] = Skeletal Mage
      • Set Corpse_Mage[5] = Skeletal Mage
      • Set Corpse_Mage[6] = Skeletal Mage
      • Set Corpse_Mage[7] = Skeletal Mage
      • Set Corpse_Mage[8] = Skeletal Mage
      • Set Corpse_Mage[9] = Skeletal Mage
      • Set Corpse_Mage[10] = Skeletal Mage
      • Set Corpse_Warrior[1] = Skeletal Warrior
      • Set Corpse_Warrior[2] = Skeletal Warrior
      • Set Corpse_Warrior[3] = Skeletal Warrior
      • Set Corpse_Warrior[4] = Skeletal Warrior
      • Set Corpse_Warrior[5] = Skeletal Warrior
      • Set Corpse_Warrior[6] = Skeletal Warrior
      • Set Corpse_Warrior[7] = Skeletal Warrior
      • Set Corpse_Warrior[8] = Skeletal Warrior
      • Set Corpse_Warrior[9] = Skeletal Warrior
      • Set Corpse_Warrior[10] = Skeletal Warrior
The units are the same because i havent created the units yet.
  • Corpse Learn
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Death Knight [Str]
    • Actions
      • Set Corpse_Hero = (Triggering unit)
      • Set Corpse_Owner = (Owner of (Triggering unit))
      • Trigger - Turn on Corpse Animate <gen>
      • Trigger - Turn off (This trigger)
  • Corpse Animate
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set Corpse_HPoint = (Position of Corpse_Hero)
      • Set Corpse_Group = (Units within 600.00 of Corpse_HPoint matching ((((Matching unit) is dead) Equal to True) and ((((Matching unit) is An Ancient) Equal to False) and (((Matching unit) is A Hero) Equal to False))))
      • Unit Group - Pick every unit in (Random 2 units from Corpse_Group) and do (Actions)
        • Loop - Actions
          • Set Corpse_Spawn = (Random integer number between 1 and 3)
          • Set Corpse_Point = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Corpse_Spawn Equal to 1
            • Then - Actions
              • Unit - Create 1 Corpse_Archer[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
              • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
              • Unit - Remove (Picked unit) from the game
              • Custom script: call RemoveLocation(udg_Corpse_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Corpse_Spawn Equal to 2
                • Then - Actions
                  • Unit - Create 1 Corpse_Mage[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
                  • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                  • Unit - Remove (Picked unit) from the game
                  • Custom script: call RemoveLocation(udg_Corpse_Point)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Corpse_Spawn Equal to 3
                    • Then - Actions
                      • Unit - Create 1 Corpse_Warrior[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
                      • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                      • Unit - Remove (Picked unit) from the game
                      • Custom script: call RemoveLocation(udg_Corpse_Point)
                    • Else - Actions
      • Custom script: call RemoveLocation(udg_Corpse_HPoint)
      • Custom script: call DestroyGroup(udg_Corpse_Group)
 
Level 7
Joined
Aug 5, 2010
Messages
147
  • Only works for a single unit.
  • There's a chance Corpse_Point will leak if the conditions aren't meant for the following statement.
  • (Random 2 units from Corpse_Group) - leaks.
  • Your 3 if statements can be reduced to 1

    (Corpse_Spawn Less Than 4 and Corpse_Spawn Greater Than 0)

Theirs only going to be 1 instance of the hero at a time so no need to make it MUI.

Would removing the point on the final, empty else action fix it or would putting it after the Unit group action fix it?

How does random 2 units Leak? is it because 2 isnt set to a Integer variable or because of the group?

Id still need single If statements to decide what unit to spawn.
  • Corpse Animate
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set Corpse_HPoint = (Position of Corpse_Hero)
      • Set Corpse_Group = (Units within 600.00 of Corpse_HPoint matching ((((Matching unit) is dead) Equal to True) and ((((Matching unit) is An Ancient) Equal to False) and (((Matching unit) is A Hero) Equal to False))))
      • Unit Group - Pick every unit in (Random Corpse_Amount units from Corpse_Group) and do (Actions)
        • Loop - Actions
          • Set Corpse_Spawn = (Random integer number between 1 and 3)
          • Set Corpse_Point = (Position of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Corpse_Spawn Equal to 1
            • Then - Actions
              • Unit - Create 1 Corpse_Archer[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
              • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
              • Special Effect - Destroy (Last created special effect)
              • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
              • Unit - Remove (Picked unit) from the game
              • Custom script: call RemoveLocation(udg_Corpse_Point)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Corpse_Spawn Equal to 2
                • Then - Actions
                  • Unit - Create 1 Corpse_Mage[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
                  • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                  • Unit - Remove (Picked unit) from the game
                  • Custom script: call RemoveLocation(udg_Corpse_Point)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Corpse_Spawn Equal to 3
                    • Then - Actions
                      • Unit - Create 1 Corpse_Warrior[(Level of Corpse Aura [Passive] for Corpse_Hero)] for Corpse_Owner at Corpse_Point facing (Random angle) degrees
                      • Special Effect - Create a special effect at Corpse_Point using Abilities\Spells\Undead\RaiseSkeletonWarrior\RaiseSkeleton.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Unit - Add a 10.00 second Generic expiration timer to (Last created unit)
                      • Unit - Remove (Picked unit) from the game
                      • Custom script: call RemoveLocation(udg_Corpse_Point)
                    • Else - Actions
                      • -------- Put this Here? --------
                      • Custom script: call RemoveLocation(udg_Corpse_Point)
      • Custom script: call RemoveLocation(udg_Corpse_HPoint)
      • Custom script: call DestroyGroup(udg_Corpse_Group)
 
Would removing the point on the final, empty else action fix it or would putting it after the Unit group action fix it?

After the if statement inside the unit group.

You can check if it's null before deleting.

How does random 2 units Leak? is it because 2 isnt set to a Integer variable or because of the group?

It creates another group.

Id still need single If statements to decide what unit to spawn.

Combine the 3 arrays, initialize 0-30, then use the following for the array index.

[(Level of Corpse Aura [Passive] for Corpse_Hero) * Corpse_Spawn]
 
Status
Not open for further replies.
Top