Lightning Line an Bounce Attacks

Twilight33

New Member
Reaction score
4
ok i have a heroe in the game i'm making it is supposed to have a missile line attack that looks like the lighting from chain lightning, and its supposed to just fire a striaght lightning bolt all the way to the end of the missle line spill distance for the attack. the problem is that the missile just stops and dispates at the primary target hit. i also am unable to find the lightning effect for chain lightning to set for my projectile art.

i assumed the best way to do this was to just have a trigger do the lightning effect every time the hero attacks. and im assuming that the "Lightning - Create Lightning Effect" action will give me the cosmetic look im looking for. my question is how do i set the trigger up to do this properly. i took a wild swing at it but it doesnt look right. doing it this way would create multiple bolts for each unit hit in the attack line. how do i fix this?

Untitled Trigger 001
Events
Unit - A unit Is attacked
Conditions
(Attacking unit) Equal to The Hero
Actions
Lightning - Create a Chain Lightning - Primary lightning effect from source (Position of (Attacking unit)) to target (Position of (Triggering unit))
Wait 1.00 seconds
Lightning - Destroy (Last created lightning effect)

also how would i alter this so it works for a hero with a bounce attack?
 

Mr.Tutorial

Hard in the Paint.
Reaction score
42
Isnt it against the attacked unit?

Because you got it on "Attacking Unit". I don't know im not that great with this kind of stuff.
 
K

Kerberos

Guest
I suggest the following changes:

Variables: BounceTargets (unit group), AttackedUnit (unit), LightningBounce (lightning effect, array with as many elements as you want bounces)

Code:
Untitled Trigger 001
    Events
        Unit - A unit Is attacked
    Conditions
        (Attacking unit) Equal to The Hero
    Actions
        Lightning - Create a Chain Lightning - Primary lightning effect from source (Position of (Attacking unit)) to target (Position of (Triggering unit))
        Set BounceTargets equal to (All units within (400 of (Attacked unit)))
        Set AttackedUnit equal to (Attacked unit)
        For each Integer A from 1 to <max number of bounces>, do (Actions)
            Loop - Actions
                Pick a random unit in BounceTargets and do (Actions
                    Loop - Actions
                        Add (Picked unit) to CustomValueUnitGroup
                        Set the custom value of (Picked unit) to 1
                        Lightning - Create a Chain Lightning - Secondary lightning effect from source (Position of AttackedUnit) to target (Position of (Picked unit))
                        Set LightningBounce[Integer A] equal to (Last created lightning effect)
                        Deal (Picked unit) <your number> damage
                        Set BounceTargets equal to (All units within (400 of Picked unit)) matching ((Custom value of (Matching unit)) Not equal to 1)
                        Remove (Picked unit) from BounceTargets
                        Set AttackedUnit equal to (Picked unit)
        Pick every unit in CustomValueUnitGroup and do (Set (Custom value of (Picked unit)) equal to 0)
        Wait 1.00 seconds
        For each Integer A from 1 to <max number of bounces>, do (Actions)
            Loop - Actions
                Destroy LightningBounce[Integer A]
                Custom script:    call DestroyGroup( udg_BounceTargets )
                Custom script:    set udg_AttackedUnit = null
                Custom script:    set udg_LightningBounce[bj_ForLoopAIndex] = null
I'm a little shaky on the last two lines, but I think they work and fix memory leaks.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top