Hello. Here I'm going to ask how to create a chain lightning effect and answer it myself with what i managed to accomplish since i looked everywhere and could not find anything on how to create chain lightning on construct.
Ill link my test project on git hub too.
I hope this helps anyone else who gets stuck on something like this in the future.
Here is the test project.
https://github.com/otoduran/construct-3-chain-lightning-test
And here is the code.
[chain lightning]
----+ Mouse: On Left button released
----+ timerGun: [X] Is Timer "cd" running
-----> player: Cast LineOfSight ray from (Self.X, Self.Y) to (Mouse.X, Mouse.Y) (use collision cells True)
-----> Audio: Play pickupCoin.webm not looping at volume 0 dB (stereo pan 0, tag "")
-----> timerGun: Start Timer "cd" for 1.0 (Once)
--------+ player: LineOfSight ray intersected
--------+ System: Trigger once
---------> System: Create object lightningspell on layer 1 at (player.LineOfSight.HitX, player.LineOfSight.HitY), create hierarchy: False, template: ""
---------> player: Spawn lightning on layer 1 (image point 0, create hierarchy: False)
---------> lightning: Set angle toward (Mouse.X, Mouse.Y)
---------> lightning: Set width to distance(Self.X, Self.Y, mouse.X, mouse.Y)
------------+ lightningspell: Is overlapping enemy
------------+ enemy: Pick nearest to (lightningspell.X, lightningspell.Y)
------------+ enemy: beenhit = 0
-------------> Audio: Play energyPickup.webm not looping at volume 0 dB (stereo pan 0, tag "")
-------------> enemy: Spawn lightningDetector on layer 1 (image point 0, create hierarchy: False)
----+ lightningDetector: Is overlapping enemy
----+ enemy: beenhit = 0
----+ System: charges > 0
----+ System: Trigger once
-----> System: Wait 0.08 seconds
-----> Audio: Play sfxhit1.webm not looping at volume 0 dB (stereo pan 0, tag "")
-----> enemy: Spawn lightningDetector on layer 1 (image point 0, create hierarchy: False)
-----> System: Subtract 1 from charges
--------+ (no conditions)
---------> Audio: Play swing1.webm not looping at volume 0 dB (stereo pan 0, tag "")
----+ System: charges = 0
-----> System: Wait 0.11 seconds
-----> System: Set charges to maxCharges
----+ System: [X] charges = 3
-----> System: Wait 0.4 seconds
-----> System: Set charges to maxCharges
----+ enemy: On collision with lightningspell
-----> enemy: Set beenhit to 1
-----> enemy: Start Timer "gothit" for 0.2 (Once)
----+ enemy: On collision with lightningDetector
-----> enemy: Set beenhit to 1
-----> enemy: Start Timer "gothit" for 0.2 (Once)
----+ enemy: On Timer "gothit"
-----> enemy: Set beenhit to 0
----+ System: Every tick
-----> player: Add LineOfSight obstacle enemy
-----> player: Set LineOfSight range to 600
-----> player: Set LineOfSight cone of view to 0.1
-----> lightningspell: Fade: set fade-out time to 0.1
----+ lightningDetector: On created
-----> lightningDetector: Add LineOfSight obstacle enemy
-----> lightningDetector: Set LineOfSight range to 300
-----> lightningDetector: Add Turret target enemy
-----> lightningDetector: Set Turret rotate speed to 20000
-----> lightningDetector: Fade: set fade-out time to 0.1
-----> lightningDetector: Set Turret range to 300
-----> lightningDetector: Set Turret rate of fire to 1
-----> lightningDetector: Set visibility Invisible
--------+ enemy: [X] beenhit = 1
--------+ enemy: Is overlapping lightningDetector
--------+ enemy: [X] Is overlapping lightningspell
---------> lightningDetector: Spawn lightning on layer 1 (image point 0, create hierarchy: False)
---------> lightning: Set angle toward (enemy.X, enemy.Y)
---------> lightning: Set width to distance(Self.X, Self.Y, enemy.X, enemy.Y)
----+ System: For each enemy
----+ lightningDetector: Is overlapping enemy
----+ System: Trigger once
-----> (no actions)
----+ enemy: beenhit = 1
-----> (no actions)
----+ lightningspell: On created
-----> lightningspell: Set visibility Invisible