Fan of Knives v1.1

This bundle is marked as approved. It works and satisfies the submission rules.
  • Like
Reactions: -Derp-
Jazztastic Presents
Fan of Knives
Spell Specs
-MUI
-2 Main triggers + 1 Variable trigger
-1200 range
-The user can easily edit the duration,
# of daggers, damage, area of effect, and speed.
204466-albums4802-picture59627.jpg
Uses and Theme
This spell fits the theme because it involves
the throwing of daggers at enemies, a skill
any assassin worth his salt could do. Instead
of throwing one tiny dagger that somehow
deals tons of damage, I decided my assassin
would spam a ton of knives at low damage
each. Just click on a unit or point and the
assassin will throw the knives. You can also
click on yourself and it will go in a circle.
204466-albums4802-picture59626.jpg

204466-albums4802-picture59625.jpg

204466-albums4802-picture59624.jpg

  • Hashtable Variables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set FoK_hashtable = (Last created hashtable)
      • -------- ------------- --------
      • -------- ------------- --------
      • -------- To use this ability past level 4 you must extend these arrays so they have values --------
      • -------- If you change the aoe here you should probably also change it on the OE skill, so they match --------
      • -------- ------------- --------
      • -------- ------------- --------
      • -------- Edit the number of knives spawned --------
      • Set knivecount[1] = 6
      • Set knivecount[2] = 12
      • Set knivecount[3] = 18
      • Set knivecount[4] = 24
      • -------- Edit the area of effect --------
      • Set knivesaoe[1] = 160.00
      • Set knivesaoe[2] = 160.00
      • Set knivesaoe[3] = 160.00
      • Set knivesaoe[4] = 160.00
      • -------- Edit the area of effect of the damage --------
      • -------- This value is used to pick a random unit within its range. --------
      • -------- If it's too large the knives will do their damage and be destroyed before they "reach" their target --------
      • Set knivesdamageaoe[1] = 80.00
      • Set knivesdamageaoe[2] = 80.00
      • Set knivesdamageaoe[3] = 80.00
      • Set knivesdamageaoe[4] = 80.00
      • -------- Edit the damage per knife --------
      • Set knivesdamage[1] = 10.00
      • Set knivesdamage[2] = 10.00
      • Set knivesdamage[3] = 10.00
      • Set knivesdamage[4] = 10.00
      • -------- Edit the duration of the knives --------
      • Set knivesduration[1] = 1.20
      • Set knivesduration[2] = 1.20
      • Set knivesduration[3] = 1.20
      • Set knivesduration[4] = 1.20
      • -------- Edit the projectile speed of the knives --------
      • Set knivesspeed[1] = 30.00
      • Set knivesspeed[2] = 30.00
      • Set knivesspeed[3] = 30.00
      • Set knivesspeed[4] = 30.00
      • -------- Edit the random height of the projectiles. The first value is the minimum, the second is the maximum. --------
      • Set flyingheight[1] = 20.00
      • Set flyingheight[2] = 200.00
  • Fan of Knives
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Fan of Knives
    • Actions
      • -------- Setting variables --------
      • Set caster = (Triggering unit)
      • Set level = (Level of Fan of Knives for caster)
      • Set point1 = (Target point of ability being cast)
      • Set point2 = (Position of caster)
      • -------- Creates the knives --------
      • For each (Integer i) from 1 to knivecount[level], do (Actions)
        • Loop - Actions
          • Unit - Create 1 Fan of Knives for (Owner of caster) at point2 facing Default building facing degrees
          • Set target = (Last created unit)
          • Animation - Change target flying height to (Random real number between flyingheight[1] and flyingheight[2]) at 0.00
          • Unit Group - Add target to FanofKnivesGroup
          • Custom script: set udg_handle = GetHandleId(udg_target)
          • Set point3 = (point1 offset by (Random real number between 0.00 and knivesaoe[level]) towards (Random angle) degrees)
          • Set angle = (Angle from point2 to point3)
          • Set timer = knivesduration[level]
          • Hashtable - Save angle as 1 of handle in FoK_hashtable
          • Hashtable - Save timer as 2 of handle in FoK_hashtable
          • Hashtable - Save Handle Ofcaster as 3 of handle in FoK_hashtable
          • Custom script: call RemoveLocation(udg_point3)
      • -------- Clearing point leaks --------
      • Custom script: call RemoveLocation(udg_point1)
      • Custom script: call RemoveLocation(udg_point2)
      • Trigger - Turn on Fan of Knives Loop <gen>
  • Fan of Knives Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in FanofKnivesGroup and do (Actions)
        • Loop - Actions
          • -------- Setting variables --------
          • Set target = (Picked unit)
          • Custom script: set udg_handle = GetHandleId(udg_target)
          • Set timer = (Load 2 of handle from FoK_hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • timer Greater than 0.00
            • Then - Actions
              • Set caster = (Load 3 of handle in FoK_hashtable)
              • Set ownerplayer = (Owner of caster)
              • Set level = (Level of Fan of Knives for caster)
              • Set point1 = (Position of target)
              • Set angle = (Load 1 of handle from FoK_hashtable)
              • Set point2 = (point1 offset by knivesspeed[level] towards angle degrees)
              • Unit - Move target instantly to point2, facing angle degrees
              • -------- Checking to see if the knife should deal its damage --------
              • Custom script: set bj_wantDestroyGroup = true
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in (Units within knivesdamageaoe[level] of point2 matching ((((Matching unit) belongs to an enemy of ownerplayer) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A structure) Equal to False))))) Greater than 0
                • Then - Actions
                  • -------- Deal the damage --------
                  • Custom script: set bj_wantDestroyGroup = true
                  • Unit - Cause caster to damage (Random unit from (Units within knivesdamageaoe[level] of point2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of ownerplayer) Equal to True))))), dealing knivesdamage[level] damage of attack type Pierce and damage type Normal
                  • -------- Clear leaks --------
                  • Unit - Kill target
                  • Hashtable - Clear all child hashtables of child handle in FoK_hashtable
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Number of units in FanofKnivesGroup) Equal to 0
                    • Then - Actions
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
                  • Hashtable - Save (timer - 0.03) as 2 of handle in FoK_hashtable
            • Else - Actions
              • -------- Clear leaks --------
              • Unit - Kill target
              • Hashtable - Clear all child hashtables of child handle in FoK_hashtable
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in FanofKnivesGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions

Keywords:
Fan, Knives, Fan of Knives, Assassin, dagger, sword, damage, aoe, physical
Contents

Just another Warcraft III map (Map)

Reviews
10:01, 22nd Jul 2012 Magtheridon96: This is a very adequate spell despite it's simplicity. It would be better if (Owner of caster) is cached into a variable because it's being called inside a loop and thus will be repeated again and again and...

Moderator

M

Moderator

10:01, 22nd Jul 2012
Magtheridon96: This is a very adequate spell despite it's simplicity.

It would be better if (Owner of caster) is cached into a variable because it's being called inside a loop and thus will be repeated again and again and again though.
What would be also be nice is having the ability to easily configure the height range of the blades and the damage AoE too.

I guess I will approve this.
(If I set it to "Rejected", I would forget to get back to it after the contest.)

edit
One other thing, you forgot to give this a decent tooltip.
 
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Number of units in (Units within 80.00 of point2 matching ((((Matching unit) belongs to an enemy of (Owner of target)) Equal to True) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is A structure) Equal to False))))) Greater than 0
  • Then - Actions
  • Custom script: set bj_wantDestroyGroup = true
  • Unit - Cause caster to damage (Random unit from (Units within 80.00 of point2 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of target)) Equal to True))))), dealing knivesdamage[level] damage of attack type Pierce and damage type Normal
  • Unit - Kill target
  • Hashtable - Clear all child hashtables of child handle in FoK_hashtable
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
  • (Number of units in FanofKnivesGroup) Equal to 0
  • Then - Actions
  • Trigger - Turn off (This trigger)
  • Else - Actions
  • Else - Actions
  • Hashtable - Save (timer - 0.03) as 2 of handle in FoK_hashtable
A unit group in this part leaks.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Just one thing : set the movement type of the Fan of Knives unit to NONE (in the Object Editor). This way they can pass trough cliffs and non-playable map area. Otherwise the knives fly over cliffs like flying units, which is just crap. Also, when they reach the end of the map, they just maintain their angle, moving to the left or right, but they don't move forward. Test this and see what i'm talking about.

This is not a big problem but i thought you should know this. I haven't looked at the code... otherwise the spell is not bad.
 
@eubz: Not true, the "set bj_wantDestroyGroup = true" tells the enumeration that the group should be destroyed.

@CoLd_Bon3: That can be fixed using another method:


@Jazztastic: The method you can use here is factoring in the terrain Z.
Terrain Z + Flying height = Unit Z

To maintain a constant Unit Z for a varying, you should set the flying height to your height - Terrain Z.

You can get terrain Z by using the native GetLocationZ which takes a location. (set udg_z = GetLocationZ(udg_TempLoc).
 
Level 16
Joined
Apr 4, 2011
Messages
997
Just one thing : set the movement type of the Fan of Knives unit to NONE (in the Object Editor). This way they can pass trough cliffs and non-playable map area. Otherwise the knives fly over cliffs like flying units, which is just crap. Also, when they reach the end of the map, they just maintain their angle, moving to the left or right, but they don't move forward. Test this and see what i'm talking about.

This is not a big problem but i thought you should know this. I haven't looked at the code... otherwise the spell is not bad.

If they kept going into the edge of the map and actually went off the map it would bug and crash the game.

If the movement was set to none they could go through cliffs and still hit units when they are under the cliffs. That's a no-no aswell.

@Mag I might fix that up specifically for the contest. I'm going to have to change the tooltips and a few small things anyways.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
If they kept going into the edge of the map and actually went off the map it would bug and crash the game.
I set the movement type to none and everything worked well, the knives went off the map but the game didn't crashed. If the movement type is none, you can solve the problem with the cliffs too. Simply check if the knife is nearing a cliff and remove it, so that it can't pass trough it. Otherwise the knives increase height and fly over cliffs which is just.. crap.
 
Level 2
Joined
Jul 14, 2012
Messages
15
Or you could set it to Hover so instead of flying above terrain or passing through solid material like real knives do, it actually stops when it hits something.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Or you could set it to Hover so instead of flying above terrain or passing through solid material like real knives do, it actually stops when it hits something.
Yes but there will still be a problem.
Also, when they reach the end of the map, they just maintain their angle, moving to the left or right, but they don't move forward. Test this and see what i'm talking about.
The same thing will happen but when reaching a cliff instead. This will still happen at the end of the map...
 
Top