• 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.

[GUI]Thunder Shot v7.1

  • Like
Reactions: FeelMyRash
Third spell! blowing my mind, somewhat...
  • Description
    Shots a missile of lightning that chases the targeted unit. When the missile reaches the target, it explodes and causes big damage to nearby enemy units in radius of 400.

    Level 1 - 100 damage.
    Level 2 - 120 damage.
    Level 3 - 140 damage.
    Level 4 - 160 damage.
  • Image
    Thunder%20Shot3.jpg

    Thunder%20Shot2.jpg
  • Trigger
    • Thunder Shot Setting
      • Events
        • Map initialization
      • Conditions
      • Actions
        • -------- --------------------------- --------
        • -------- Determines the ability --------
        • Set TS_Ability = Thunder Shot
        • -------- --------------------------- --------
        • -------- Determines the missile dummy --------
        • Set TS_MissileDummy = Missile Dummy
        • -------- --------------------------- --------
        • -------- Determines the missile spawn offset from caster position --------
        • Set TS_MissileSpawnOffset[1] = 50.00
        • Set TS_MissileSpawnOffset[2] = 50.00
        • Set TS_MissileSpawnOffset[3] = 50.00
        • Set TS_MissileSpawnOffset[4] = 50.00
        • -------- --------------------------- --------
        • -------- Determines the missile move speed --------
        • Set TS_MissileSpeed[1] = 50.00
        • Set TS_MissileSpeed[2] = 50.00
        • Set TS_MissileSpeed[3] = 50.00
        • Set TS_MissileSpeed[4] = 50.00
        • -------- --------------------------- --------
        • -------- Determines the minimum distance the missile can travel before it is considered as "End" (Impact the target) --------
        • Set TS_MinDistance = 50.00
        • -------- --------------------------- --------
        • -------- Determines the damage dealt to nearby enemy units --------
        • Set TS_Damage[1] = 100.00
        • Set TS_Damage[2] = 120.00
        • Set TS_Damage[3] = 140.00
        • Set TS_Damage[4] = 160.00
        • -------- --------------------------- --------
        • -------- Determines the attack-type --------
        • Set TS_AttackType = Spells
        • -------- --------------------------- --------
        • -------- Determines the damage-type --------
        • Set TS_DamageType = Lightning
        • -------- --------------------------- --------
        • -------- Determines the effect shows on damaged units --------
        • Set TS_DamagedEffect = Abilities\Weapons\FarseerMissile\FarseerMissile.mdl
        • -------- --------------------------- --------
        • -------- Determines the attachment point of the effect above --------
        • Set TS_DamagedEffectAttachment = chest
        • -------- --------------------------- --------
        • -------- Determines the damage radius/range --------
        • Set TS_Radius[1] = 400.00
        • Set TS_Radius[2] = 400.00
        • Set TS_Radius[3] = 400.00
        • Set TS_Radius[4] = 400.00
        • -------- --------------------------- --------
        • -------- Determines the explosion dummy. Note that this can have many variation that can make the spell more nice-looking --------
        • Set TS_ExplosionDummy[1] = Explosion 1
        • Set TS_ExplosionFadeRate[1] = 5.00
        • Set TS_ExplosionDummy[2] = Explosion 2
        • Set TS_ExplosionFadeRate[2] = 5.00
        • Set TS_ExplosionDummy[3] = Explosion 3
        • Set TS_ExplosionFadeRate[3] = 5.00
        • Set TS_ExplosionDummy[4] = Explosion 4
        • Set TS_ExplosionFadeRate[4] = 5.00
        • -------- --------------------------- --------
        • -------- Determines the explosion dummy variation number --------
        • Set TS_ExplosionDummyNum = 4
        • -------- --------------------------- --------
        • Set TS_OrgMinDistance = TS_MinDistance
    • Thunder Shot Cast
      • Events
        • Unit - A unit Starts the effect of an ability
      • Conditions
        • (Ability being cast) Equal to TS_Ability
      • Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • TS_MaxIndex Equal to 0
          • Then - Actions
            • Trigger - Turn on Thunder Shot Loop <gen>
          • Else - Actions
        • Set TS_MaxIndex = (TS_MaxIndex + 1)
        • Set TS_Caster[TS_MaxIndex] = (Triggering unit)
        • Set TS_Target[TS_MaxIndex] = (Target unit of ability being cast)
        • Set TS_Level[TS_MaxIndex] = (Level of TS_Ability for TS_Caster[TS_MaxIndex])
        • Set TS_TempLoc = (Position of TS_Caster[TS_MaxIndex])
        • Set TS_TempLoc2 = (Position of TS_Target[TS_MaxIndex])
        • Set TS_Angle = (Angle from TS_TempLoc to TS_TempLoc2)
        • Set TS_TempLoc3 = (TS_TempLoc offset by TS_MissileSpawnOffset[TS_Level[TS_MaxIndex]] towards TS_Angle degrees)
        • Unit - Create 1 TS_MissileDummy for (Triggering player) at TS_TempLoc3 facing TS_Angle degrees
        • Set TS_Missile[TS_MaxIndex] = (Last created unit)
        • Custom script: call RemoveLocation(udg_TS_TempLoc)
        • Custom script: call RemoveLocation(udg_TS_TempLoc2)
        • Custom script: call RemoveLocation(udg_TS_TempLoc3)
    • Thunder Shot Loop
      • Events
        • Time - Every 0.03 seconds of game time
      • Conditions
      • Actions
        • For each (Integer TS_Index) from 1 to TS_MaxIndex, do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (TS_Target[TS_Index] is dead) Equal to True
              • Then - Actions
                • Set TS_MinDistance = 1000000000.00
              • Else - Actions
            • Set TS_TempLoc = (Position of TS_Missile[TS_Index])
            • Set TS_TempLoc2 = (Position of TS_Target[TS_Index])
            • Set TS_Distance = (Distance between TS_TempLoc and TS_TempLoc2)
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • TS_Distance Greater than TS_MinDistance
              • Then - Actions
                • Set TS_Angle = (Angle from TS_TempLoc to TS_TempLoc2)
                • Set TS_TempLoc3 = (TS_TempLoc offset by TS_MissileSpeed[TS_Level[TS_Index]] towards TS_Angle degrees)
                • Unit - Move TS_Missile[TS_Index] instantly to TS_TempLoc3, facing TS_Angle degrees
                • Custom script: call RemoveLocation(udg_TS_TempLoc3)
              • Else - Actions
                • Set TS_MinDistance = TS_OrgMinDistance
                • Set TS_Owner = (Owner of TS_Caster[TS_Index])
                • Set TS_TempGroup = (Units within TS_Radius[TS_Level[TS_Index]] of TS_TempLoc)
                • Unit Group - Pick every unit in TS_TempGroup and do (Actions)
                  • Loop - Actions
                    • Set TS_PickedUnit = (Picked unit)
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (TS_PickedUnit is dead) Equal to False
                        • (TS_PickedUnit is A structure) Equal to False
                        • (TS_PickedUnit is Magic Immune) Equal to False
                        • (TS_PickedUnit belongs to an ally of TS_Owner) Equal to False
                      • Then - Actions
                        • Unit - Cause TS_Caster[TS_Index] to damage TS_PickedUnit, dealing TS_Damage[TS_Level[TS_Index]] damage of attack type TS_AttackType and damage type TS_DamageType
                        • Special Effect - Create a special effect attached to the TS_DamagedEffectAttachment of TS_PickedUnit using TS_DamagedEffect
                        • Special Effect - Destroy (Last created special effect)
                      • Else - Actions
                • Set TS_PickedUnit = No unit
                • Custom script: call DestroyGroup(udg_TS_TempGroup)
                • For each (Integer TS_Loop) from 1 to TS_ExplosionDummyNum, do (Actions)
                  • Loop - Actions
                    • Unit - Create 1 TS_ExplosionDummy[TS_Loop] for TS_Owner at TS_TempLoc facing 0.00 degrees
                    • Set FSUnit = (Last created unit)
                    • Set FSStartOpacity = 0.00
                    • Set FSStart = 0.00
                    • Set FSEnd = 100.00
                    • Set FSSpeed = TS_ExplosionFadeRate[TS_Loop]
                    • Set FSFadeIn = False
                    • Set FSTinted = False
                    • Set FSRed = 0.00
                    • Set FSGreen = 0.00
                    • Set FSBlue = 0.00
                    • Trigger - Run FSAddUnit <gen> (ignoring conditions)
                • Custom script: set udg_TS_Owner=null
                • Unit - Kill TS_Missile[TS_Index]
                • Set TS_Caster[TS_Index] = TS_Caster[TS_MaxIndex]
                • Set TS_Level[TS_Index] = TS_Level[TS_MaxIndex]
                • Set TS_Missile[TS_Index] = TS_Missile[TS_MaxIndex]
                • Set TS_Target[TS_Index] = TS_Target[TS_MaxIndex]
                • Set TS_Caster[TS_MaxIndex] = No unit
                • Set TS_Missile[TS_MaxIndex] = No unit
                • Set TS_Target[TS_MaxIndex] = No unit
                • Set TS_Index = (TS_Index - 1)
                • Set TS_MaxIndex = (TS_MaxIndex - 1)
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • TS_MaxIndex Equal to 0
                  • Then - Actions
                    • Trigger - Turn off (This trigger)
                  • Else - Actions
            • Custom script: call RemoveLocation(udg_TS_TempLoc)
            • Custom script: call RemoveLocation(udg_TS_TempLoc2)
  • Requirement
    - Fade System
  • Changelog
    v7.0
    - Initial version​
    v7.1
    - Code merged​
  • Credits
    - BPower for advice
    System
    - crehym​
    Models
    - marcus158
    - dhguardianes
    - Champara Bros
    - NightSkyAurora​
Please rate and comment!

Keywords:
Thunder, Shot, Lightning, AoE, MUI, GUI, Missile.
Contents

testmap (Map)

Reviews
11:38, 17th Jan 2014 BPower: Leakless, MUI and approved. Damage type lightning equals damage type magic, the wc3 engine doesn't make a difference here. If you have any questions feel free to pm me.

Moderator

M

Moderator

11:38, 17th Jan 2014
BPower: Leakless, MUI and approved.
Damage type lightning equals damage type magic, the wc3 engine doesn't make a difference here.

If you have any questions feel free to pm me.
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
    • Set TS_Level[TS_MaxIndex] = (Level of (Ability being cast) for TS_Caster[TS_MaxIndex])
    --->
    • Set TS_Level[TS_MaxIndex] = (Level of TS_Ability for TS_Caster[TS_MaxIndex])
  • I think the missle offset should be constant and not based on the ability level.

Im curious. In the FadeSystem you do null a global unit variable, but in thundershot you don't null TS_Caster[TS_MaxIndex], which would be much more important, if you want to get rid of all potential handle leaks.

The loop can be optimized. Basically you perform the same action when the minimum distance is reached or the target is dead.
Your task is now to find a way to merge these two conditions into one :).
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
Im curious. In the FadeSystem you do null a global unit variable, but in thundershot you don't null TS_Caster[TS_MaxIndex], which would be much more important, if you want to get rid of all potential handle leaks.

you will never get rid of all all all leaks, not even in Jass, not to mention vJass, because there are many generated things you cant clean, and I dont think teaching GUIers to null agents just to not leak 4 bytes isnt important, they should learn programming before that imo

I agree on the condition part, around 1/2 of the trigger can be merged
 
Top