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

Lightning Rain v1.2 [GUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
Lightning Rain
Creates a surge of lightning,
shooting 24 balls of electricity into the air.
The balls will do minor damage when they land. Mechanical units take twice as much damage.


This spell was made in GUI by Jazztastic. Please give credits if used in your map. This spell is hopefully MUI, and leakless. Any comments or suggestions on how to improve this spell are appreciated. A 5/5 would be nice too :D

  • Lightning Rain Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Create a sexy ass hashtable to make my spell sexy. --------
      • -------- Pay attention. I make this hashtable sexy by saying it is sexy --------
      • Hashtable - Create a hashtable
      • Set LR_Hash = (Last created hashtable)
      • -------- ^^ What a sexy hashtable ^^ --------
      • -------- This is the damage done. It is multiplied by the level. Each bolt does this damage. --------
      • Set LR_Damage = 25.00
      • -------- This decides the area of effect of the damage. Changing it over 200 would probably make it unfair. --------
      • Set LR_DamageAOE = 200.00
      • -------- Amount of bolts created per cast. This does not change with level --------
      • Set LR_BoltNumber = 24
      • -------- Dummy for the special effects --------
      • Set LR_LightningType = Lightning Head 1
  • Lightning Rain Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Lightning Rain
    • Actions
      • -------- Identify the caster, and add him to group. Save some bullshit, and turn on some other bullshit --------
      • Set LR_Caster = (Triggering unit)
      • Unit Group - Add LR_Caster to LR_CasterGroup
      • Custom script: set udg_LR_Handle = GetHandleId(udg_LR_Caster)
      • -------- This is the current number of missiles created --------
      • Hashtable - Save 0 as 1 of LR_Handle in LR_Hash
      • Trigger - Turn on Lightning Rain Creation Loop <gen>
      • Trigger - Turn on Lightning Rain Lightning Loop <gen>[/trirgger][trigger]Lightning Rain Creation Loop
    • Events
      • Time - Every 0.08 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LR_CasterGroup and do (Actions)
        • Loop - Actions
          • -------- This is the creation loop, in which lightning pellets are created and added to groups and stuff --------
          • Set LR_Caster = (Picked unit)
          • Custom script: set udg_LR_Handle = GetHandleId(udg_LR_Caster)
          • -------- If the number created has been reached, get the caster out of this group. --------
          • -------- The caster is also removed from the group if he gets killed --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Load 1 of LR_Handle from LR_Hash) Greater than or equal to LR_BoltNumber) or ((LR_Caster is dead) Equal to True)
            • Then - Actions
              • Unit Group - Remove LR_Caster from LR_CasterGroup
              • Hashtable - Clear all child hashtables of child LR_Handle in LR_Hash
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in LR_CasterGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • -------- Lots of important stuff that you REALLY shouldn't touch --------
              • Hashtable - Save ((Load 1 of LR_Handle from LR_Hash) + 1) as 1 of LR_Handle in LR_Hash
              • Set LR_Level = (Real((Level of Lightning Rain for LR_Caster)))
              • Set LR_Point1 = (Position of LR_Caster)
              • Set LR_FlyingHeight = (Current flying height of LR_Caster)
              • -------- X is used in my parabola. --------
              • Unit - Create 1 LR_LightningType for (Owner of LR_Caster) at LR_Point1 facing (Random angle) degrees
              • Set LR_LightningUnit = (Last created unit)
              • Custom script: set udg_LR_Handle = GetHandleId(udg_LR_LightningUnit)
              • Animation - Change LR_LightningUnit flying height to (LR_FlyingHeight + 10.00) at 0.00
              • Unit Group - Add LR_LightningUnit to LR_LightningGroup
              • Custom script: call RemoveLocation(udg_LR_Point1)
              • Hashtable - Save Handle OfLR_Caster as 3 of LR_Handle in LR_Hash
              • Hashtable - Save LR_FlyingHeight as 4 of LR_Handle in LR_Hash
              • Hashtable - Save LR_Level as 8 of LR_Handle in LR_Hash
  • Lightning Rain Lightning Loop
    • Events
      • Time - Every 0.04 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in LR_LightningGroup and do (Actions)
        • Loop - Actions
          • Set LR_LightningUnit = (Picked unit)
          • Custom script: set udg_LR_Handle = GetHandleId(udg_LR_LightningUnit)
          • Set LR_Point1 = (Position of LR_LightningUnit)
          • Custom script: set udg_LR_FlyingHeight = GetUnitFlyHeight(udg_LR_LightningUnit)
          • -------- If the lightning ball is under 9 flying height (pretty close to the ground) it will explode --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LR_FlyingHeight Less than or equal to 9.00
            • Then - Actions
              • Custom script: set bj_wantDestroyGroup = true
              • Unit Group - Pick every unit in (Units within LR_DamageAOE of LR_Point1 matching ((((Matching unit) is A structure) Equal to False) and ((((Matching unit) belongs to an enemy of (Owner of LR_LightningUnit)) Equal to True) and ((((Matching unit) is A ground unit) Equal to True) and (((Matchi and do (Actions)
                • Loop - Actions
                  • -------- If the unit is mechanical, it takes double the damage --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Picked unit) is Mechanical) Equal to True
                    • Then - Actions
                      • Unit - Cause (Load 3 of LR_Handle in LR_Hash) to damage (Picked unit), dealing ((LR_Damage x 2.00) x (Load 8 of LR_Handle from LR_Hash)) damage of attack type Spells and damage type Normal
                    • Else - Actions
                      • Unit - Cause (Load 3 of LR_Handle in LR_Hash) to damage (Picked unit), dealing (LR_Damage x (Load 8 of LR_Handle from LR_Hash)) damage of attack type Spells and damage type Normal
              • Unit Group - Remove LR_LightningUnit from LR_LightningGroup
              • Unit - Explode LR_LightningUnit
              • Hashtable - Clear all child hashtables of child LR_Handle in LR_Hash
              • -------- Checks how many lightning balls there are. If equal to 0, it turns off this trigger --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in LR_LightningGroup) Equal to 0
                • Then - Actions
                  • Trigger - Turn off (This trigger)
                • Else - Actions
            • Else - Actions
              • Set LR_Point2 = (LR_Point1 offset by (Random real number between 0.00 and 10.00) towards (Facing of LR_LightningUnit) degrees)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Playable map area) contains LR_Point2) Equal to True
                • Then - Actions
                  • Unit - Move LR_LightningUnit instantly to LR_Point2, facing (Facing of LR_LightningUnit) degrees
                • Else - Actions
              • Set LR_Caster = (Load 3 of LR_Handle in LR_Hash)
              • Set LR_X = ((Load 6 of LR_Handle from LR_Hash) + 1.00)
              • -------- This uses a parabola in the code --------
              • Animation - Change LR_LightningUnit flying height to ((((LR_X x LR_X) x -1.00) + (Load 4 of LR_Handle from LR_Hash)) + (58.00 x LR_X)) at 0.00
              • Hashtable - Save LR_X as 6 of LR_Handle in LR_Hash
              • Custom script: call RemoveLocation(udg_LR_Point2)
          • Custom script: call RemoveLocation(udg_LR_Point1)

v1.0 Uploaded to THW (Like a boss)
v1.1 Fixed loop not turning off properly, fixed some aesthetic stuff, added importing instructions, fixed some minor coding stuff, improved overall awesomeness levels by about 17% v1.2
Fixed some triggering stuff
Keywords:
Lightning, Rain, Ball, Energy, Lightning Rain, Awesome
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. In importing instructions, you don't mention about configuring the ability in the cast condition. I recommend you change 0.04 interval to 0.03. In my opinion 0.04 looked choppy and I knew...

Moderator

M

Moderator

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

Maker, Lightning Rain v1.2, 19th Oct 2011

In importing instructions, you don't mention about configuring the ability in the cast condition.
I recommend you change 0.04 interval to 0.03. In my opinion 0.04 looked choppy and I knew it was due to too low update time even before looking at the triggers.
I prefer creating dummies for neutral passive.
Instead of
  • Set LR_Level = (Real((Level of Lightning Rain for LR_Caster)))
you should store the damage, including LR_Damage multiplication when the spell is cast.
05:06, 13th Sep 2011
Pharaoh_:
• Use one dummy, instead of 3, with the dummy.mdx model and add the special effects you want on it, since it is invisible, but has attachment points for this purpose. This model can be found here: http://www.wc3c.net/showthread.php?p=1007469&fromattachment=1007469#1007469
• Remove the buffs and set set Targets allowed to None.
• Use documentation as to what the following line does:
  • Hashtable - Save 0 as 1 of LR_Handle in LR_Hash
  • (Load 1 of LR_Handle from LR_Hash)
  • (Load 3 of LR_Handle in LR_Hash)
Set them in a variable to improve readability and efficiency.
  • Set LR_Caster = (Picked unit)
You don't have to declare it again in the "Else" branch.
• Turn Lightning Rain Lightning loop when you create the dummy, not in the main trigger, you will save some calls.
• In the Rain Lightning loop trigger, move the following action out of the if/then/else stament: Custom script: call RemoveLocation(udg_LR_Point1)
• Make sure you delete unused variables from the Variable Editor (Ctrl + B).
• The triggers deal extra damage to mechanicals, however, this seemingly tiny detail should be displayed in the tooltip.
• Abilities\Weapons\Bolt\BoltImpact.mdl: This should be configurable as well as:
  • (Random real number between 0.00 and 10.00)
  • Unit - Move LR_LightningUnit instantly to LR_Point2, facing (Facing of LR_LightningUnit) degrees
For the special effect of the orb, where the facing is not nearly distinctive, you could just use 0 degrees, since it's not needed to perform cosntant GetUnitFacing() calls.
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
When picking all units every 0.04 seconds even though we are destroying the unit
group it is still leaking handle IDs. I tried this with my own spell and the handle IDs
were just climbing into the hundreds and hundreds of thousands on top of what it
should be, and during this whole time the RAM is increasing a little bit. The current
solution I have is to do a custom script enum and then do a gui pick all units - this
avoids the need to destroy the group and of course is then better for keeping the
RAM low.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
hmm let's see...
- LR_Level should be during cast, not during the loop
- Turn on Lightning Rain Lightning Loop <gen> should be in the cast as well
- I really dont know what's the purpose of this >>> Set LR_X = 0.00
in the 0.1 loop trigger
- Make attacktype and damagetype configurables as well
- The 0.04 should be off just like the 0.1 loop
- It's better to add a condition if the caster is alive or not
 
Level 16
Joined
Apr 4, 2011
Messages
995
@Mag, Shaddup

@Bribe, Could you link an example of doing it the correct way please? I kindof get what you're saying, but I learn faster when I can see examples :)

@Mckill, the level is saved to the dummy units, otherwise we can't recall the data correctly. The second loop is off. And the reason why LR_X is set back to 0 everytime is because it is the X-axis in my parabola function.
  • Set LR_X = ((Load 6 of LR_Handle from LR_Hash) + 1.00)
  • Animation - Change LR_LightningUnit flying height to ((((LR_X x LR_X) x -1.00) + (Load 4 of LR_Handle from LR_Hash)) + (58.00 x LR_X)) at 0.00
  • Hashtable - Save LR_X as 6 of LR_Handle in LR_Hash
You're right about the other stuff though. I should move the trigger turn on, should make damage configurable, and should check to see if caster is dead or not.
 
Level 11
Joined
Jun 28, 2011
Messages
540
I really liked this spell, its easily vJASS worthy. You've come a long way from your first spell pack. ^^


First off, I suggest using this dummy unit model as you're using 3 dummy units at the moment. To apply effects, simply add a special effect to its attachment points, and destroy it when done.



This can be simplified:
  • Set LR_Angle = (Random angle)
  • Unit - Create 1 LR_LightningType[LightningPicker] for (Owner of LR_Caster) at LR_Point1 facing LR_Angle degrees
  • ->
  • Unit - Create 1 LR_LightningType[LightningPicker] for (Owner of LR_Caster) at LR_Point1 facing (Random angle) degrees

I still believe Explode Unit is better than Kill Unit, though I have no true evidence to support my claim.

I do not see where you're turning off the .04 loop.

From what I understand, Handle Ids are unique integers given to anything that extend handles. Unit groups, units, timers, triggers, etc., extend handles. This allows us to use hashtables and what not with them. The more X created, the larger the handle id will become, and the larger the number, the longer it takes for the machine to process the command.

This occurs with just about any spell, I do not understand what Bribe's motives are or if my information is wrong.
 
Level 16
Joined
Apr 4, 2011
Messages
995
I think I might have uploaded the version of the map before I put in the part to turn off the trigger. I'll also add some trigger comments so people can follow what I'm doing. And yes, I am using three dummies, but I'd rather not force a user to get an import, even if 75% of them already have the dummy model. Simplifying the angle thing is right, I don't know why I left it in there. Originally the lightning balls were going to be created at every 30 degrees (two full circles). I'll change that.

Thanks for the feedback :)

EDIT: Whoa

You've come a long way from your first spell pack. ^^

How'd you know about that? That was uber deleted, like, four months ago. Lol, I always end up deleting 4/5 resources I upload here, because I either don't like them or don't feel like fixing them.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
the level is saved to the dummy units, otherwise we can't recall the data correctly.

if I cast level 1 'during the cast', then I changed my level to level 2 'during the loop',
then the level 1 lightnings will automatically level 2?...not good...

the reason why I see no purpose of Set LR_X = 0.00 is that it's not saved in the 0.1 loop
so how can it can be loaded if not saved?, unless I'm blind and did not see the saved LX_X???...

btw, I removed the LX_X = 0 and still works...
 
Level 16
Joined
Apr 4, 2011
Messages
995
Right now, all my time and energy is going towards mapping madness #2, which will be over in a few hours (gotta finish it). Afterwards, I'm going to take a week hiatus to adjust back into school/take a break from wc3 modding. Next weekend, I can definitely make one for you. I'd recommend that you make it yourself though :) I'm always for people learning how to create things, but if you REALLY need me, I can make it next week. Expect a PM
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
Next weekend, I can definitely make one for you. I'd recommend that you make it yourself though :)

well for some reason it's hard to understand spells i didn't make...
i guess that's because i know step by step what each trigger does (in my spells)
plus im also kinda busy editing my rpg...i really need some terraining lessons *_*
and thnx in advance if you are making the point-target spell for me!! :grin:
 
Level 16
Joined
Apr 4, 2011
Messages
995
After receiving moderator feedback, I shall promptly fix this spell. I was almost done with the point target one too >_>

Sorry xorkatoss, don't mean to keep you waiting so long, but I'll probably release the point target on the first post as an attachment as soon as I finish fixing my problems.
 
Level 20
Joined
Jul 12, 2010
Messages
1,717
After receiving moderator feedback, I shall promptly fix this spell. I was almost done with the point target one too >_>

Sorry xorkatoss, don't mean to keep you waiting so long, but I'll probably release the point target on the first post as an attachment as soon as I finish fixing my problems.

nop tyt(take your time), after all with school i barely have free time...
and thnx for making it!! :D

Suggestion:
You could put the point-target spell in the map too and just disable it...
so if we want to try it we just enable/disable triggers instead of downloading the attached map...
 
Level 16
Joined
Apr 4, 2011
Messages
995
Updated to v1.2

Fixed like half of the stuff Pharoah_ mentioned. I either didn't consider it necessary or didn't agree with the other stuff he said. I decided to limit the SFX due to graphical lag I was experiencing with the spell (Having 4 internets and WE might have influenced it, but w/e). I'd recommend redownloading if you had 1.0 or 1.1
 
Top