Spell Force Lightning

duyen

New Member
Reaction score
214
Creates a lightning effect from the hero to a unit, then branches out to other units dealing damage.

GUI\JASS? GUI
Leakless? Yes
MUI? No :(
Import difficulty: VERY Low

This spell is EXTREMELY easy to change the following things:

Number of targets,
Lightning Type,
Levels of ability ( I only did one),
Lightning AoE
Unit # Struck


Code:
Force Lightning
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Force Lightning 
    Actions
        Set CasterPoint = (Position of (Triggering unit))
        Set TargetPoint = (Position of (Target unit of ability being cast))
        Set BranchAoE = 350.00
        Set BranchCount = 5
        For each (Integer A) from 1 to BranchCount, do (Actions)
            Loop - Actions
                Set BranchGroup = (Units within BranchAoE of TargetPoint matching ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True)))
                Set BranchUnit = (Random unit from BranchGroup)
                Set BranchPoint = (Position of BranchUnit)
                Lightning - Create a Chain Lightning - Primary lightning effect from source TargetPoint to target BranchPoint
                Set Lightning[(Integer A)] = (Last created lightning effect)
                Unit - Cause (Triggering unit) to damage BranchUnit, dealing ((Real((Level of Force Lightning  for (Triggering unit)))) x 75.00) damage of attack type Spells and damage type Normal
                Custom script:   call DestroyGroup (udg_BranchGroup)
                Custom script:   call RemoveLocation (udg_BranchPoint)
        Wait 0.50 seconds
        For each (Integer A) from 1 to BranchCount, do (Custom script:   call DestroyLightning (udg_Lightning [bj_forLoopAIndex]))
        Custom script:   call RemoveLocation (udg_CasterPoint)
        Custom script:   call RemoveLocation (udg_TargetPoint)

forcelightningpicho8.png


+Rep if you like/use my spell please :D

UPDATED SPELL
 

Attachments

  • Force Lightning.w3x
    15 KB · Views: 633

elmstfreddie

The Finglonger
Reaction score
203
You can't bump dat soon!

Edit > nvm removed that looked at screeny nvm nvm


Okay yea I like this, and surprisingly it is MUI I think. It wouldn't be MUI if you added in a wait.
 

duyen

New Member
Reaction score
214
LOL, your right didn't have to add .50 second wait

EDIT: Nvm lightning effects don't show up if I didn't add a wait.

Is there a "Wait Command" in JASS that goes below .27 seconds?
 

elmstfreddie

The Finglonger
Reaction score
203
Uhh...
When you convert a GUI wait to a JASS wait they are the same thing (TriggerSleepAction(real)) but, I don't see what you mean by "below 0.27'. When I GUIed I used 0.01 waits all the time without fault...

Why the wait though it won't be MUI if you add a wait.

Oh, and, you might wanna add in the sound, because currently it's soundless?
 

duyen

New Member
Reaction score
214
Uhh...
When you convert a GUI wait to a JASS wait they are the same thing (TriggerSleepAction(real)) but, I don't see what you mean by "below 0.27'. When I GUIed I used 0.01 waits all the time without fault...

Why the wait though it won't be MUI if you add a wait.

Oh, and, you might wanna add in the sound, because currently it's soundless?

The GUI wait, when you set it below .27 it only waits .27 seconds no matter what it's set to, ask any admin. :cool:
Since it's based off Chain Lightning, it makes a sound.

Download before you judge :p
 

elmstfreddie

The Finglonger
Reaction score
203
If you add a wait however there will only be 1 sound, not multiple sounds (which it should since it branches)...
I know any mod/admin/etc say that about waits but I seriously have never had problems with 0.01 waits...
 

Tinki3

Special Member
Reaction score
418
The leaks, and the infamous code:

Unit Group - Pick every unit in (Random 1 units from (Units within 200.00 of TargetPoint))
-> Random 1 units from (<unit group>), leaks. Alternatively, and efficiently, you can set the unit group into a variable, without the 'random units' part, and use a unit variable to isolate the random unit from the group variable. You should also filter units that aren't dead, and that are enemies of the triggering unit (caster).

For ex:
Code:
Set BranchGroup = (Units within <BranchAoE> of TargetPoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)))
Set BranchUnit = (Random unit from BranchGroup)
[COLOR="Green"]//Do further actions below[/COLOR]

Set FL_Group = (Last created unit group)
Unit Group - Remove TargetUnit from FL_Group
-> Setting FL_Group won't save you from the leakage here. And you needed to place the custom script line that destroys the group inside the loop - actions. I'm quite sure that the "Pick every unit in (Random 1 units from.." leaks as soon as it's executed anyway. Fully remove the 'Set FL_Group" line.

"TargetUnit" is never set inside the trigger. Remove it, and the "Unit Group - Remove TargetUnit" line itself.

Unit - Set life of (Picked unit) to ((Life of (Picked unit)) - 100.00)

-> Setting the life of units doesn't give the caster of any spell credit for killing those affected units (ie, bounty, and possibly exp.). Use, "Unit - Damage Target", instead, as it does give credit for those such things, and also make the damage levelable.

For ex:
Code:
Unit - Cause (Triggering unit) to damage <BranchUnit>, dealing ((Real((Level of Force Lightning  for (Triggering unit)))) x 75.00) damage of attack type Spells and damage type Normal

Custom script: call DestroyLightning (udg_Lightning [1])
-> Lightning [2], [3], [4], and maybe even [5]. Yup, there is a "better" way to make the destroyal of the lighting easier. Simply set an integer variable to the amount of lightning branches, use that instead of the '3' that you have as the 'For each (Integer A) from 1 to..", at the moment, and use another loop to destroy all the lighting effects.

For ex:
Code:
Set BranchCount = 5
For each (Integer A) from 1 to BranchCount, do (Actions)
...
For each (Integer A) from 1 to BranchCount, do (Custom script:   call DestroyLightning (udg_Lightning [bj_forLoopAIndex]))
Simple, isn't it?
It'll destroy every lighting stored in the arrayed-variable via the loop, and if you wanted to edit the amount of lighting branches produced, all you have to do is change the "BranchCount" variable to the desired value. Then the loop takes care of all the leaks by using the BranchCount variable as a reference.


The Optimized Trigger:

I've created another few variables that make general editing a bit easier.
Leaks are all fixed.

Code:
Force Lightning Fixed
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Force Lightning 
    Actions
        Set CasterPoint = (Position of (Triggering unit))
        Set TargetPoint = (Position of (Target unit of ability being cast))
        Set BranchAoE = 500.00
        Set BranchCount = 5
        For each (Integer A) from 1 to BranchCount, do (Actions)
            Loop - Actions
                Set BranchGroup = (Units within BranchAoE of TargetPoint matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True)))
                Set BranchUnit = (Random unit from BranchGroup)
                Set BranchPoint = (Position of BranchUnit)
                Lightning - Create a Chain Lightning - Primary lightning effect from source TargetPoint to target BranchPoint
                Set Lightning[(Integer A)] = (Last created lightning effect)
                Unit - Cause (Triggering unit) to damage BranchUnit, dealing ((Real((Level of Force Lightning  for (Triggering unit)))) x 75.00) damage of attack type Spells and damage type Normal
                Custom script:   call DestroyGroup (udg_BranchGroup)
                Custom script:   call RemoveLocation (udg_BranchPoint)
        Wait 0.60 seconds
        For each (Integer A) from 1 to BranchCount, do (Custom script:   call DestroyLightning (udg_Lightning [bj_forLoopAIndex]))
        Custom script:   call RemoveLocation (udg_CasterPoint)
        Custom script:   call RemoveLocation (udg_TargetPoint)
 

~GaLs~

† Ғσſ ŧħə ѕαĸε Φƒ ~Ğ䣚~ †
Reaction score
180
if i am not mistaken....u didnt remove BranchUnit from BranchGroup after damaging it...maybe this will cause double shock or even triple shock to the same unit...
 

Tinki3

Special Member
Reaction score
418
Good fixing.
One last thing though:

Set BranchGroup = (Units within BranchAoE of TargetPoint matching ((((Matching unit) belongs to an enemy of Player 1 (Red)) Equal to True) and (((Matching unit) is alive) Equal to True)))
-> What if Player 2 (Blue) were to use the spell? This is inaccurate as is. Change underlined-text to: (Owner of (Triggering unit))). That'll take care of any player that wants to use the spell.

You also need to include a player-unit restoration trigger, and a hero revival trigger in your test map.
Or you could always import everything into the STMT (see my sig below).
 

duyen

New Member
Reaction score
214
if i am not mistaken....u didnt remove BranchUnit from BranchGroup after damaging it...maybe this will cause double shock or even triple shock to the same unit...

How do you know that wasn't intended.
 

ironfist19

New Member
Reaction score
3
Uhmm, nice job. +rep Can i have a request?
Can you do this? Ex. Hero casts chain lightning then the forked lightning that strikes the other can knockback?
 
General chit-chat
Help Users
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/
  • The Helper The Helper:
    Here is another comfort food favorite - Million Dollar Casserole - https://www.thehelper.net/threads/recipe-million-dollar-casserole.193614/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top