When the Ghost of King Hamlet first appears in Scene 4 of Act I, Hamlet seems resolute in his determination to learn why this ghost has come to him,
Why, what should be the fear?
I do not set my life at a pin's fee
And for my soul, what can it do to that,
Being a thing immortal as itself?
It waves me forth again. I'll follow it. (1.4.70-74)
And, in Scene 5 after his father's ghost asks that Hamlet avenge him, Hamlet is clearly determined,
...Now to my word:
It is 'Adieu, adieu. Remember me.'
I have sworn't it. (1.5.116-117)
However, by the end of this scene, after having made Horatio and Marcellus swear that they will not reveal what has transpired, nor explain any of his future behavior, Hamlet feels the weight of his new responsibility and bewails his task of being avenger,
...O cursed spite
That ever I was born to set it right!(1.5.209-210)
Thus begins Hamlet's mental anguish and his obsessive indirection as he begins to become less resolute, even to the point of doubting what meaning there is in existence.