Sharp blades v2

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: Lambdadelta
Releases random number between 4 and 7 Sharp blades, flying to target position. Each blade deals damage equal to ability level and slows target by 6% per blade for 3 seconds. Stackable. If the blade hit some destructible (like tree), it will cause 5-20 damage to the destructible.
Level 1 - 5 damage per blade
Level 2 - 10 damage per blade
Level 3 - 15 damage per blade
Level 4 - 20 damage per blade


  • init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • Set Speed = 25.00
      • Set Damage = 5.00
      • Visibility - Disable fog of war
      • Visibility - Disable black mask
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sharp blades
    • Actions
      • Set Point = (Position of (Triggering unit))
      • Set Point2 = (Target point of ability being cast)
      • Set Real = (Angle from Point to Point2)
      • Custom script: call RemoveLocation(udg_Point)
      • Custom script: call RemoveLocation(udg_Point2)
      • For each (Integer A) from 1 to (Random integer number between 4 and 7), do (Actions)
        • Loop - Actions
          • Set Point = (Position of (Triggering unit))
          • Set Point2 = (Point offset by (Random real number between 50.00 and 250.00) towards (Real + (Random real number between -40.00 and 40.00)) degrees)
          • Unit - Create 1 Projectile for (Owner of (Triggering unit)) at Point2 facing Real degrees
          • Unit - Set level of Sharp blades for (Last created unit) to (Level of Sharp blades for (Triggering unit))
          • Custom script: call RemoveLocation(udg_Point)
          • Custom script: call RemoveLocation(udg_Point2)
          • Hashtable - Save Real as (Key angle) of (Key (Last created unit)) in Hashtable
          • Hashtable - Save 0.00 as (Key Cdis) of (Key (Last created unit)) in Hashtable
          • Hashtable - Save (Random real number between 600.00 and 1000.00) as (Key Mdis) of (Key (Last created unit)) in Hashtable
          • Unit Group - Add (Last created unit) to Group_effect
      • Unit - Order (Triggering unit) to Stop
  • effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
      • (Number of units in Group_effect) Greater than 0
    • Actions
      • Unit Group - Pick every unit in Group_effect and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set Real = (Load (Key Cdis) of (Key (Picked unit)) from Hashtable)
              • Set Real2 = (Load (Key Mdis) of (Key (Picked unit)) from Hashtable)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Real Less than Real2
                • Then - Actions
                  • Set Unit = (Picked unit)
                  • Set Real = (Real + Speed)
                  • Hashtable - Save Real as (Key Cdis) of (Key (Picked unit)) in Hashtable
                  • Set Real = (Load (Key angle) of (Key (Picked unit)) from Hashtable)
                  • Set Point = (Position of (Picked unit))
                  • Set Point2 = (Point offset by Speed towards Real degrees)
                  • Custom script: call SetUnitX(udg_Unit, GetLocationX(udg_Point2))
                  • Custom script: call SetUnitY(udg_Unit, GetLocationY(udg_Point2))
                  • Custom script: call RemoveLocation(udg_Point)
                  • Custom script: call RemoveLocation(udg_Point2)
                  • Set Point = (Position of (Picked unit))
                  • Set Group = (Units within 50.00 of Point matching ((((Matching unit) is alive) Equal to True) and (((Picked unit) belongs to an enemy of (Owner of (Matching unit))) Equal to True)))
                  • Custom script: call RemoveLocation(udg_Point)
                  • Set Unit = (Random unit from Group)
                  • Custom script: call DestroyGroup(udg_Group)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Unit Not equal to No unit
                    • Then - Actions
                      • Unit - Cause (Picked unit) to damage Unit, dealing ((Real((Level of Sharp blades for (Picked unit)))) x Damage) damage of attack type Normal and damage type Normal
                      • Special Effect - Create a special effect attached to the chest of Unit using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Set Point = (Position of (Picked unit))
                      • Unit - Create 1 Sound1 for (Owner of (Picked unit)) at Point facing (Facing of (Picked unit)) degrees
                      • Unit - Order (Last created unit) to Attack Unit
                      • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                      • Custom script: call RemoveLocation(udg_Point)
                      • Unit - Remove (Picked unit) from the game
                      • Unit Group - Remove (Picked unit) from Group_effect
                      • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                    • Else - Actions
                      • Set Point = (Position of (Picked unit))
                      • Destructible - Pick every destructible within 50.00 of Point 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
                              • Set Point = (Position of (Picked destructible))
                              • Unit - Create 1 Sound1 for (Owner of (Picked unit)) at Point facing (Facing of (Picked unit)) degrees
                              • Unit - Order (Last created unit) to Attack (Picked destructible)
                              • Unit - Add a 0.50 second Generic expiration timer to (Last created unit)
                              • Custom script: call RemoveLocation(udg_Point)
                              • Unit - Remove (Picked unit) from the game
                              • Unit Group - Remove (Picked unit) from Group_effect
                              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
                            • Else - Actions
                      • Custom script: call RemoveLocation(udg_Point)
                • Else - Actions
                  • Set Point = (Position of (Picked unit))
                  • Special Effect - Create a special effect at Point using Abilities\Weapons\Rifle\RifleImpact.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_Point)
                  • Unit - Kill (Picked unit)
                  • Unit Group - Remove (Picked unit) from Group_effect
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Group_effect
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Hashtable


Keywords:
blade, sharp, trees, collision, bounce, MUI, advanced, ground, spell, cast, GUI, trigger
Contents

Sharp Blades v0.01 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 17:59, 17th Jan 2010 TriggerHappy: Cool spell. Appeared leakless and MUI. The only problem is you use custom value... port it to hashtables or something. Purgeandfire: Review...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

17:59, 17th Jan 2010
TriggerHappy:

Cool spell.
Appeared leakless and MUI.

The only problem is you use custom value... port it to hashtables or something.


Purgeandfire:

Review:
http://www.hiveworkshop.com/forums/2392377-post17.html
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You only need to set
  • Set TempPoint = (Position of (Triggering unit))
once in the cast trigger. Same thing in the loop trigger.

Turn the looping trigger on/off when needed.

The projectiles can appear from behind the casting unit.

The indexing system can bug with very high casting times.

When you create a projectile, add it to a static global group, and when it dies, remove it from that group. Use the group in the looping trigger, instead of creating and destroying a group.

What's this suposed to be?
  • (Terrain type at TempPoint) Equal to Lordaeron Summer - Grass
The tooltip is bad.

But it's quite cool spell :)
 
Level 25
Joined
Jun 5, 2008
Messages
2,573
I fail to see it colide with a wall :p

Anyway the spell description is a lol (Shoot[e]) make it better, have some imagination :p

Please replace the custom values by hashtable value.

Also you could have spared 1 more variable for a global static variable as Maker said, since i am suprised that the thing you are doing is actualy working at all.
 
Level 15
Joined
Jul 6, 2009
Messages
889
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SHot
    • Actions
      • For each (Integer A) from 1 to (Random integer number between 4 and 8), do (Actions)
        • Loop - Actions
          • Set Angle = 0.00
          • Set CustomInteger = (CustomInteger + 1)
          • Set TempPoint = (Position of (Triggering unit))
          • Set TempPoint2 = (Target point of ability being cast)
          • Set Angle = (Angle from TempPoint to TempPoint2)
          • Set Angle = (Angle + (Random real number between -10.00 and 10.00))
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Set TempPoint = (Position of (Triggering unit))
          • Set TempPoint2 = (TempPoint offset by (Random real number between -150.00 and 150.00) towards Angle degrees)
          • Unit - Create 1 Projectile for (Owner of (Triggering unit)) at TempPoint2 facing Angle degrees
          • Unit - Set the custom value of (Last created unit) to CustomInteger
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Unit - Order (Triggering unit) to Stop
  • effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units of type Projectile)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Custom script: call DestroyGroup(udg_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set TempInteger = (Custom value of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance[TempInteger] Less than 600.00
                • Then - Actions
                  • Set Distance[TempInteger] = (Distance[TempInteger] + (Random real number between 10.00 and 20.00))
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempPoint2 = (TempPoint offset by (Random real number between 20.00 and 40.00) towards (Facing of (Picked unit)) degrees)
                  • Unit - Move (Picked unit) instantly to TempPoint2
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Set TempPoint = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain type at TempPoint) Equal to Lordaeron Summer - Grass
                    • Then - Actions
                      • Custom script: call RemoveLocation(udg_TempPoint)
                      • Set TempPoint = (Position of (Picked unit))
                      • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                      • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                      • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempPoint)
                      • Unit - Remove (Picked unit) from the game
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempPoint = (Position of (Picked unit))
                  • Destructible - Pick every destructible within 75.00 of TempPoint 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
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - 4.00)
                          • Set TempPoint = (Position of (Picked unit))
                          • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                          • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                          • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Unit - Remove (Picked unit) from the game
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 50.00 of TempPoint matching ((Matching unit) Not equal to (Picked unit)))
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempUnit = (Random unit from TempGroup)
                  • Custom script: call DestroyGroup(udg_TempGroup)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempUnit Not equal to No unit
                      • (TempUnit is alive) Equal to True
                      • ((Picked unit) belongs to an enemy of (Owner of TempUnit)) Equal to True
                    • Then - Actions
                      • Unit - Cause (Picked unit) to damage TempUnit, dealing 50.00 damage of attack type Spells and damage type Normal
                      • Unit - Kill (Picked unit)
                      • Special Effect - Create a special effect attached to the chest of TempUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                • Else - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                  • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                  • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Unit - Remove (Picked unit) from the game
            • Else - Actions
This is a very cool spell indeed. The testmap is great unlike all those other shit ones that have all these messages and all these commands and all this crap filled terrain. They are shit. Why is yours great? Because you removed the cooldown (they still have a ESC refresh, but that's lame). No cooldown, which allowed me to pew pew the Footmen, really cool =) (+REP)

It would be nice if they faced the target location instantly, rather then a small delay. Or is this the model's fault?
 
Level 12
Joined
May 21, 2009
Messages
994
  • cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to SHot
    • Actions
      • For each (Integer A) from 1 to (Random integer number between 4 and 8), do (Actions)
        • Loop - Actions
          • Set Angle = 0.00
          • Set CustomInteger = (CustomInteger + 1)
          • Set TempPoint = (Position of (Triggering unit))
          • Set TempPoint2 = (Target point of ability being cast)
          • Set Angle = (Angle from TempPoint to TempPoint2)
          • Set Angle = (Angle + (Random real number between -10.00 and 10.00))
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
          • Set TempPoint = (Position of (Triggering unit))
          • Set TempPoint2 = (TempPoint offset by (Random real number between -150.00 and 150.00) towards Angle degrees)
          • Unit - Create 1 Projectile for (Owner of (Triggering unit)) at TempPoint2 facing Angle degrees
          • Unit - Set the custom value of (Last created unit) to CustomInteger
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call RemoveLocation(udg_TempPoint2)
      • Unit - Order (Triggering unit) to Stop
  • effect
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Set TempGroup = (Units of type Projectile)
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Custom script: call DestroyGroup(udg_TempGroup)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is alive) Equal to True
            • Then - Actions
              • Set TempInteger = (Custom value of (Picked unit))
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Distance[TempInteger] Less than 600.00
                • Then - Actions
                  • Set Distance[TempInteger] = (Distance[TempInteger] + (Random real number between 10.00 and 20.00))
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempPoint2 = (TempPoint offset by (Random real number between 20.00 and 40.00) towards (Facing of (Picked unit)) degrees)
                  • Unit - Move (Picked unit) instantly to TempPoint2
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Custom script: call RemoveLocation(udg_TempPoint2)
                  • Set TempPoint = (Position of (Picked unit))
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Terrain type at TempPoint) Equal to Lordaeron Summer - Grass
                    • Then - Actions
                      • Custom script: call RemoveLocation(udg_TempPoint)
                      • Set TempPoint = (Position of (Picked unit))
                      • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                      • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                      • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                      • Special Effect - Destroy (Last created special effect)
                      • Custom script: call RemoveLocation(udg_TempPoint)
                      • Unit - Remove (Picked unit) from the game
                    • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempPoint = (Position of (Picked unit))
                  • Destructible - Pick every destructible within 75.00 of TempPoint 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
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Destructible - Set life of (Picked destructible) to ((Current life of (Picked destructible)) - 4.00)
                          • Set TempPoint = (Position of (Picked unit))
                          • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                          • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                          • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • Custom script: call RemoveLocation(udg_TempPoint)
                          • Unit - Remove (Picked unit) from the game
                        • Else - Actions
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempPoint = (Position of (Picked unit))
                  • Set TempGroup = (Units within 50.00 of TempPoint matching ((Matching unit) Not equal to (Picked unit)))
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Set TempUnit = (Random unit from TempGroup)
                  • Custom script: call DestroyGroup(udg_TempGroup)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • TempUnit Not equal to No unit
                      • (TempUnit is alive) Equal to True
                      • ((Picked unit) belongs to an enemy of (Owner of TempUnit)) Equal to True
                    • Then - Actions
                      • Unit - Cause (Picked unit) to damage TempUnit, dealing 50.00 damage of attack type Spells and damage type Normal
                      • Unit - Kill (Picked unit)
                      • Special Effect - Create a special effect attached to the chest of TempUnit using Objects\Spawnmodels\Human\HumanBlood\BloodElfSpellThiefBlood.mdl
                      • Special Effect - Destroy (Last created special effect)
                    • Else - Actions
                • Else - Actions
                  • Set TempPoint = (Position of (Picked unit))
                  • Sound - Stop MetalLightChopMetal1 <gen> Immediately
                  • Sound - Play MetalLightChopMetal1 <gen> at 100.00% volume, located at TempPoint with Z offset 0.00
                  • Special Effect - Create a special effect at TempPoint using Abilities\Weapons\Rifle\RifleImpact.mdl
                  • Special Effect - Destroy (Last created special effect)
                  • Custom script: call RemoveLocation(udg_TempPoint)
                  • Unit - Remove (Picked unit) from the game
            • Else - Actions

Thank you.
 
To make unit's face an angle instantly you need to use a separate library since unit's have a specific turning speed.
Creating the units at an angle makes them face in the correct direction instantly. For me, in vJass, I have a library that recycles dummy units, with a stack based off what angle they were facing when recycled. This also means I can instantly change the angle of a dummy unit by replacing it with a dummy at the correct angle from the stack.
 
Review:
  • In your loop (when you create the units), don't use (Integer A). Use a custom integer variable for your loop. This is a new standard due to the fact that integer A can experience collisions/can be tampered with during the loop.

    e.g. Your loop creates a unit. Some event responds "A unit enters (playable map area)". In that event, they use (Integer A) for a loop. That means that Integer A will end up with a different value, and your loop may end sooner than you thought or it will bug out through some other means.
  • You shouldn't check:
    • (Number of units in Group_effect) Greater than 0
    Each time for a 0.03 second timer. It is pretty expensive. Instead, you should have a custom integer counter. When you add a unit to the group, increment it:
    • Unit Group - Add (Last created unit) to Group_effect
    • Set SB_Counter = SB_Counter + 1
    In the trigger "Cast", you should then have something like:
    • If (SB_Counter is Greater than 0) then do (Trigger - Turn on effect <gen>) else ...
    Then in the trigger "effect", you would decrement the counter each time you remove a unit from the group:
    • Unit Group - Remove (Picked unit) from Group_effect
    • Set SB_Counter = SB_Counter - 1
    • If SB_Counter is Equal to 0 then do (Trigger - Turn off effect <gen>)
    Something along those lines^. It is pseudo code so it won't be exact.

    This makes it so that the timer won't unnecessarily run when there are no active instances. When an instance is activated, it'll turn on the trigger. Once there are no more flying blades left (a.k.a. no units in the group) it will turn off the trigger.
  • As a bonus tip, you should use more descriptive trigger names and variable names. The current standard is to prefix your variables with the name of the trigger. So in your case, perhaps you would do "SB_" as a prefix. As for the trigger names, instead of "Cast" you should have "Sharp Blades Cast" or something similar. Same for "effect". Otherwise, when someone is copying the triggers over, they may not realize what it is for.

Fix those and it should be approvable.
 
Top