Okay, make a black and white gradient perpendicular to the direction you want the lightning or crack to be...
Now, go to Filter > Render > Difference clouds on the same layer.
Select a pure black color, and Select > Color Range, use a low number... between 0 and 5 or so... 0 may be too hard on the edges but it can work.
With that selected, make a copy, or create a new layer, and fill the selection with a color... lightning would best be white or a bright color...
Edit the layer styles(double click the selected layer, but not in the area of the layer name) and add Outer Glow, as you see fit.
For a crack in a wall or such, use any color, turn the Fill to 0 (it's below Opacity... Keep opacity at 100%) add a Bevel and Emboss layer style effect, and change the settings until you get something you like.