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

Orb of Lightning v0.5

  • Like
Reactions: naitsirk
Orb of Lightning v0.5
--------------------------------------
Created by Mjllonir

Description :

The caster creates an orb of lightning over his head. This orb does not follow him, it merely stays at one spot and attacks units within a 500 AoE from it. It will only attack one unit at a time, and choose at random the unit it attacks. It deals 35/70/105 damage, attacks each half second and lasts 10/20/30 seconds on the field. Afterwards it will disappear.

As far as I am concerned, this spell is MUI, has a Description of everything and should be leakless.

If you have any questions, don't hesitate to PM.

Additional Information


  • Activate Orb of Lightning MUI
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Orb of Lightning
    • Actions
      • -------- Creating the Hash Table --------
      • -------- ------------------------------ --------
      • Hashtable - Create a hashtable
      • Set Hash_OL = (Last created hashtable)
      • -------- This is to make sure all the heroes would be able to do the same spell. --------
      • -------- ------------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • mui Equal to 0
        • Then - Actions
          • Trigger - Turn on Orb of lightning loop new MUI <gen>
        • Else - Actions
      • Set mui = (mui + 1)
      • Set mui_index = (mui_index + 1)
      • -------- General Variables --------
      • -------- ------------------------------ --------
      • Set Caster[mui_index] = (Triggering unit)
      • Set C_Point[mui_index] = (Position of Caster[mui])
      • -------- You may modify these to your liking --------
      • -------- ------------------------------ --------
      • Set C_AoE[mui_index] = 500.00
      • Set Timer[mui_index] = (10.00 x (Real((Level of Orb of Lightning for Caster[mui_index]))))
      • Set LDMG[mui_index] = (35.00 x (Real((Level of Orb of Lightning for Caster[mui_index]))))
      • -------- Makes sure the player may not summon more than one orb at a time. --------
      • -------- ----------------------------------- --------
      • Set Spell_Activated[mui_index] = True
      • -------- Charm SFX --------
      • -------- ----------------------------------- --------
      • Special Effect - Create a special effect attached to the overhead of Caster[mui_index] using Abilities\Spells\Other\Charm\CharmTarget.mdl
      • Set SFX2[mui_index] = (Last created special effect)
      • -------- Summoning the Orb --------
      • -------- ----------------------------------- --------
      • Unit - Create 1 Dummy (orb) for (Owner of Caster[mui_index]) at C_Point[mui_index] facing Default building facing degrees
      • Set Orb[mui_index] = (Last created unit)
      • -------- More general variables --------
      • Animation - Change Orb[mui_index] flying height to 500.00 at 0.00
      • Set O_Height = (Current flying height of Orb[mui_index])
      • Set O_Point[mui_index] = (Position of Orb[mui_index])
      • -------- The next few are variables for the Hash Table --------
      • -------- ----------------------------------- --------
      • Hashtable - Save Timer[mui_index] as 0 of (Key (Picked unit)) in Hash_OL
      • Hashtable - Save O_Height as 1 of (Key (Picked unit)) in Hash_OL
      • Hashtable - Save Handle OfO_Point[mui_index] as 2 of (Key (Picked unit)) in Hash_OL
      • -------- The group includes all units within C_AoE --------
      • Set T_Group[mui_index] = (Units within C_AoE[mui_index] of O_Point[mui_index])
      • -------- We take out the caster from the unit group (He is initially included). This way he does not get attacked --------
      • Unit Group - Remove (Triggering unit) from T_Group[mui_index]
      • -------- Destroying the 'Charm' effect --------
      • -------- ----------------------------------- --------
      • Special Effect - Destroy SFX2[mui_index]
  • Orb of lightning loop new MUI
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer mui_T) from 1 to mui_index, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Spell_Activated[mui_T] Equal to True
            • Then - Actions
              • -------- Setting up the Hash variables --------
              • -------- ---------------------- --------
              • Set Timer[mui_T] = (Load 0 of (Key (Picked unit)) from Hash_OL)
              • Set O_Height = (Load 1 of (Key (Picked unit)) from Hash_OL)
              • Set O_Point[mui_T] = (Load 2 of (Key (Picked unit)) in Hash_OL)
              • -------- This is the Timer, also set up in a hash table. --------
              • Hashtable - Save (Timer[mui_T] - 0.50) as 0 of (Key (Picked unit)) in Hash_OL
              • -------- Choosing a random unit inside T_Group --------
              • -------- ---------------------- --------
              • Set Chosen_Target[mui_T] = (Random unit from T_Group[mui_T])
              • -------- If the Timer is higher than 0 seconds, than the spell will continue and the orb will attack. --------
              • -------- ---------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Timer[mui_T] Greater than 0.00
                  • (Chosen_Target[mui_T] is alive) Equal to True
                • Then - Actions
                  • -------- Removing the previous Effects --------
                  • -------- ---------------------- --------
                  • Custom script: call DestroyLightning(udg_LFX[udg_mui_T])
                  • Special Effect - Destroy SFX1[mui_T]
                  • -------- General Variables --------
                  • -------- ---------------------- --------
                  • Set CT_Point[mui_T] = (Position of Chosen_Target[mui_T])
                  • Set OT_Spot[mui_T] = (O_Point[mui_T] offset by 25.00 towards (Angle from O_Point[mui_T] to CT_Point[mui_T]) degrees)
                  • -------- The following variables are in Jass because the GUI method is too restricted at this point. More details above, in the Trigger Comment. --------
                  • Custom script: set udg_O_Spot[udg_mui_T] = (GetLocationZ(udg_OT_Spot[udg_mui_T]) + udg_O_Height)
                  • Custom script: set udg_T_Height[udg_mui_T] = GetLocationZ(udg_CT_Point[udg_mui_T]) + 60
                  • Custom script: set udg_LFX[udg_mui_T] = AddLightningEx( "CHIM" , true, GetLocationX(udg_OT_Spot[udg_mui_T]), GetLocationY(udg_OT_Spot[udg_mui_T]), udg_O_Spot[udg_mui_T], GetLocationX(udg_CT_Point[udg_mui_T]), GetLocationY(udg_CT_Point[udg_mui_T]), udg_T_Height[udg_mui_T])
                  • -------- Small Special Effect when the lightning bolt hits the target --------
                  • -------- ------------------------------ --------
                  • Special Effect - Create a special effect at CT_Point[mui_T] using Abilities\Weapons\Bolt\BoltImpact.mdl
                  • Set SFX1[mui_T] = (Last created special effect)
                  • -------- We pause the Orb for a moment, to make sure it is able to attack the Chosen Target --------
                  • -------- ----------------------------------- --------
                  • Unit - Pause Orb[mui_T]
                  • Unit - Cause Orb[mui_T] to damage Chosen_Target[mui_T], dealing LDMG[mui_T] damage of attack type Spells and damage type Unknown
                  • Unit - Unpause Orb[mui]
                • Else - Actions
              • -------- If the Timer is lower than 0 seconds, than the spell will end, destroy the orb (Which will also make it stop attacking) as well as getting rid of the Leaks. --------
              • -------- ---------------------- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Timer[mui_T] Less than or equal to 0.00
                • Then - Actions
                  • -------- Removing the last created effects (One will stay after the timer reaches 0) --------
                  • -------- ---------------------- --------
                  • Custom script: call DestroyLightning(udg_LFX[udg_mui_T])
                  • Special Effect - Destroy SFX1[mui_T]
                  • -------- Remove the Orb from the game. This way it may not attack or shoot bolts. --------
                  • Unit - Kill Orb[mui_T]
                  • -------- Removing Leaks (This includes Groups, Locations and the Hash Table) --------
                  • -------- ----------------------------------- --------
                  • Custom script: call DestroyGroup(udg_T_Group[udg_mui_T])
                  • Custom script: call RemoveLocation(udg_C_Point[udg_mui_T])
                  • Custom script: call RemoveLocation(udg_CT_Point[udg_mui_T])
                  • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in (Last created hashtable)
                  • -------- The spell is now set to false, we are now allowed to restart the spell. --------
                  • Set Spell_Activated[mui_T] = False
                  • -------- Once a hero is done, that means the number of spells cast is now -1. --------
                  • Set mui = (mui - 1)
                • Else - Actions
            • Else - Actions
          • -------- ----------------------------------- --------
          • -------- If no one is casting the spell, turn the spell off. --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • mui Equal to 0
            • Then - Actions
              • -------- Turning off this Trigger. If the spell is reactivated, the first trigger will reactivate this one. --------
              • -------- MUI_Index is now equal to 0 because this refers that no one is casting a spell, which is why we are turning off the spell and MUI is equal to 0. --------
              • -------- ----------------------------------- --------
              • Set mui_index = 0
              • Trigger - Turn off (This trigger)
            • Else - Actions
  • Unit dies group update MUI
    • Events
      • Unit - A unit Dies
    • Conditions
      • Spell_Activated[mui_T] Equal to True
      • ((Triggering unit) is in T_Group[mui_T]) Equal to True
    • Actions
      • Unit Group - Remove (Triggering unit) from T_Group[mui_T]



Importing this spell is quite easy. All you need to do is Copy and Paste. Here is a list of what you will need to copy and paste :

OBJECTS (1) :
-Dummy (orb)

ABILITIES (1) :
-Orb of Lightning

TRIGGERS (3) :
-Activate Orb of Lightning MUI
-Orb of lightning loop new MUI
-Unit dies group update MUI

*No Third Party programs needed*


Changelog


v0.1 : Submitted to Hive
v0.2 : Fixed small bugs
v0.3 : Fixed some bugs as well as fixing MUI
v0.4 : Fixed the lightning effects and the damage (For some reason it didn't work)
v0.5 : Added MUI, changed the design of the spell description.



Alright now it should be MUI, please tell me if it isn't. Thank you to Deuterium for his Essentials Tutorial (It made my mind clear up about this whole MUI thing)

I also changed the spell description thread. It should be a little cleaner.



Please Comment and rate :). Don't forget to credit me if you use this spell

Mjllonir

Keywords:
Orb, lightning, electricity, storm
Contents

Orb of Lightning v0.5 (Map)

Reviews
20:13, 8th Dec 2009 TriggerHappy: Review for Spell You don't need the second if statement in "Orb of lightning loop new MUI" you can simply place it under the else condition of the first if. Status Approved

Moderator

M

Moderator

20:13, 8th Dec 2009
TriggerHappy:

Review for Spell

You don't need the second if statement in
"Orb of lightning loop new MUI" you can simply
place it under the else condition of the first if.

Status

Approved
 
Level 8
Joined
May 31, 2009
Messages
439
Well, then it seems I'm going to need a lesson on MUIing, because the first way I did it, it wasn't going to work, so I switched it to this one. Seems it's also the wrong way to do it. I don't know how to properly use Hashtables, so I just try to evade them I guess >.>

It seems I need to put the wait in there, otherwise the effects don't show up at all :S. Any help?

And I don't see why I can't just turn off the trigger once it's done. Explain?

And for the Special Effects, I'll see what I can do ;)
 
Okay dude. Good to see you here again ;)

First of all it needs to be MUI. Making a waiting trigger that waits 0.00 seconds is making it non-mui. When using it in multiplayer (maybe also singleplayer, dunno), waits under 0.27 still will count as 0.27. And that means it wont be MUI. And about turning off the trigger; it also makes the spell MUI. I dont have any solution yet, to make that MUI, but im working on it. I have the same problem. Anyways if you can remove the wait it will be more MUI than before. For the special effects that wont show up, thats because if the effect dont have the required animations it cant be instantly destroyed. I think the only solution here, is to choose another effect. Now you only have to trigger the second trigger, to make it MUI. It needs to be recycling, but i dont know how to make it. If i find a solution i will ofc say you ;) Now, good luck at improving, i hope this helped u a little ;)
 
Level 8
Joined
May 31, 2009
Messages
439
D4RK_G4ND4LF, as it says, it has no triggers at all, and you told me it has been deleted probably because of that. Mine is triggered, and with that probably much more complicated to make. (Although perhaps not prettier, for now)

UPDATED to v0.3

All details on first post.
 
Last edited:
Level 19
Joined
Feb 25, 2009
Messages
2,004
Why you don't make the Orb to create dummies which cast Chain Lightning with only 1 target allowed... that will make it easier, without the confusing custom script for the Lightning Effcet and you can add an SFX when the lightning hits the targets. Otherwise, you can trigger another SFX to be added when the target is hit by the lightning or before that, when the dummy starts the effect.
 
Level 10
Joined
Jan 24, 2009
Messages
606
It's still not MUI. I would Give you a hint too... The Integer MUI should not be Player number of owner of triggering unit... It should be: Set MUI = MUI + 1

And After the Loop I would set MUI = MUI - 1 maybe...

This would Make it atleast more MUI Then it is:p
 
Level 8
Joined
May 31, 2009
Messages
439
Well see originally it was like that Naitsirk. I would love to try to explain but it's long and very hard to explain as text. Lets say MUI = 1 at the beginning.

Player activates Spell (MUI = 2)

Now all the variables will be set with the MUI = 2. So the caster, target etc.

Do you realise that if someone else casts the spell, MUI = 3 and then we don't know who the targets are, for the MUI (2) targets? I think I'm correct when I'm saying that it wouldn't work properly.

Once again, lets say a player finishes the spell when MUI = 3, now it's equal to 2 right?

Well one player had targets set when MUI = 3, but the program will be confused because now it's equal to 2.

So I really don't know how to make it MUI, so thats why I made it MPI or however you call it, with the number of triggering player, this way everyone has tehir own numbewr, and theres no way it will screw up, unless one player has the same hero and does it at the same time, which I am trying to fix up.

Please tell me how to do it properly otherwise.
 
Level 10
Joined
Jan 24, 2009
Messages
606
Well see originally it was like that Naitsirk. I would love to try to explain but it's long and very hard to explain as text. Lets say MUI = 1 at the beginning.

Player activates Spell (MUI = 2)

Now all the variables will be set with the MUI = 2. So the caster, target etc.

Do you realise that if someone else casts the spell, MUI = 3 and then we don't know who the targets are, for the MUI (2) targets? I think I'm correct when I'm saying that it wouldn't work properly.

Once again, lets say a player finishes the spell when MUI = 3, now it's equal to 2 right?

Well one player had targets set when MUI = 3, but the program will be confused because now it's equal to 2.

So I really don't know how to make it MUI, so thats why I made it MPI or however you call it, with the number of triggering player, this way everyone has tehir own numbewr, and theres no way it will screw up, unless one player has the same hero and does it at the same time, which I am trying to fix up.

Please tell me how to do it properly otherwise.

you could try reading http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/essentials-tutorial-141191/

It explains MUI when there is a loop... so... Check it out...
 
(NOTE: I'm not telling you to do this, just suggesting)

Using this will remove some lines from the trigger making it shorter
  • Unit - Order Unit To Orc Shaman - Chain Lightning Unit
here are some of the lines you can remove if you used the above action..
  • -------- General Variables --------
  • -------- ---------------------- --------
  • Set CT_Point[mui_T] = (Position of Chosen_Target[mui_T])
  • Set OT_Spot[mui_T] = (O_Point[mui_T] offset by 25.00 towards (Angle from O_Point[mui_T] to CT_Point[mui_T]) degrees)
  • -------- The following variables are in Jass because the GUI method is too restricted at this point. More details above, in the Trigger Comment. --------
  • Custom script: set udg_O_Spot[udg_mui_T] = (GetLocationZ(udg_OT_Spot[udg_mui_T]) + udg_O_Height)
  • Custom script: set udg_T_Height[udg_mui_T] = GetLocationZ(udg_CT_Point[udg_mui_T]) + 60
  • Custom script: set udg_LFX[udg_mui_T] = AddLightningEx( "CHIM" , true, GetLocationX(udg_OT_Spot[udg_mui_T]), GetLocationY(udg_OT_Spot[udg_mui_T]), udg_O_Spot[udg_mui_T], GetLocationX(udg_CT_Point[udg_mui_T]), GetLocationY(udg_CT_Point[udg_mui_T]), udg_T_Height[udg_mui_T])
  • -------- Small Special Effect when the lightning bolt hits the target --------
  • -------- ------------------------------ --------
  • Special Effect - Create a special effect at CT_Point[mui_T] using Abilities\Weapons\Bolt\BoltImpact.mdl
  • Set SFX1[mui_T] = (Last created special effect)

Look at this, I guess the description is wrong...
  • -------- We pause the Orb for a moment, to make sure it is able to attack the Chosen Target --------
  • -------- ----------------------------------- --------
  • Unit - Pause Orb[mui_T]
  • Unit - Cause Orb[mui_T] to damage Chosen_Target[mui_T], dealing LDMG[mui_T] damage of attack type Spells and damage type Unknown
  • Unit - Unpause Orb[mui]
you said we pause the orb so that it can attack the target but you don't use the order attack instead you just used the action Unit-Damage Target so you don't need that pause already.
 
Level 8
Joined
May 31, 2009
Messages
439
Hmmm, I think if you use the order attack unit, doesn't that make the orb move? As for the custom text and special effects, it seems that the special effects appear slower than the speed at which it does currently...Don't worry though, I'm trying to fix it though. What I would like to know though is if I managed to make it MUI or not :)
 
Hmmm, I think if you use the order attack unit, doesn't that make the orb move? As for the custom text and special effects, it seems that the special effects appear slower than the speed at which it does currently...Don't worry though, I'm trying to fix it though. What I would like to know though is if I managed to make it MUI or not :)

I didn't say that you use the Order Attack, what I said is that you can already remove the pause/unpause because you just used the Action DamageTarget.. I guess its already MUI though I just took a glance at the trigger, I haven't tested it yet...
 
Level 3
Joined
Mar 20, 2009
Messages
12
Or you could just summon a lightning orb dummy unit then let its abilities be locust and lightning attack

Drawback in this is that you'll need different orbs of lightning to be summoned at each level, so if i were using it i make sure that there aren't too many levels required

Another drawback in mine is that the orb only attacks 1 unit until it dies or can no longer attack it, so just make a trigger which makes it switch targets
 
Top