• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] Need help to improve my trigger

Status
Not open for further replies.
Level 3
Joined
Jul 24, 2010
Messages
54
Charge Trigger

Well, i need someone who can help to improve my spells a little a bit, or could've been said a lot.
The spell was a Charge, based on DotA's Charge of Darkness, except i don't give it a bonus movement speed and attack speed after the charge.
The spell uses following trigger.

  • CoD Hash
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Creating the Hashtable --------
      • Hashtable - Create a hashtable
      • -------- Set the Hashtable --------
      • Set CoD_Hash = (Last created hashtable)
  • CoD Set
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Charge
    • Actions
      • -------- Who's the caster --------
      • Set CoD_Caster = (Triggering unit)
      • -------- Who's the target --------
      • Set CoD_Target = (Target unit of ability being cast)
      • -------- Charge speed based on ability's level --------
      • Set CoD_Move_Speed = (10.00 + (15.00 x (Real((Level of Charge for CoD_Caster)))))
      • -------- Duration of the Knockbacked unit --------
      • Set CoD_Dur = 0.80
      • -------- Knockback Speed --------
      • Set CoD_Knockback_Speed = 10.00
      • -------- Saving the handles of the unit and caster to the hashtable --------
      • Hashtable - Save Handle OfCoD_Caster as 1 of (Key (Triggering unit)) in CoD_Hash
      • Hashtable - Save Handle OfCoD_Target as 2 of (Key (Triggering unit)) in CoD_Hash
      • -------- Add the Caster to the group --------
      • Unit Group - Add (Triggering unit) to CoD_Group
  • CoD Charge
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in CoD_Group and do (Actions)
        • Loop - Actions
          • -------- Load the caster from the Hashtable --------
          • Set CoD_Caster = (Load 1 of (Key (Picked unit)) in CoD_Hash)
          • -------- Load the target from the Hashtable --------
          • Set CoD_Target = (Load 2 of (Key (Picked unit)) in CoD_Hash)
          • -------- Make the caster to face the target --------
          • Unit - Make CoD_Caster face CoD_Target over 0.00 seconds
          • -------- Set the distance between the caster and the target --------
          • Set CoD_Distance = (Distance between (Position of CoD_Caster) and (Position of CoD_Target))
          • -------- IF THEN ELSE --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CoD_Distance Greater than 135.00
              • ((Picked unit) is Stunned) Equal to False
            • Then - Actions
              • -------- Creates the special effect of the charge --------
              • Set Temp = (Position of CoD_Caster)
              • Special Effect - Create a special effect at Temp using Abilities\Weapons\DemolisherFireMissile\DemolisherFireMissile.mdl
              • Special Effect - Destroy (Last created special effect)
              • Custom script: call RemoveLocation(udg_Temp)
              • -------- Set the angle between the caster and the target --------
              • Set CoD_Angle = (Angle from (Position of CoD_Caster) to (Position of CoD_Target))
              • -------- Turn off the collision of the caster to --------
              • Unit - Turn collision for CoD_Caster Off
              • -------- Charging the caster --------
              • Set Temp = ((Position of CoD_Caster) offset by CoD_Move_Speed towards CoD_Angle degrees)
              • Unit - Move (Picked unit) instantly to Temp
              • Custom script: call RemoveLocation(udg_Temp)
              • -------- Pick every unit nearby the charger --------
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within 140.00 of (Position of CoD_Caster)) and do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked unit) Not equal to CoD_Caster
                      • ((Picked unit) is alive) Equal to True
                      • ((Picked unit) belongs to an ally of (Owner of CoD_Caster)) Equal to False
                    • Then - Actions
                      • Set CoD_Knockback = (Picked unit)
                      • Hashtable - Save CoD_Dur as 3 of (Key (Picked unit)) in CoD_Hash
                      • Unit Group - Add (Picked unit) to CoD_Knockback_Group
                    • Else - Actions
            • Else - Actions
              • -------- Remove the caster from the group --------
              • Unit Group - Remove (Picked unit) from CoD_Group
              • -------- Turn on the collision for the caster --------
              • Unit - Turn collision for CoD_Caster On
      • Unit Group - Pick every unit in CoD_Knockback_Group and do (Actions)
        • Loop - Actions
          • -------- Load the current time from the hashtable --------
          • Set CoD_Dur = (Load 3 of (Key (Picked unit)) from CoD_Hash)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • CoD_Dur Greater than 0.00
            • Then - Actions
              • -------- Save the current time to the hashtable --------
              • Hashtable - Save (CoD_Dur - 0.04) as 3 of (Key (Picked unit)) in CoD_Hash
              • -------- Knockback the unit --------
              • Set Temp = ((Position of (Picked unit)) offset by CoD_Knockback_Speed towards (Angle from (Position of CoD_Caster) to (Position of (Picked unit))) degrees)
              • Unit - Move (Picked unit) instantly to Temp
              • Custom script: call RemoveLocation(udg_Temp)
              • -------- Creates a speical effect to the knockacked unit --------
              • Special Effect - Create a special effect attached to the origin of (Picked unit) using Abilities\Weapons\AncientProtectorMissile\AncientProtectorMissile.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • -------- Remove the knockbacked unit from the game --------
              • Unit Group - Remove (Picked unit) from CoD_Knockback_Group
However :
- I know there's a leaks somewhere
- The spell's is not efficient
- The special effects are horrible
- I wanna know if this spell will meets the Hive's spell rule?

Note : This is my first spell enhanced trigger....
 
Last edited:
Remove this:
  • Do Nothing
Do Nothing literally does nothing. Its a waste of bytes. And in good maps, bytes are important.

Your unit group leaks. Add
  • Custom Script: set bj_wantDestroyGroup = true
This destroys the group automatically when its done being used. Or if you would rather manually destroy it because you want to reuse it, then set it to a trigger:
  • set Variable = Group
  • ....
  • Custom Script: call DestroyGroup(udg_Group)
Will add more, still reading.
 
LOL, i never thought that Do Nothing was actually making the trigger a bit slower, and thanks for spotting out the leaks...
And for the Impale dust effect, it's really fit perfectly as it should be, +rep for both of you
And for the efficient, it's what makes my trigger really easy to read by other user who want to edit it....
 
  • The looping trigger should be initially off. Turn it on when you add a unit into the group and turn it off when you remove a unit from it, and the group is empty
  • I'd use 0.03 second loop since it looks smoother than 0.04 second loop
  • Do "Unit is alive" checks in the looping trigger
  • Two leaks
    • Set CoD_Distance = (Distance between (Position of CoD_Caster) and (Position of CoD_Target))
  • Two leaks
    • Set CoD_Angle = (Angle from (Position of CoD_Caster) to (Position of CoD_Target))
  • One leak
    • Set Temp = ((Position of CoD_Caster) offset by CoD_Move_Speed towards CoD_Angle degrees)
  • One leak
    • (the position)Unit Group - Pick every unit in (Units within 140.00 of (Position of CoD_Caster)) and do (Actions)
  • Filter out dead units and structures from being added into the knockback group
  • It looks like you're creating an effect on the caster every 0.04 seconds, you shouldn't create it that often
  • You should turn the collision off for the caster in the cast trigger, not in the looping trigger
  • Three leaks
    • Set Temp = ((Position of (Picked unit)) offset by CoD_Knockback_Speed towards (Angle from (Position of CoD_Caster) to (Position of (Picked unit))) degrees)
 
Status
Not open for further replies.
Back
Top