• 🏆 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!

Create 30 things. How to create special effects over half?

Status
Not open for further replies.
Level 8
Joined
Aug 1, 2008
Messages
420
I made 30 Rocks for my spell, and created special effects for them when they spawn. But it could be a bit laggy on slower computers, so my question: how would you put special effects on half?
Sample trigger:
  • For each (Integer WallOfRock_Integer) from 1 to 30, do (Actions)
    • Loop - Actions
      • Special Effect - Create a special effect at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
      • Set WallOfRock_SpecialEffect = (Last created special effect)
      • Destructible - Create a Pathing Blocker (Ground) at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) facing WallOfRock_Angle with scale 1.00 and variation 0
      • Set WallOfRock_PathingBlocker[WallOfRock_Integer] = (Last created destructible)
      • Unit - Create 1 Wall of Rock rock for (Owner of WallOfRock_Caster) at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) facing WallOfRock_TargetPoint
      • Set WallOfRock_Rocks[WallOfRock_Integer] = (Last created unit)
      • Special Effect - Destroy WallOfRock_SpecialEffect
How i would i make it go over half of the rocks? Do i have to put every second rock into a group?

I was thinking something like
  • For each (Integer WallOfRock_Integer + 1)
, but you cant do that. I doubt that would even work.

anyway, +rep for people that help.
 
Level 11
Joined
Feb 11, 2010
Messages
199
Very simple. Make an integer "Wallspam" that increases with each iteration of the loop. If Wallspam = (whatever), you execute the thing you want to execute a fraction of the time the loop executes and set Wallspam back to zero. Very simple, do it all the time. :thumbs_up:

This method is also very easy to edit. You can just increase Wallspam up until the highest point that you still think it looks good, while having the minimum number of effects.

  • Set Wallspam = 0
  • For each (Integer WallOfRock_Integer) from 1 to 30, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Wallspam Equal to 1
          • Then - Actions
            • Special Effect - Create a special effect at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) using Abilities\Spells\Other\Volcano\VolcanoDeath.mdl
            • Special Effect - Destroy (Last created special effect)
            • Set Wallspam = 0
          • Else - Actions
            • Set Wallspam = (Wallspam + 1)
        • Destructible - Create a Pathing Blocker (Ground) at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) facing WallOfRock_Angle with scale 1.00 and variation 0
        • Set WallOfRock_PathingBlocker[WallOfRock_Integer] = (Last created destructible)
        • Unit - Create 1 Wall of Rock rock for (Owner of WallOfRock_Caster) at (WallOfRock_TargetPoint offset by 500.00 towards ((Real(WallOfRock_Integer)) x 12.00) degrees) facing WallOfRock_TargetPoint
        • Set WallOfRock_Rocks[WallOfRock_Integer] = (Last created unit)
Here's one example spell I made that uses this method: http://www.hiveworkshop.com/forums/pastebin_data/z07hsl/_files/Crimson%20Shadow.w3x

I have lots of examples of using this method, because I use it all the time for things like cutting the number of "dust" models I make popup for a knockback effect to 1/5 or less of what it would have been.

Your setting the special effect to a variable is superfluous, also. You can just destroy the last created special effect instantly and it would have the same effect as the original trigger you gave.
 
Status
Not open for further replies.
Top