Study the information about the past perfect continuous.
The past perfect continuous is used to talk about actions or situations that were in progress before some other actions or situations. There are also other uses:
Duration of a past actionThe main use of the past perfect continuous is to express actions or situations that were in progress before some other actions or situations.The boys had been quarrelling for half an hour when we arrived home.
Showing causeUse this tense to show the cause of an action or situation in the past.John was in detention because he had been misbehaving.
Third conditionalRemember that this tense is also used in the third conditional sentences.If it hadn't been raining, we would have gone to the park.
Reported speechThis tense also appears in reported speech.She said she knew Charlie had been lying to her.
Non-continuous verbs*It is important to remember that non-continuous verbs cannot be used in any continuous tenses. Instead of using the past perfect continuous with these verbs, you must use the past perfect.The motorcycle had belonged to George for years before Tina bought it.
Non-continuous verbs usually indicate actions you cannot see somebody doing. These verbs are rarely used in continuous tenses. They include:
Abstract verbs                
to be, to want, to cost, to seem, to need, to care, to contain, to owe, to exist, etc.
Possession verbs
to possess, to own, to belong, etc.
Emotion verbs
to like, to love, to hate, to dislike, to fear, to envy, to mind, etc.
Positive sentences
Subject + had + been + verb(ing)
I had been running for an hour before I twisted my ankle.
Had + subject + been + verb(ing)
Question word + had + subject + been + verb(ing)
Had they been listening for 2 hours yesterday?
How long had the player been playing before he scored?
Negative Sentences
Had + not + been + verb(ing)
Hadn't + been + verb(ing)
He said he wasn't tired because he had not been working that day.
If it hadn't been raining, we would have played football.
Compare the past perfect and the past perfect continuous:
They had eaten dinner when their friends came. (the past perfect) - a past action which happened before another past action.
They had been waiting for the bus for half an hour before it came. (the past perfect continuous) - we put emphasis on the duration of an action which started and finished in the past.