Indeed, he eventually learns to tell between ally and opponent. The NY battle of Age of Ultron is relevant in this respect. When the Hulk returns to the battlefield, Natasha Romanoff serves this line to Banner: “We could use a little worseâ€.
And then he turns and smashes the bilgesnipe. What does that mean? It means he discerns. The Hulk knows the side he’s on. Plus, he takes orders!
When Captain America assigns each Avenger’s role in the final fight, well, his task for the Green Goliath is “Hulk, smash!â€, remember?
Then, the final scene with all the Avengers menacing Loki in Stark’s tower: you remember how the Hulk doesn’t go crazy. Instead, he fits in. He does what the other do.
Three moments in Age of Ultron can also be cited. After Banner is tossed by the Black Widow into the rift, he turns and Natasha urges him: “Let’s finish the jobâ€. Which is exactly what they do. There’s also a scene then when the Hulk climbs up the rift carrying Natasha on his back.
Again, there’s one moral push from Natasha: “go be a heroâ€. And, of course, there is the final team fight, with all the Avengers surrounding and defending the core of Ultron’s device. The Hulk fights in line with his friends – “like the old men said: togetherâ€, in Cap’s words.
4. The Hulk speaks. Articulately

Yeah, from an alleged mindless beast, this might come as a surprise. But he does utter – rarely, in truth – occasional phrases.
