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

Cutting Glaive v1.9

Description:
Send a glaive that travels towards a targeted point, on impact with unit deals 100, 200, 300 damage in AoE of 250 and then finds a new target within 750 AoE. Glaive will die when it will travel more then 1000 range or no units will be in the needed location.

Triggers:

[trigger=Cutting Glaive Settings]Cutting Glaive Settings
Events
Map initialization
Conditions
Actions
-------- ----------------------------------------- --------
-------- AoE of Damage --------
-------- ----------------------------------------- --------
Set CG_AoE1 = 250.00
-------- ----------------------------------------- --------
-------- AoE of Glaive Search Target, it is a Full AoE in which the Glaive will Find Next Target --------
-------- ----------------------------------------- --------
Set CG_AoE2 = 750.00
-------- ----------------------------------------- --------
-------- Setting Speed of Moving, Higher Value - Higher Speed --------
-------- ----------------------------------------- --------
Set CG_Speed = 20.00

[/trigger]


[trigger=Cutting Glaive Cast]Cutting Glaive
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Cutting |c0020c000G|rlaive
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CG_Index Equal to 0
Then - Actions
Trigger - Turn on Cutting Glaive Loop <gen>
Else - Actions
Set CG_Index = (CG_Index + 1)
Set CG_Index2 = (CG_Index2 + 1)
-------- ----------------------------------------- --------
-------- Setting number of jumps, if needed, if you want to enable this option set the CG_Check to True, and of course set the number of jumps. --------
-------- ----------------------------------------- --------
Set CG_Check = False
Set CG_Jumps[CG_Index2] = (((Level of (Ability being cast) for (Triggering unit)) x 2) + 4)
-------- ----------------------------------------- --------
-------- Damage --------
-------- ----------------------------------------- --------
Set CG_Damage[CG_Index2] = (Real(((Level of (Ability being cast) for (Triggering unit)) x 100)))
-------- ----------------------------------------- --------
-------- Setting Caster --------
-------- ----------------------------------------- --------
Set CG_Caster[CG_Index2] = (Triggering unit)
-------- ----------------------------------------- --------
-------- Setting Position of Caster --------
-------- ----------------------------------------- --------
Set CG_Point1 = (Position of (Triggering unit))
-------- ----------------------------------------- --------
-------- Setting First Target Where Glaive will Move to --------
-------- ----------------------------------------- --------
Set CG_Point3 = (Target point of ability being cast)
-------- ----------------------------------------- --------
-------- Setting Angle --------
-------- ----------------------------------------- --------
Set CG_Angle[CG_Index2] = (Angle from CG_Point1 to CG_Point3)
-------- ----------------------------------------- --------
-------- Setting Distance of Glaive --------
-------- ----------------------------------------- --------
Set CG_Distance[CG_Index2] = (Distance between CG_Point1 and CG_Point3)
-------- ----------------------------------------- --------
-------- Creating a Dummy "Glaive" --------
-------- ----------------------------------------- --------
Unit - Create 1 Dummy for (Owner of (Triggering unit)) at CG_Point1 facing Default building facing degrees
Set CG_Dummy[CG_Index2] = (Last created unit)
Custom script: call RemoveLocation(udg_CG_Point1)
Custom script: call RemoveLocation(udg_CG_Point3)
[/trigger]


  • Cutting Glaive Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer CG_Index3) from 1 to CG_Index2, do (Actions)
        • Loop - Actions
          • -------- ----------------------------------------- --------
          • -------- Setting Position of Dummy --------
          • -------- ----------------------------------------- --------
          • Set CG_Point1 = (Position of CG_Dummy[CG_Index3])
          • -------- ----------------------------------------- --------
          • -------- Setting Position Where it Should Move Next --------
          • -------- ----------------------------------------- --------
          • Set CG_Point2 = (CG_Point1 offset by CG_Speed towards CG_Angle[CG_Index3] degrees)
          • -------- ----------------------------------------- --------
          • -------- Now We Move the Dummy --------
          • -------- ----------------------------------------- --------
          • Unit - Move CG_Dummy[CG_Index3] instantly to CG_Point2
          • -------- ----------------------------------------- --------
          • -------- Subtracting Distance equal to Speed, if Distance Expires WE Damage the Units --------
          • -------- ----------------------------------------- --------
          • Set CG_Distance[CG_Index3] = (CG_Distance[CG_Index3] - CG_Speed)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CG_Distance[CG_Index3] Less than or equal to 10.00
            • Then - Actions
              • -------- ----------------------------------------- --------
              • -------- Damage and Effects are Apllied Here --------
              • -------- Dummy 2 Is a FanofKnives Effect, i Create With Dummy Because If i Create It As Effect and Destroy It After it Creation if Wont Show --------
              • -------- ----------------------------------------- --------
              • Unit - Create 1 Dummy 2 for Neutral Passive at CG_Point1 facing Default building facing degrees
              • Unit - Add a 1.60 second Generic expiration timer to (Last created unit)
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within CG_AoE1 of CG_Point1 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 CG_Caster[CG_Index3])) Equal to True)))) and do (Actions)
                • Loop - Actions
                  • Unit - Cause CG_Caster[CG_Index3] to damage (Picked unit), dealing CG_Damage[CG_Index3] damage of attack type Spells and damage type Normal
                  • Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Critters\Albatross\CritterBloodAlbatross.mdl
                  • Special Effect - Destroy (Last created special effect)
              • -------- ----------------------------------------- --------
              • -------- Setting Location of Searched Target, if the Glaive will Reach that Location but No Target Will be There it Will Explode --------
              • -------- ----------------------------------------- --------
              • Set CG_UnitGroup[CG_Index3] = (Units within CG_AoE2 of CG_Point1 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 CG_Caster[CG_Index3])) Equal to True))))
              • Set CG_Target[CG_Index3] = (Random unit from CG_UnitGroup[CG_Index3])
              • Set CG_Point3 = (Position of CG_Target[CG_Index3])
              • -------- ----------------------------------------- --------
              • -------- Setting New Angle --------
              • -------- ----------------------------------------- --------
              • Set CG_Angle[CG_Index3] = (Angle from CG_Point1 to CG_Point3)
              • -------- ----------------------------------------- --------
              • -------- Setting New Distance --------
              • -------- ----------------------------------------- --------
              • Set CG_Distance[CG_Index3] = (Distance between CG_Point1 and CG_Point3)
              • -------- ----------------------------------------- --------
              • -------- Clearing leak --------
              • -------- ----------------------------------------- --------
              • Custom script: call RemoveLocation(udg_CG_Point3)
              • -------- ----------------------------------------- --------
              • -------- If we use jumps we subtract one --------
              • -------- ----------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • CG_Check Equal to True
                • Then - Actions
                  • Set CG_Jumps[CG_Index3] = (CG_Jumps[CG_Index3] - 1)
                • Else - Actions
              • -------- ----------------------------------------- --------
              • -------- If the Glaive will Reach His Distance but No Target Will be There It Will Explde --------
              • -------- Or --------
              • -------- If the Distance will Become To Big It Will Explode, in Here I Add 250 More Range, so The to Explode Dummy Must be Far Then 750 + 250 == 1000 Range --------
              • -------- Or --------
              • -------- If Only One Unit Left. To Prevent Glaive of Damaging Him All the Time --------
              • -------- Or --------
              • -------- If Jumps Expired, If This Option Was Selected --------
              • -------- ----------------------------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Number of units in CG_UnitGroup[CG_Index3]) Equal to 1
                      • CG_Distance[CG_Index3] Greater than or equal to (CG_AoE2 + 250.00)
                      • (CG_Target[CG_Index3] is dead) Equal to True
                      • (CG_Check Equal to True) and (CG_Jumps[CG_Index3] Equal to 0)
                • Then - Actions
                  • -------- ----------------------------------------- --------
                  • -------- Clearing Leaks, Turning This Trigger Off --------
                  • -------- ----------------------------------------- --------
                  • Unit - Explode CG_Dummy[CG_Index3]
                  • Set CG_Index = (CG_Index - 1)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • CG_Index Equal to 0
                    • Then - Actions
                      • Set CG_Index2 = 0
                      • Trigger - Turn off (This trigger)
                    • Else - Actions
                • Else - Actions
              • Custom script: call DestroyGroup(udg_CG_UnitGroup[udg_CG_Index3])
            • Else - Actions
          • Custom script: call RemoveLocation(udg_CG_Point1)
          • Custom script: call RemoveLocation(udg_CG_Point2)
If you have any suggestions feel free to tell them!
GIVE CREDITS IF YOU USE IT!!!


Changelog:

-19.03.11 15:11 - created;
-19.03.11 15:47
removed the unneeded Unit Group variable;
-19.03.11 04:15
the AoE variable have been divided into two;
deleted custom script: call DestroyGroup...;
-19.03.11 21:55
if one unit left spell will be turned off;
added an FanofKnifes effect;
-20.03.11 09:48
removed repeating custom scripts, which clears leaks, they where twice running;
-20.03.11 11:33
added option where you can chose if you want to chose the jumps and how much;
-21.03.11 18:43
removed arrays from point variables;
-29.06.11 23:45
removed unneeded custom scirpts that where running three times;
some changes in OE;
-18.07.11 10:30
placed the script of destroying group into the right place.
Time +2 GMT!!!
Thanks for help to: Adiktuz, Bribe, baassee and Maker

Keywords:
Glaive, Jump, Suriken, Knife, Sharp, Cut
Contents

Cutting Glaive (Map)

Reviews
15:42, 28th Jun 2011 Maker: Approved.
dont put the description on a Code block, it makes it hard to read...

checking the triggers...

hmm, I think its better to put the check to turn on the loop, at the end of the cast trigger...

add the support to increase the AOE per level, and also the AoE variables are better off as two different variables rather than an array where you only use two indexes... And its useless to set them every cast, just make an init trigger which sets them to reduce the number of functions called per cast...
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
In the loop trigger,

  • Set CG_UnitGroup[CG_Index3] = (Units within CG_AoE[2] of CG_Point[CG_Index3] 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 CG_Caster[CG_Index3])) Equal to True))))
  • -------- ----------------------------------------- --------
  • -------- Setting Location of Searched Target, if the Glaive will Reach that Location but No Target Will be There it Will Explode --------
  • -------- ----------------------------------------- --------
  • Set CG_Target[CG_Index3] = (Random unit from CG_UnitGroup[CG_Index3])
  • Set CG_Point3[CG_Index3] = (Position of CG_Target[CG_Index3])
  • -------- ----------------------------------------- --------
  • -------- Destroying Group --------
  • -------- ----------------------------------------- --------
  • Custom script: call DestroyGroup(udg_CG_UnitGroup[udg_CG_Index3])
It could be simplified into:

  • -------- ----------------------------------------- --------
  • -------- Setting Location of Searched Target, if the Glaive will Reach that Location but No Target Will be There it Will Explode --------
  • -------- ----------------------------------------- --------
  • Custom script: set bj_wantDestroyGroup = true
  • Set CG_Target[CG_Index3] = (Random unit from (Units within CG_AoE[2] of CG_Point[CG_Index3] 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 CG_Caster[CG_Index3])) Equal to True)))))
  • Set CG_Point3[CG_Index3] = (Position of CG_Target[CG_Index3])
Random unit from (Unit group) is destroyable with bj_wantDestroyGroup :)
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
The aoe real variable should be splitted into two different variables. Useless to be arrayed when using for two different values and not more.

I'd prefer attacktype and damagatype too but isn't that important.

You set the damage variable into a value but you don't use it.

  • Unit - Cause CG_Caster[CG_Index3] to damage (Picked unit), dealing ((Real((Level of Cutting |c0020c000G|rlaive for CG_Caster[CG_Index3]))) x 100.00) damage of attack type Pierce and damage type Normal
The temporary points doesn't need to be prefixed nor arrayed.
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
  • Custom script: call RemoveLocation(udg_CG_Point[udg_CG_Index3])
  • Custom script: call RemoveLocation(udg_CG_Point2[udg_CG_Index3])
Isn't needed after the or any if. They're removed after the whole if part so you are removing them twice.

STILL the temporary points should be non-arrayed.
 
Level 12
Joined
Apr 16, 2010
Messages
584
your changelog is useless... its more of a chronolog...
changing...
Isn't needed after the or any if. They're removed after the whole if part so you are removing them twice.
removed
STILL the temporary points should be non-arrayed.
Well this the way i made all the spells... Could you tell me why it's bad or something? =)

Edit: updated, changelog is now fine.
 
Level 12
Joined
Apr 16, 2010
Messages
584
is it supposed to hit units untill there are no more?
Yes!
because i think it will be better if it could hit 5-6 targets and then stop...
Well here's a problem, every spell that has something to do with jumps has a limit, even my Bouncing Ball, but this time i tried something original - no limit :p Well i guess i could an option where you choose the limit, if you want to use it.
very nice spell man!! 5/5
Thanks!!!
 
Level 22
Joined
Nov 14, 2008
Messages
3,256
Well this the way i made all the spells... Could you tell me why it's bad or something? =)


Then you should change them there too. A temporary variable should be non-arrayed and used instantly as wc3 is single threaded, it will not bug with any other instances as long as they're not passed on into another period.

You make it arrayed to either store it between periods or if you need VERY MANY point variables. But you don't need that many, you need 3 and that's probably maximum for each spell too.

An arrayed variable takes more space than 3 single non-arrayed variables. That's the major hint here. Dunno if Bribe even cares about this but I do as I only see waste of space in the user's maps if they use spells that have arrayed temporary variables.

Now you might complain that it's not that much space. But with many spells like this, more space taken.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Dunno if Bribe even cares about this but I do as I only see waste of space in the user's maps if they use spells that have arrayed temporary variables.

I care about this, there are just so many other flaws in most GUI scripts that are more pertinent. I am still weighing how strict I should be on these resources as I've been rejecting a lot more than I've been approving.
 
Top