1. Are you planning to upload your awesome spell or system to Hive? Please review the rules here.
    Dismiss Notice
  2. Seek unity between the elements in the 22nd Terraining Contest Poll.
    Dismiss Notice
  3. Seize the moment! The 18th Mini Mapping Contest has commenced.
    Dismiss Notice
  4. The heavens smile on the old faithful. The 16th Techtree Contest has begun.
    Dismiss Notice
  5. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Shock Bomb v. 1.1

Submitted by tjordell
This bundle is marked as approved. It works and satisfies the submission rules.
Hello THW and viewers. This spell is pretty advanced. Much calculating and stuffs like that to get the whole thing timed. The spell is Fully MUI & Lagless & Leakless (I think [99% sure]).

This spell was made for the Freeze87 and his project http://www.hiveworkshop.com/forums/maps-564/mage-arena-1-04a-159164/

Shock Bomb
The hero casts an explosive bomb at the targeted location. After 5 seconds the bomb will explode and deal 130 damage and slows for 50% last 2 seconds.


Code
SB Start
  • SB Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Shock Bomb
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SB Equal to 0
        • Then - Actions
          • Trigger - Turn on SB Loop <gen>
        • Else - Actions
      • Set SB = (SB + 1)
      • Set SB_Times = (SB_Times + 1)
      • Set SB_Boolean[SB_Times] = True
      • Set SB_Hero[SB_Times] = (Triggering unit)
      • Set SB_Damage[SB_Times] = 130.00
      • Set SB_Height[SB_Times] = 300.00
      • Set SB_Speed[SB_Times] = 30.00
      • Set SB_MaxScale[SB_Times] = 500.00
      • Set SB_CurrentScale[SB_Times] = 100.00
      • Set SB_AOE[SB_Times] = 500.00
      • Set SB_FTValue[SB_Times] = 5
      • Set SB_FT_Count[SB_Times] = 1.00
      • Set SB_TrgtPoint[SB_Times] = (Target point of ability being cast)
      • Set SB_Loc[1] = (Position of SB_Hero[SB_Times])
      • Set SB_MaxDistance[SB_Times] = (Distance between SB_Loc[1] and SB_TrgtPoint[SB_Times])
      • Set SB_Angle[SB_Times] = (Angle from SB_Loc[1] to SB_TrgtPoint[SB_Times])
      • Unit - Create 1 Flying Bomb for (Owner of SB_Hero[SB_Times]) at SB_Loc[1] facing SB_Angle[SB_Times] degrees
      • Set SB_Projectile[SB_Times] = (Last created unit)
      • Custom script: call RemoveLocation (udg_SB_Loc[1])
      • Custom script: call RemoveLocation (udg_SB_TrgtPoint[udg_SB_Times])

SB Loop (Init Off)
  • SB Loop
    • Events
      • Time - Every 0.02 seconds of game time
    • Conditions
    • Actions
      • For each (Integer SB_Loop) from 1 to SB_Times, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • SB_Boolean[SB_Loop] Equal to True
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • SB_DistanceCheck[SB_Loop] Less than SB_MaxDistance[SB_Loop]
                • Then - Actions
                  • Set SB_DistanceCheck[SB_Loop] = (SB_DistanceCheck[SB_Loop] + SB_Speed[SB_Loop])
                  • Set SB_Loc[2] = (Position of SB_Projectile[SB_Loop])
                  • Set SB_Loc[3] = (SB_Loc[2] offset by SB_Speed[SB_Loop] towards SB_Angle[SB_Loop] degrees)
                  • Unit - Move SB_Projectile[SB_Loop] instantly to SB_Loc[3]
                  • Set SB_Parabola[SB_Loop] = (((4.00 x SB_Height[SB_Loop]) / SB_MaxDistance[SB_Loop]) x ((SB_MaxDistance[SB_Loop] - SB_DistanceCheck[SB_Loop]) x (SB_DistanceCheck[SB_Loop] / SB_MaxDistance[SB_Loop])))
                  • Animation - Change SB_Projectile[SB_Loop] flying height to SB_Parabola[SB_Loop] at 0.00
                  • Custom script: call RemoveLocation (udg_SB_Loc[2])
                  • Custom script: call RemoveLocation (udg_SB_Loc[3])
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • SB_Bomb[SB_Loop] Equal to No unit
                    • Then - Actions
                      • Set SB_Loc[4] = (Position of SB_Projectile[SB_Loop])
                      • Unit - Remove SB_Projectile[SB_Loop] from the game
                      • Unit - Create 1 Bomb for (Owner of SB_Hero[SB_Loop]) at SB_Loc[4] facing (Random angle) degrees
                      • Set SB_Bomb[SB_Loop] = (Last created unit)
                      • Special Effect - Create a special effect attached to the origin of SB_Bomb[SB_Loop] using Abilities\Spells\Human\Brilliance\Brilliance.mdl
                      • Set SB_SFX[SB_Loop] = (Last created special effect)
                      • Custom script: call RemoveLocation (udg_SB_Loc[4])
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • SB_CurrentScale[SB_Loop] Less than SB_MaxScale[SB_Loop]
                        • Then - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SB_FT_Count[SB_Loop] Equal to 1.00
                            • Then - Actions
                              • Floating Text - Create floating text that reads (String(SB_FTValue[SB_Loop])) above SB_Bomb[SB_Loop] with Z offset 10.00, using font size 20.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                              • Floating Text - Change (Last created floating text): Disable permanence
                              • Floating Text - Change the lifespan of (Last created floating text) to 1.00 seconds
                              • Floating Text - Show (Last created floating text) for (All allies of (Owner of SB_Hero[SB_Loop]))
                              • Set SB_FT_Count[SB_Loop] = 0.00
                              • Set SB_FTValue[SB_Loop] = (SB_FTValue[SB_Loop] - 1)
                            • Else - Actions
                              • Set SB_FT_Count[SB_Loop] = (SB_FT_Count[SB_Loop] + 0.02)
                          • Set SB_CurrentScale[SB_Loop] = (SB_CurrentScale[SB_Loop] + 1.60)
                          • Animation - Change SB_Bomb[SB_Loop]'s size to (SB_CurrentScale[SB_Loop]%, SB_CurrentScale[SB_Loop]%, SB_CurrentScale[SB_Loop]%) of its original size
                        • Else - Actions
                          • Set SB_Loc[5] = (Position of SB_Bomb[SB_Loop])
                          • Unit - Make SB_Bomb[SB_Loop] Explode on death
                          • Special Effect - Destroy SB_SFX[SB_Loop]
                          • Unit - Kill SB_Bomb[SB_Loop]
                          • Unit - Create 1 Explosion for (Owner of SB_Hero[SB_Loop]) at SB_Loc[5] facing 0.00 degrees
                          • Animation - Change (Last created unit)'s size to (200.00%, 200.00%, 200.00%) of its original size
                          • Animation - Play (Last created unit)'s birth animation
                          • Unit - Add a 7.17 second Generic expiration timer to (Last created unit)
                          • Set SB_Group[1] = (Units within SB_AOE[SB_Loop] of SB_Loc[5] matching ((((Matching unit) belongs to an enemy of (Owner of SB_Hero[SB_Loop])) Equal to True) and ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) is alive) Equal to True) and (((Matching un
                          • Unit Group - Pick every unit in SB_Group[1] and do (Actions)
                            • Loop - Actions
                              • Unit - Create 1 Dummy Unit for (Owner of SB_Hero[SB_Loop]) at SB_Loc[5] facing Default building facing degrees
                              • Unit - Add Slow to (Last created unit)
                              • Unit - Order (Last created unit) to Human Sorceress - Slow (Picked unit)
                              • Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
                              • Unit - Cause SB_Hero[SB_Loop] to damage (Picked unit), dealing SB_Damage[SB_Loop] damage of attack type Spells and damage type Normal
                          • Destructible - Pick every destructible within SB_AOE[SB_Loop] of SB_Loc[5] and do (Actions)
                            • Loop - Actions
                              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                • If - Conditions
                                  • ((Picked destructible) is alive) Equal to True
                                • Then - Actions
                                  • Set SB_Loc[6] = (Position of (Picked destructible))
                                  • Special Effect - Create a special effect at SB_Loc[6] using Abilities\Spells\Items\AIfb\AIfbSpecialArt.mdl
                                  • Special Effect - Destroy (Last created special effect)
                                  • Destructible - Kill (Picked destructible)
                                  • Custom script: call RemoveLocation (udg_SB_Loc[6])
                                • Else - Actions
                          • Custom script: call RemoveLocation (udg_SB_Loc[5])
                          • Custom script: call DestroyGroup (udg_SB_Group[1])
                          • Set SB_CurrentScale[SB_Loop] = 0.00
                          • Set SB_DistanceCheck[SB_Loop] = 0.00
                          • Set SB_Bomb[SB_Loop] = No unit
                          • Set SB_Boolean[SB_Loop] = False
                          • Set SB = (SB - 1)
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • SB Equal to 0
                            • Then - Actions
                              • Trigger - Turn off (This trigger)
                              • Set SB_Times = 0
                            • Else - Actions
            • Else - Actions



As always there's a MUST that you give credits on usage. That's the THW´s rules and also my rules.

Updates
[v. 1.1] - Added tooltip
[v. 1.0] - Created and Uploaded


Keywords:
Bomb, Explode, tjordell, Freeze87, Countdown, slow, grenade, throw bomb, cast bomb, explosive, explosives
Contents

Shock Bomb (Map)

Reviews
Moderator
22:21, 16th Jun 2010 Hanky: Leakless, MUI and you even got a tooltip now. Fine enough for an approval.
  1. 22:21, 16th Jun 2010
    Hanky:
    Leakless, MUI and you even got a tooltip now. Fine enough for an approval.
     
  2. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,174
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    i make a quick browse through the trigger, but doesn't see any problem soo far.

    it sort of remind me of smart mine ability by Thanathos :p
     
  3. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Hehe. Good that you dont see any problems. :D
     
  4. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,174
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    don't be too happy about it yet, reading indexing to find flaw actually takes time to do so... i just make quick browse.. :p
     
  5. Itachi009

    Itachi009

    Joined:
    Dec 8, 2008
    Messages:
    97
    Resources:
    0
    Resources:
    0
    pls pls pls use hashtables !
    they are easier to use and more userfriendly
    arrays are not 100% leakfree
    and besides if you just got 1 or 2 instances, hashtables are even as fast as indexes (the more instances you have, the slower a hashtable will get)
     
  6. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Well, I'm not famillar to hashtables so then i use indexing and also, indexing is really useful to spells. Hashtables isn't even 100% working. If you try to save some handles like save unit handle or other one, the WE will crash. Some of the handles doesn't work properly and just crashing the WE. And that is because Blizzard was lazy and didn't do the whole Hashtable functions for GUI.
    Pretty many spells is used more than 2 times at once.
     
  7. Septimus

    Septimus

    Joined:
    May 3, 2008
    Messages:
    4,174
    Resources:
    49
    Packs:
    1
    Maps:
    35
    Spells:
    8
    Tutorials:
    5
    Resources:
    49
    Actually, hashtable was 400% slower in comparison with indexing. Some people prefer to use array due to the speed, while some prefer hashtable for being easy, friendly and of course being lazy cause indexing took a lot of work. :p
     
  8. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Hehe also, there's a LOT more complicated with indexing. BUT, with indexing you learn something new almost every day that takes you a big step closer to the full Advanced Triggering. And, also, there's very hard to take care of a large number of units. Like if i want to move 10 projectiles, there's very hard for me to take care of everything because i need to work with one unit at a time, and that is very hard...
    But i'm famillar to that.
     
  9. Kingz

    Kingz

    Joined:
    Jun 5, 2008
    Messages:
    2,470
    Resources:
    6
    Spells:
    5
    Tutorials:
    1
    Resources:
    6
    Indexing works better than hashtables in some situations and vice versa.

    However i think using Indexing is better if you want more efficent GUI spell, yet again it must be a proper indexing format.
     
  10. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Kingz, Yes, like this spell, it have a proper indexing. It's 100% MUI. No one have found any wrong with this spell yet. I have looked throught the triggers like 5-8 times and haven't found anything.
     
  11. Anachron

    Anachron

    Joined:
    Sep 9, 2007
    Messages:
    6,220
    Resources:
    66
    Icons:
    49
    Packs:
    2
    Tools:
    1
    Maps:
    3
    Spells:
    9
    Tutorials:
    1
    JASS:
    1
    Resources:
    66
    Since when is credits a rule?
    However it won't make people give credits actually, it will turn around the other way.
     
  12. tjordell

    tjordell

    Joined:
    Jan 25, 2009
    Messages:
    554
    Resources:
    5
    Icons:
    1
    Spells:
    4
    Resources:
    5
    Well it's ofc that people should give credits. Almost the only thing why people upload their projects is to give people a project that they want to use and give credits for. Like if i upload a project, i pretend that i'm going to get credits. Otherwise, i dont think its any meaning to upload any project at all. The only thing i do it is because i want to get more famous and have more ppls that likes my projects and can see what i am capable of.