Well... When you run over a loud jerk sometimes things go clunk.

When was the last time you used 4wd, was it fairly recent? Wondering if it is possible that the flashing lights and no 4wd are a separate issue from the "loud jerk and clunk".
No problems with 2wd? That means it's probably between the transfer case and the front axle.
Possible, but I doubt it is the transfer case itself, because I suspect that would show symptoms in 2wd. Given the flashing lights I would think that something electical/electronic was affected, not much in the front axle that would cause that I think. Only time I had lights flash in my '99 4wd was because of the shift motor, the 4wd system didn't give a care about the PHV system being failed.
Jerk and clunk would make me think a broken shaft, either axle or drive, but since you have the hubs locked in that should show symptoms even in 2wd and I'm not sure it would cause lights to flash. After installing the V8 AWD drivetrain the front driveshaft CV joint gave out on my truck and it definitely let you know, that's really not much different that what you would have in a live axle (or manually locked hub) 4wd truck with the axles and driveshaft turning full time.
Probably the first thing to do is get under there and look for anything broken or missing. Did the shift motor possibly leave the chat? That could definitely explain the loud clunk and flashing lights. Not a common issue, but not impossible either.
Mostly spitballing here, trying to think of things for you to look at and check on. Really not much diagnosing I can do from this side of a computer screen.