• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Can someone check over triggers please?

Status
Not open for further replies.
Level 8
Joined
Jun 1, 2008
Messages
341
Hey these are just triggers for a basic MPI Spell for a map, I have no plans to submit the spell or anything, but i want it simple for my map and at the moment it is.

So if at all posible could someone check over my triggers have a quick look for leaks and perhaps a few suggestions for improved efficiency, as there will be a new "3" 'blast' unitS created aproximately every 0.25 seconds at some points in game and i need as little lag as possible.
  • Blast Cast
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Blast
    • Actions
      • Set TempUnit1 = (Casting unit)
      • Set TempPoint1 = (Position of TempUnit1)
      • Set TempPoint2 = (Target point of ability being cast)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Blast for TempUnit1) Equal to 1
        • Then - Actions
          • Set TempInteger = 1
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of Blast for TempUnit1) Equal to 2
            • Then - Actions
              • Set TempInteger = 0
            • Else - Actions
              • Set TempInteger = -1
      • Set TempGroup2 = (Units of type Blast (Dark))
      • Set TempGroup3 = (Units of type Blast (Light))
      • Unit Group - Add all units of TempGroup3 to TempGroup2
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup2) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: (String((Number of units in TempGroup2)))
          • Trigger - Turn on Blast Loop <gen>
        • Else - Actions
      • For each (Integer A) from TempInteger to 1, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of TempUnit1) Equal to Servent Of Darkness
            • Then - Actions
              • Unit - Create 1 Blast (Dark) for (Owner of TempUnit1) at TempPoint1 facing ((Angle from TempPoint1 to TempPoint2) + ((Real((Integer A))) x 5.00)) degrees
            • Else - Actions
              • Unit - Create 1 Blast (Light) for (Owner of TempUnit1) at TempPoint1 facing ((Angle from TempPoint1 to TempPoint2) + ((Real((Integer A))) x 5.00)) degrees
          • Set TempUnit2 = (Last created unit)
          • Unit - Turn collision for TempUnit2 Off
          • Unit - Set the custom value of TempUnit2 to (600 + (25 x (Level of TempUnit1)))
          • Unit - Set level of Ability Level for TempUnit2 to (Level of TempUnit1)
          • Unit - Add Storm Crow Form to TempUnit2
          • Unit - Remove Storm Crow Form from TempUnit2
          • Animation - Change TempUnit2 flying height to 70.00 at 0.00
      • Unit - Order TempUnit1 to Stop
      • Animation - Change TempUnit1's animation speed to 300.00% of its original speed
      • Animation - Queue TempUnit1's attack animation
  • Blast Loop
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup1 = (Units of type Blast (Dark))
      • Set TempGroup2 = (Units of type Blast (Light))
      • Unit Group - Add all units of TempGroup2 to TempGroup1
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TempGroup1) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Skip remaining actions
        • Else - Actions
      • Unit Group - Pick every unit in TempGroup1 and do (Actions)
        • Loop - Actions
          • Set TempUnit1 = (Picked unit)
          • Set TempPoint1 = (Position of TempUnit1)
          • Set TempPoint2 = (TempPoint1 offset by 15.00 towards (Facing of TempUnit1) degrees)
          • Unit - Move TempUnit1 instantly to TempPoint2
          • Unit - Set the custom value of TempUnit1 to ((Custom value of TempUnit1) - 15)
          • Destructible - Pick every destructible in (Region centered at TempPoint2 with size (175.00, 175.00)) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of TempUnit1) Equal to Blast (Dark)
                    • Then - Actions
                      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                  • Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - 25.00)
                  • Unit - Remove TempUnit1 from the game
                  • Skip remaining actions
                • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Custom value of TempUnit1) Less than or equal to 0
                  • (Terrain pathing at TempPoint2 of type Walkability is off) Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of TempUnit1) Equal to Blast (Dark)
                • Then - Actions
                  • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
                • Else - Actions
                  • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                  • Special Effect - Destroy (Last created special effect)
              • Unit - Remove TempUnit1 from the game
            • Else - Actions
              • Set TempGroup2 = (Units within 50.00 of TempPoint2 matching ((((Matching unit) is alive) Equal to True) and (((Owner of (Matching unit)) is an enemy of (Owner of TempUnit1)) Equal to True)))
              • Unit Group - Pick every unit in TempGroup2 and do (Actions)
                • Loop - Actions
                  • Set TempUnit2 = (Picked unit)
                  • Set TempPoint3 = (Position of TempUnit2)
                  • Unit - Cause TempUnit1 to damage TempUnit2, dealing (20.00 + (10.00 x (Real((Level of Ability Level for TempUnit1))))) damage of attack type Spells and damage type Normal
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Unit-type of TempUnit1) Equal to Blast (Dark)
                    • Then - Actions
                      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                      • Special Effect - Create a special effect at TempPoint2 using Abilities\Weapons\VengeanceMissile\VengeanceMissile.mdl
                      • Special Effect - Destroy (Last created special effect)
                  • Unit - Remove TempUnit1 from the game
Thanks in advance :D
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I'm just checking the first trigger since I'm in a bit of a rush:

  • Use Triggering unit in place of Casting unit.
  • The way you set TempInteger can be simplified with
    • Set TempInteger = 2 - (Level of Blast for TempUnit1)
  • You could set TempGroup2 to something like
    • Set TempGroup2 = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to Blast (Dark)) or ((Unit-type of (Matching unit)) Equal to Blast (Light))))
    Same goes for whenever you do something else like this
  • Are you sure this is right?
    • (Number of units in TempGroup2) Equal to 0
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
- yh i am sure that bit is right.
Okay, I was just checking since it seemed strange to me when I glanced at it. I thought you wanted the Blast Loop to run on when there were at least one unit in TempGroup2 since it seems like Blast Loop would turn off if there weren't any.

Anyway, on to improvements:

  • You're leaking unit groups and locations. If you don't know how to remove them, check out this link.
  • For those if-then-else where you make a different effect depending on the type of unit, you could move
    • Special Effect - Destroy (Last created special effect)
    outside since it will be done regardless of what kind of effect was created.
  • Use the event
    • Unit - A unit Starts the effect of an ability
    since that's less abusable than the event you're using and fires when the casting unit actually used up mana.
That's all I really had to add.

Oh and you may want to decrease the timer periodic event to something like 0.03 since it's not really a big difference to the human eye but can improve game performance. If you actually do this, make sure to change your distance things and other variables dependent on time accordingly.
 
Status
Not open for further replies.
Top