Although lying is a trait more associated with villains, even heroes can lie.
They only lie for trying to escape from a dangerous situation or for misleading a villain; lying can be just as good as it is bad.
Here's a few things why heroes had to lie:
About where they are.
Pretending who they really are.
That they're working with the villain since the beginning.
To protect the people they care about.
What they did wrong.
Here are the examples:
Swear to me that everything you said about the Fireflies was true
~ Ellie seeing through Joel's lies
No book is ever going to make my daughter sad. Time for me to do what I do best: lie to a child.
~ Homer, about Lisa's Angelica Button book.
"Rule number one- the Doctor lies."
~ River Song stating that even the Doctor lies sometimes.
(Oscar hides behind the dead shark Frankie) (Ernie: Oscar!) (Bernie: Did you kill that shark?) (Oscar looks down at Frankie, then comes up with an idea) Uh...yeah. Exactly how it looks; that's how it is.
~ Oscar lying that he killed a shark, making him become the famous Sharkslayer.