Since no one answered, I'll make a suggestion but I don't know if it will work.
According to the wiki, v 0.47.01 added some new functionalities to custom interactions.
1) [I_TARGET:A:LOCATION], [IT_LOCATION:RANDOM_NEARBY_LOCATION:A:X]
These tokens can be used to specify a location (A) in the local map and then force an interaction to target a random tile within a given radius (X) from the specified location (A). That could be used to emulate random lighting strikes in the map, but I don't think it can be used to find the hightest point/"shortest path" for the electric discharge.
2) [I_EFFECT:SUMMON_UNIT], [CREATURE:<creature token>:<caste token>]
Right, so this is where DFhack I guess has to come in. When the interaction happens, it triggers an automated lua script, which picks a random above ground tile on the surface, and then calculates the highest targetable z point above that area, and then changes to the target's z coordinate to that spot.
It's interesting that you suggested a creature, because if we use a short lived one, one that lives for 4 ticks, it could use an interaction and vanish. This would allow us to get away with some stuff that we might not otherwise be able to get away with in vanilla. However, if we're already involving DFhack to target tiles on the z axis, then this doesn't seem particularly necessary.
Alright, so let's say we have managed to randomly target a tile on the map, and then raised that target to the highest possible z elevation above it through an automated script, and further, we now have access to lua for whatever comes next.
My idea, is for the lighting to Etch-a-Sketch its way down to the surface by shifting 1x and/or 1y coordinate during each z-level transition, and producing an instantly evaporating boulder of flashing "lightning" for each z level, (because thats the best I got), which has a fixed temp of 5x magma. Every z level transition, the script checks for whether its targeting a ground tile, if it is, it creates a cave in explosion of lightning dust, and then terminates. (
It could also play a sound effect?)
I'm not sure if the lightning's path should be purely cosmetic, or if it should attempt to model natural lightning in some manner. Like, have it determine if moving over x number of spaces as it climbs down, will allow it to travel faster through a tree within range that it can strike, rather than continuing to travel through air.