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

[Trigger] Long Trigger needs to be shortened

Status
Not open for further replies.
Level 20
Joined
Apr 14, 2012
Messages
2,901
Hello...

I made my first ever spell after I read the 'Static Shapes (GUI)' and 'Dynamic Effects (GUI)' Tutorial by Daelin, because I figured I could give it a try.
The triggers I made for the spell is a little long and I hope there's a way to shorten it. I wasn't really a good coder then, actually now I'm starting to improve slowly.

Also if there are any errors can you point it out? That would really help.

  • Dark Arts Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dark Arts
    • Actions
      • Set Caster = (Triggering unit)
      • Set Location = (Position of Caster)
      • Environment - Create a 10.00 second Depression ripple deformation at Location with starting radius 1024.00, ending radius 1024.00, and depth 64.00, using 1.00 second ripples spaced 512.00 apart
      • Environment - Change terrain type at (Position of Caster) to Outland - Rough Dirt Cliff using variation -1 in an area of size 4 and shape Circle
      • Environment - Change terrain type at (Position of Caster) to Outland - Flat Stones using variation -1 in an area of size 3 and shape Circle
      • Unit - Make Caster Invulnerable
      • Special Effect - Create a special effect at Location using Abilities\Spells\Other\Awaken\Awaken.mdl
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real((Integer A))) x (360.00 / 36.00)) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(1)) x -70.00) degrees) facing Location
      • Unit Group - Add (Last created unit) to Unit_Group
      • Wait 0.05 seconds
      • Set Dummy_Unit[1] = (Last created unit)
      • Set Point[1] = (Position of Dummy_Unit[1])
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(2)) x -70.00) degrees) facing Location
      • Unit Group - Add (Last created unit) to Unit_Group
      • Set Dummy_Unit[2] = (Last created unit)
      • Set Point[2] = (Position of Dummy_Unit[2])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(3)) x -70.00) degrees) facing Location
      • Unit Group - Add (Last created unit) to Unit_Group
      • Set Dummy_Unit[3] = (Last created unit)
      • Set Point[3] = (Position of Dummy_Unit[3])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(4)) x -70.00) degrees) facing Location
      • Unit Group - Add (Last created unit) to Unit_Group
      • Set Dummy_Unit[4] = (Last created unit)
      • Set Point[4] = (Position of Dummy_Unit[4])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(5)) x -70.00) degrees) facing Location
      • Unit Group - Add (Last created unit) to Unit_Group
      • Set Dummy_Unit[5] = (Last created unit)
      • Set Point[5] = (Position of Dummy_Unit[5])
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[2] offset by ((Real((Integer A))) x ((Distance between Point[2] and Point[4]) / 36.00)) towards (Angle from Point[2] to Point[4]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[4] offset by ((Real((Integer A))) x ((Distance between Point[4] and Point[1]) / 36.00)) towards (Angle from Point[4] to Point[1]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[1] offset by ((Real((Integer A))) x ((Distance between Point[1] and Point[3]) / 36.00)) towards (Angle from Point[1] to Point[3]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[3] offset by ((Real((Integer A))) x ((Distance between Point[3] and Point[5]) / 36.00)) towards (Angle from Point[3] to Point[5]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[5] offset by ((Real((Integer A))) x ((Distance between Point[5] and Point[2]) / 36.00)) towards (Angle from Point[5] to Point[2]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Wait 0.01 seconds
          • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[1] offset by ((Real((Integer A))) x ((Distance between Point[1] and Point[2]) / 36.00)) towards (Angle from Point[1] to Point[2]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[2] offset by ((Real((Integer A))) x ((Distance between Point[2] and Point[3]) / 36.00)) towards (Angle from Point[2] to Point[3]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[3] offset by ((Real((Integer A))) x ((Distance between Point[3] and Point[4]) / 36.00)) towards (Angle from Point[3] to Point[4]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[4] offset by ((Real((Integer A))) x ((Distance between Point[4] and Point[5]) / 36.00)) towards (Angle from Point[4] to Point[5]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[5] offset by ((Real((Integer A))) x ((Distance between Point[5] and Point[1]) / 36.00)) towards (Angle from Point[5] to Point[1]) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[1] offset by ((Real((Integer A))) x ((Distance between Point[1] and Location) / 36.00)) towards (Angle from Point[1] to Location) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[2] offset by ((Real((Integer A))) x ((Distance between Point[2] and Location) / 36.00)) towards (Angle from Point[2] to Location) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[3] offset by ((Real((Integer A))) x ((Distance between Point[3] and Location) / 36.00)) towards (Angle from Point[3] to Location) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[4] offset by ((Real((Integer A))) x ((Distance between Point[4] and Location) / 36.00)) towards (Angle from Point[4] to Location) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
          • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[5] offset by ((Real((Integer A))) x ((Distance between Point[5] and Location) / 36.00)) towards (Angle from Point[5] to Location) degrees) facing Location
          • Unit Group - Add (Last created unit) to Unit_Group
      • Wait 1.40 seconds
      • Unit Group - Pick every unit in Unit_Group and do (Actions)
        • Loop - Actions
          • Unit - Kill (Picked unit)
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call RemoveLocation(udg_Point[2])
      • Custom script: call RemoveLocation(udg_Point[3])
      • Custom script: call RemoveLocation(udg_Point[4])
      • Custom script: call RemoveLocation(udg_Point[5])
      • Custom script: call DestroyGroup(udg_Unit_Group)
Thank you.

Sincerely,
MasterTrainer
 
Level 16
Joined
Jul 31, 2012
Messages
2,217
  • Dark Arts Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Dark Arts
    • Actions
      • Set Caster = (Triggering unit)
      • Set Location = (Position of Caster)
      • Environment - Create a 10.00 second Depression ripple deformation at Location with starting radius 1024.00, ending radius 1024.00, and depth 64.00, using 1.00 second ripples spaced 512.00 apart
      • Environment - Change terrain type at (Position of Caster) to Outland - Rough Dirt Cliff using variation -1 in an area of size 4 and shape Circle
      • Environment - Change terrain type at (Position of Caster) to Outland - Flat Stones using variation -1 in an area of size 3 and shape Circle
      • Unit - Make Caster Invulnerable
      • Special Effect - Create a special effect at Location using Abilities\Spells\Other\Awaken\Awaken.mdl
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real((Integer A))) x (360.00 / 36.00)) degrees) facing Location
          • Unit - add 1.61 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(1)) x -70.00) degrees) facing Location
      • Unit - add 1.61 seconds expiration timer for (Last created unit)
      • Set Dummy_Unit[1] = (Last created unit)
      • Set Point[1] = (Position of Dummy_Unit[1])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(2)) x -70.00) degrees) facing Location
      • Unit - add 1.56 seconds expiration timer for (Last created unit)
      • Set Dummy_Unit[2] = (Last created unit)
      • Set Point[2] = (Position of Dummy_Unit[2])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(3)) x -70.00) degrees) facing Location
      • Unit - add 1.51 seconds expiration timer for (Last created unit)
      • Set Dummy_Unit[3] = (Last created unit)
      • Set Point[3] = (Position of Dummy_Unit[3])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(4)) x -70.00) degrees) facing Location
      • Unit - add 1.46 seconds expiration timer for (Last created unit)
      • Set Dummy_Unit[4] = (Last created unit)
      • Set Point[4] = (Position of Dummy_Unit[4])
      • Wait 0.05 seconds
      • Unit - Create 1 Dummy 1 for Neutral Passive at (Location offset by 600.00 towards ((Real(5)) x -70.00) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)
      • Set Dummy_Unit[5] = (Last created unit)
      • Set Point[5] = (Position of Dummy_Unit[5])
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set integer x = (For loop integer A)
          • Trigger - Run Dark Arts Second
      • Wait 0.01 seconds
      • For each (Integer A) from 1 to 36, do (Actions)
        • Loop - Actions
          • Set integer x = (For loop integer A)
          • Trigger - Run Dark Arts Third
      • Wait 1.40 seconds
      • Unit - Make (Caster) Vulnerable
      • Custom script: call RemoveLocation(udg_Point[1])
      • Custom script: call RemoveLocation(udg_Point[2])
      • Custom script: call RemoveLocation(udg_Point[3])
      • Custom script: call RemoveLocation(udg_Point[4])
      • Custom script: call RemoveLocation(udg_Point[5])
      • Custom script: call DestroyGroup(udg_Unit_Group)

  • Dark Arts Second
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[2] offset by ((Real((Integer x))) x ((Distance between Point[2] and Point[4]) / 36.00)) towards (Angle from Point[2] to Point[4]) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[4] offset by ((Real((Integer x))) x ((Distance between Point[4] and Point[1]) / 36.00)) towards (Angle from Point[4] to Point[1]) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[1] offset by ((Real((Integer x))) x ((Distance between Point[1] and Point[3]) / 36.00)) towards (Angle from Point[1] to Point[3]) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[3] offset by ((Real((Integer x))) x ((Distance between Point[3] and Point[5]) / 36.00)) towards (Angle from Point[3] to Point[5]) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 2 for Neutral Passive at (Point[5] offset by ((Real((Integer x))) x ((Distance between Point[5] and Point[2]) / 36.00)) towards (Angle from Point[5] to Point[2]) degrees) facing Location
      • Unit - add 1.41 seconds expiration timer for (Last created unit)

  • Dark Arts Third
    • Events
    • Conditions
    • Actions
      • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[1] offset by ((Real((Integer A))) x ((Distance between Point[1] and Point[2]) / 36.00)) towards (Angle from Point[1] to Point[2]) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[2] offset by ((Real((Integer A))) x ((Distance between Point[2] and Point[3]) / 36.00)) towards (Angle from Point[2] to Point[3]) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[3] offset by ((Real((Integer A))) x ((Distance between Point[3] and Point[4]) / 36.00)) towards (Angle from Point[3] to Point[4]) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[4] offset by ((Real((Integer A))) x ((Distance between Point[4] and Point[5]) / 36.00)) towards (Angle from Point[4] to Point[5]) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 3 for Neutral Passive at (Point[5] offset by ((Real((Integer A))) x ((Distance between Point[5] and Point[1]) / 36.00)) towards (Angle from Point[5] to Point[1]) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[1] offset by ((Real((Integer A))) x ((Distance between Point[1] and Location) / 36.00)) towards (Angle from Point[1] to Location) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[2] offset by ((Real((Integer A))) x ((Distance between Point[2] and Location) / 36.00)) towards (Angle from Point[2] to Location) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[3] offset by ((Real((Integer A))) x ((Distance between Point[3] and Location) / 36.00)) towards (Angle from Point[3] to Location) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[4] offset by ((Real((Integer A))) x ((Distance between Point[4] and Location) / 36.00)) towards (Angle from Point[4] to Location) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
      • Unit - Create 1 Dummy 4 for Neutral Passive at (Point[5] offset by ((Real((Integer A))) x ((Distance between Point[5] and Location) / 36.00)) towards (Angle from Point[5] to Location) degrees) facing Location
      • Unit - add 1.40 seconds expiration timer for (Last created unit)
 
Last edited:
Level 20
Joined
Apr 14, 2012
Messages
2,901
Yes do tht and no u don't need to set it to anything b4 the loop. When u do for each integer variable from 1 to 20 for example it does it from 1 to 20

Okay... last question: Can I use the same integer var. for each loop or do I assign a different integer var. for different loops or use an array integer var. for different loops?
 
Status
Not open for further replies.
Top