[verb (dictionary form)] + つもりだった [verb た-form] + つもりだった [verb て-form] + いる + つもりだった [i-adj] + つもりだった [na-adj] + な + つもりだった [noun] + の + つもりだった
つもりだった means "I was going to": after the dictionary form of a verb, it gives an intention you had, and almost always one that did not work out. The second half, joined by けど, が or のに, says what got in the way.
The past tense does not by itself mean the plan failed. With さいしょ最初からor a similar phrase, it simply reports what you intended at the time.
After a た-form or a ている-form, つもりだった is about what you believed you had done or were doing. Reality turned out otherwise.
The tense of the verb is what tells the two meanings apart.
After a noun with の, or an adjective, つもりだった says how you meant something, or how you saw yourself – and others took it differently.