Past perfect continuous for continuous events in the past
The past perfect continuous tense is used to express that an action started before a point in time in the past and that it was still in progress or it had just stopped. This point can be implied or expressed with a time expression or a clause with a verb in the past simple tense:
It had been snowing all night.
By 2005, George had been living in Scotland for 20 years.
When I got to her house, she had been waiting for hours.