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

Spiritual Disrupt v1.1

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: Wolf_Wing

HERO releases a spiritual wave from his ancient totem by slamming his totem.The wave heads towards the targeted point while the repulsive force around the wave pushes the enemies.Along it's path the wave causes a certain damage to the enemies.

[Level 1] - Deals 90 damage and pushes enemies with a weak force. The wave Travels to 800 distance.
[Level 2] - Deals 120 damage and pushes enemies with a moderate force. The wave Travels to 1100 distance.
[Level 3] - Deals 150 damage and pushes enemies with a strong force. The wave Travels to 1400 distance.
[Level 4] - Deals 180 damage and pushes enemies with an extreme force. The wave Travels to 1700 distance.

Cooldown - 4,3.5,3,2.5 seconds.



  • spr Config
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Sets the ability to activate the trigger --------
      • Set spr_ability = Spiritual Disrupt
      • -------- The animation string for the caster[The "slam" animation is set bcuz it looks good on Tauren] --------
      • Set spr_caster_animation = slam
      • -------- Damage dealt to the enemies[Arrays are Levels e.g. Array 1 = Level 1] --------
      • Set spr_damage[1] = 90.00
      • Set spr_damage[2] = 120.00
      • Set spr_damage[3] = 150.00
      • Set spr_damage[4] = 180.00
      • -------- Is the picked units a structure?? --------
      • Set spr_condition[1] = False
      • -------- Do the picked units belong to the enemy of the caster?? --------
      • Set spr_condition[2] = True
      • -------- Is the Picked Unit Alive?? --------
      • Set spr_condition[3] = True
      • -------- Is the Picked Unit belong in the spr_finished_group? --------
      • Set spr_condition[4] = False
      • -------- Is the Picked Unit in spr_finished_group in desirable range?? --------
      • Set spr_condition[5] = True
      • -------- The max distances that the wave will travel[Arrays are Levels e.g. Array 1 = Level 1] --------
      • Set spr_max_distance[1] = 800.00
      • Set spr_max_distance[2] = 1100.00
      • Set spr_max_distance[3] = 1400.00
      • Set spr_max_distance[4] = 1700.00
      • -------- The size of the wave travelled.[Arrays are Levels e.g. Array 1 = Level 1] --------
      • Set spr_dummy_size[1] = 140.00
      • Set spr_dummy_size[2] = 140.00
      • Set spr_dummy_size[3] = 140.00
      • Set spr_dummy_size[4] = 140.00
      • -------- The range around the wave that the enemies will be pushed out [Arrays are Levels e.g. Array 1 = Level 1] --------
      • Set spr_range[1] = 280.00
      • Set spr_range[2] = 280.00
      • Set spr_range[3] = 280.00
      • Set spr_range[4] = 280.00
      • -------- The travelling speed of the wave --------
      • Set spr_speed[1] = 20.00
      • Set spr_speed[2] = 20.00
      • Set spr_speed[3] = 20.00
      • Set spr_speed[4] = 20.00
      • -------- The repulsive force speed of the wave --------
      • Set spr_recoil_speed[1] = 9.00
      • Set spr_recoil_speed[2] = 12.00
      • Set spr_recoil_speed[3] = 15.00
      • Set spr_recoil_speed[4] = 18.00
      • -------- The time interval that the wave effect ocuuring --------
      • Set spr_Howl_Interval = 0.09
      • -------- Damage cause type --------
      • Set spr_attack_type = Chaos
      • -------- The model file of the wave effect --------
      • Set spr_effect_model[1] = Abilities\Spells\Other\HowlOfTerror\HowlCaster.mdl
      • -------- The attachent & model file of the damage caused effect --------
      • Set spr_attachment[2] = chest
      • Set spr_effect_model[2] = Abilities\Spells\Undead\DeathandDecay\DeathandDecayTarget.mdl
      • -------- The attachent & model file of the pushing effect --------
      • Set spr_attachment[3] = overhead
      • Set spr_effect_model[3] = Abilities\Weapons\DruidoftheTalonMissile\DruidoftheTalonMissile.mdl
      • -------- FOR PROS --------
      • Set spr_dummy_type = Universal Dummy
      • Set global_interval = 0.03
      • Trigger - Add to spr Loop <gen> the event (Time - Every global_interval seconds of game time)


  • spr Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to spr_ability
    • Actions
      • -------- ---------INDEXING STARTS---------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • spr_index_listener Equal to 0
        • Then - Actions
          • Trigger - Turn on spr Loop <gen>
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • spr_recycle_size Greater than 0
        • Then - Actions
          • Set spr_recycle_size = (spr_recycle_size - 1)
          • Set spr_current_index = spr_recycle_container[spr_recycle_size]
        • Else - Actions
          • Set spr_current_index = spr_index_size
          • Set spr_index_size = (spr_index_size + 1)
      • -------- ---------INDEXING ENDS---------- --------
      • Set spr_timer[spr_current_index] = spr_Howl_Interval
      • Set spr_caster[spr_current_index] = (Triggering unit)
      • Animation - Play spr_caster[spr_current_index]'s spr_caster_animation animation
      • Set spr_player[spr_current_index] = (Owner of spr_caster[spr_current_index])
      • Set spr_level[spr_current_index] = (Level of spr_ability for spr_caster[spr_current_index])
      • Set spr_caster_point[spr_current_index] = (Position of spr_caster[spr_current_index])
      • Set spr_target_point[spr_current_index] = (Target point of ability being cast)
      • Set spr_angle[spr_current_index] = (Angle from spr_caster_point[spr_current_index] to spr_target_point[spr_current_index])
      • Unit - Create 1 spr_dummy_type for spr_player[spr_current_index] at spr_caster_point[spr_current_index] facing spr_angle[spr_current_index] degrees
      • Set spr_dummy[spr_current_index] = (Last created unit)
      • Animation - Change spr_dummy[spr_current_index]'s size to (spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%) of its original size
      • Custom script: call RemoveLocation(udg_spr_target_point[udg_spr_current_index])
      • -------- ---------INDEXING STARTS---------- --------
      • Set spr_index_container[spr_index_listener] = spr_current_index
      • Set spr_index_listener = (spr_index_listener + 1)
      • -------- ---------INDEXING ENDS---------- --------


  • spr Loop
    • Events
    • Conditions
    • Actions
      • -------- ---------INDEXING STARTS---------- --------
      • For each (Integer spr_loop) from 0 to (spr_index_listener - 1), do (Actions)
        • Loop - Actions
          • Set spr_current_index = spr_index_container[spr_loop]
          • -------- ---------INDEXING ENDS---------- --------
          • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
          • Set spr_distance[spr_current_index] = (Distance between spr_caster_point[spr_current_index] and spr_dummy_point[spr_current_index])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • spr_distance[spr_current_index] Greater than spr_max_distance[spr_level[spr_current_index]]
            • Then - Actions
              • Custom script: call RemoveLocation(udg_spr_caster_point[udg_spr_current_index])
              • Special Effect - Create a special effect at spr_dummy_point[spr_current_index] using spr_effect_model[1]
              • Special Effect - Destroy (Last created special effect)
              • Unit - Kill spr_dummy[spr_current_index]
              • Unit Group - Remove all units from spr_finished_group[spr_current_index]
              • Unit Group - Remove all units from spr_group[spr_current_index]
              • -------- ---------INDEXING STARTS---------- --------
              • Set spr_index_listener = (spr_index_listener - 1)
              • Set spr_index_container[spr_loop] = spr_index_container[spr_index_listener]
              • Set spr_recycle_container[spr_recycle_size] = spr_current_index
              • Set spr_recycle_size = (spr_recycle_size + 1)
              • Set spr_loop = (spr_loop - 1)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • spr_index_listener Equal to 0
                • Then - Actions
                  • Trigger - Turn off spr Loop <gen>
                • Else - Actions
              • -------- ---------INDEXING ENDS---------- --------
            • Else - Actions
              • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • spr_timer[spr_current_index] Greater than 0.00
                • Then - Actions
                  • Set spr_timer[spr_current_index] = (spr_timer[spr_current_index] - global_interval)
                • Else - Actions
                  • Set spr_timer[spr_current_index] = spr_Howl_Interval
                  • Special Effect - Create a special effect at spr_dummy_point[spr_current_index] using spr_effect_model[1]
                  • Special Effect - Destroy (Last created special effect)
              • Custom script: call SetUnitX(udg_spr_dummy[udg_spr_current_index],GetUnitX(udg_spr_dummy[udg_spr_current_index]) + udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Cos(udg_spr_angle[udg_spr_current_index] * bj_DEGTORAD))
              • Custom script: call SetUnitY(udg_spr_dummy[udg_spr_current_index],GetUnitY(udg_spr_dummy[udg_spr_current_index]) + udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Sin(udg_spr_angle[udg_spr_current_index] * bj_DEGTORAD))
              • Set spr_group[spr_current_index] = (Units within spr_range[spr_level[spr_current_index]] of spr_dummy_point[spr_current_index] matching (((((Matching unit) is A structure) Equal to spr_condition[1]) and (((Matching unit) belongs to an enemy of spr_player[spr_current_index]) Equal to spr_condit
              • Unit Group - Pick every unit in spr_group[spr_current_index] and do (Actions)
                • Loop - Actions
                  • Set spr_picked = (Picked unit)
                  • Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_spr_effect_model[2], udg_spr_picked,udg_spr_attachment[2]))
                  • Unit - Cause spr_caster[spr_current_index] to damage spr_picked, dealing spr_damage[spr_level[spr_current_index]] damage of attack type spr_attack_type and damage type Normal
                  • Unit Group - Add spr_picked to spr_finished_group[spr_current_index]
              • Custom script: call DestroyGroup(udg_spr_group[udg_spr_current_index])
              • Unit Group - Pick every unit in spr_finished_group[spr_current_index] and do (Actions)
                • Loop - Actions
                  • Set spr_picked2 = (Picked unit)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (spr_picked2 is in (Units within spr_range[spr_level[spr_current_index]] of spr_dummy_point[spr_current_index])) Equal to spr_condition[5]
                    • Then - Actions
                      • Set spr_picked2_point = (Position of spr_picked2)
                      • Set spr_angle_2[spr_current_index] = (Angle from spr_dummy_point[spr_current_index] to spr_picked2_point)
                      • Custom script: call RemoveLocation(udg_spr_picked2_point)
                      • Custom script: call SetUnitX(udg_spr_picked2,GetUnitX(udg_spr_picked2) + udg_spr_recoil_speed[udg_spr_level[udg_spr_current_index]] * Cos(udg_spr_angle_2[udg_spr_current_index] * bj_DEGTORAD))
                      • Custom script: call SetUnitY(udg_spr_picked2,GetUnitY(udg_spr_picked2) + udg_spr_recoil_speed[udg_spr_level[udg_spr_current_index]] * Sin(udg_spr_angle_2[udg_spr_current_index] * bj_DEGTORAD))
                      • Custom script: call DestroyEffect(AddSpecialEffectTarget(udg_spr_effect_model[3], udg_spr_picked2,udg_spr_attachment[3]))
                    • Else - Actions
                      • Unit Group - Remove spr_picked2 from spr_finished_group[spr_current_index]
              • Custom script: call RemoveLocation(udg_spr_dummy_point[udg_spr_current_index])


  • spr Cleaner
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set spr_dying = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of spr_dying) Equal to spr_dummy_type
        • Then - Actions
          • Unit - Remove spr_dying from the game
        • Else - Actions




v1.0 - Uploaded Spell
v1.1 - Changed Indexing method



Keywords:
BUP,GUI,MUI,Spell,
Contents

Spiritual Disrupt v1.0 (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 22:40, 6th Jul 2014 PurgeandFire: Review: http://www.hiveworkshop.com/forums/2552191-post8.html

Moderator

M

Moderator

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

22:40, 6th Jul 2014
PurgeandFire: Review:
http://www.hiveworkshop.com/forums/2552191-post8.html
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
This is in your else block so it leaks if the else is not run.
  • Custom script: call RemoveLocation(udg_spr_dummy_point[udg_spr_current_index])
Don't use 2 unit groups. Put the ITE from the second group into the first and get rid of the second unit group.

This leaks a unit group.
  • (spr_picked2 is in (Units within spr_range[spr_level[spr_current_index]] of spr_dummy_point[spr_current_index])) Equal to spr_condition[5]
You also use an old and very inefficient method of indexing. Look at my tutorial Things You Should Know When Using Triggers / GUI on how to properly index / de-index.
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
  • (spr_picked2 is in (Units within spr_range[spr_level[spr_current_index]] of spr_dummy_point[spr_current_index])) Equal to spr_condition[5]
Use variable to create unit group for check instead

A variable is not needed. This can be used instead.
  • Custom script: set bj_wantDestroyGroup = true
As long as that is set before the unit group creation it will destroy the unit group.
 
A variable is not needed. This can be used instead.
  • Custom script: set bj_wantDestroyGroup = true
As long as that is set before the unit group creation it will destroy the unit group.

Yes, It doesn't need variable. But set bj_wantDestroyGroup = true is unsafe and drop fps faster than call DestroyGroup(). You can test it by yourself.

----

@BUP: If you use variables array, you need to limit array size of those variables.

  • spr Config
    • Events
    • Conditions
    • Actions
      • Set global_interval = 0.03
      • Trigger - Add to spr Loop <gen> the event (Time - Every global_interval seconds of game time)
If you use this way, you should use timer instead of the trigger timer because timer faster than trigger timer.

  • Animation - Change spr_dummy[spr_current_index]'s size to (spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%) of its original size
=>

  • Animation - Change spr_dummy[spr_current_index]'s size to (spr_dummy_size[spr_level[spr_current_index]]%, 0.00%, 0.00%) of its original size
Fix this:

  • spr Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer spr_loop) from 0 to (spr_index_listener (- 1 ??????)), do (Actions)
        • Loop - Actions
Saves udg_spr_angle[udg_spr_current_index] * bj_DEGTORAD

udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Cos(constantVar) udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Sin(constantVar)

into variable since they are constant variables.

You've leaked this location I guess since you forgoted to clean the first location.

  • For each (Integer spr_loop) from 0 to (spr_index_listener - 1), do (Actions)
    • Loop - Actions
      • Set spr_current_index = spr_index_container[spr_loop]
      • -------- ---------INDEXING ENDS---------- --------
      • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
      • Set spr_distance[spr_current_index] = (Distance between spr_caster_point[spr_current_index] and spr_dummy_point[spr_current_index])
  • Else - Actions
    • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • spr_timer[spr_current_index] Greater than 0.00
    • Then - Actions
      • Set spr_timer[spr_current_index] = (spr_timer[spr_current_index] - global_interval)
    • Else - Actions
      • Set spr_timer[spr_current_index] = spr_Howl_Interval
      • Special Effect - Create a special effect at spr_dummy_point[spr_current_index] using spr_effect_model[1]
      • Special Effect - Destroy (Last created special effect)
In my memory leaks checker, you've leaked location and group 0.0...

And as pOke said too ^_^..
 
Last edited:

BUP

BUP

Level 9
Joined
Sep 9, 2012
Messages
172
Yes, It doesn't need variable. But set bj_wantDestroyGroup = true is unsafe and drop fps faster than call DestroyGroup(). You can test it by yourself.

----

@BUP: If you use variables array, you need to limit array size of those variables.

  • spr Config
    • Events
    • Conditions
    • Actions
      • Set global_interval = 0.03
      • Trigger - Add to spr Loop <gen> the event (Time - Every global_interval seconds of game time)
If you use this way, you should use timer instead of the trigger timer because timer faster than trigger timer.

  • Animation - Change spr_dummy[spr_current_index]'s size to (spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%, spr_dummy_size[spr_level[spr_current_index]]%) of its original size
=>

  • Animation - Change spr_dummy[spr_current_index]'s size to (spr_dummy_size[spr_level[spr_current_index]]%, 0.00%, 0.00%) of its original size
Fix this:

  • spr Loop
    • Events
    • Conditions
    • Actions
      • For each (Integer spr_loop) from 0 to (spr_index_listener (- 1 ??????)), do (Actions)
        • Loop - Actions
Saves udg_spr_angle[udg_spr_current_index] * bj_DEGTORAD

udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Cos(constantVar) udg_spr_speed[udg_spr_level[udg_spr_current_index]] * Sin(constantVar)

into variable since they are constant variables.

You leak this location I guess since you forgoted to cleaned the first location.

  • For each (Integer spr_loop) from 0 to (spr_index_listener - 1), do (Actions)
    • Loop - Actions
      • Set spr_current_index = spr_index_container[spr_loop]
      • -------- ---------INDEXING ENDS---------- --------
      • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
      • Set spr_distance[spr_current_index] = (Distance between spr_caster_point[spr_current_index] and spr_dummy_point[spr_current_index])
  • Else - Actions
    • Set spr_dummy_point[spr_current_index] = (Position of spr_dummy[spr_current_index])
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • spr_timer[spr_current_index] Greater than 0.00
    • Then - Actions
      • Set spr_timer[spr_current_index] = (spr_timer[spr_current_index] - global_interval)
    • Else - Actions
      • Set spr_timer[spr_current_index] = spr_Howl_Interval
      • Special Effect - Create a special effect at spr_dummy_point[spr_current_index] using spr_effect_model[1]
      • Special Effect - Destroy (Last created special effect)
In my memory leaks checker, you've leaked location and group 0.0...

And as pOke said too ^_^..

@nhocklanhox6 ,@deathismyfriend , @poke and @enterprise
Thanks for the advices.
I'll be uploading a fixed version of this spell soon:ogre_hurrhurr:
 
Top