There will always be some amount of luck, some amount of chance and randomness in any story. This is how it is in real life as well, and although stories are not a representation of reality, they do build on it.
So, there's this part in my book that I fear might be a deus ex machina, because it is very significant and provides a solution to a conflict, yet has a great element of luck involved. Here it goes:
The MC is badly wounded by a gang of violent gold miners. It is established beforehand that these gold miners acquired their land through a massacre of Native Americans camping there. These native Americans are nomadic, yet they happened to be camping at that spot for a little while and didn't really like the fact that these savage men came into their lands and started digging for gold. These men didn't quite enjoy the natives camping out there either, and so a conflict ensued, where most of the native Americans were killed. This is all established in one or two lines of dialogue concerning the boss of that gang, masquerading as primarily being character establishment for the boss, when in reality, its main purpose is to inform the reader about natives. Their nomadic nature (which is kind of important) is not mentioned, though, but that is implicit in the fact that they are Comanche.
So, the MC survives this beat down, and recovers, only to wander the wilderness completely lost. This is around the Texas-Colorado border, so the wilderness he is lost in is mountainous forest area. Eventually, he makes it out of the forest and nears Texas again, returning to the Great Plains. He does this because he figures it will be easier to spot people on the Plains than in the desolate woods. And spot people he does. He is attacked by a rather hostile native. When the native approaches him to finish the job, they see the MC's dire state and how, clearly, the MC is not a threat, despite their white skin and white clothes. The native's hostility is based on the MC's skin is a clue, although being a bit common considering that many other natives were also mistreated by white settlers.
The native treats the MC's wounds and helps them back on their feet. They do this not only to right the wrong they did but also because the native senses a connection between them and the MC. This is the second clue. The native seems quite depressed and gloomy, which is the third clue. Eventually, through conversation, they find out they have been wronged by the same man and gang, the native being the only one alive from his tribe. The native also finds out their daughter is a captive in the gold miner's camp, instead of being dead, like he thought. That is when they set out to take him out and rescue the daughter, which they succeed in. Now, you might think, the MC gaining one friend to help him out on this endeavor isn't that significant. Though, I am not sure if I'll go with exactly this narrative. I might go with a narrative where there are multiple natives left, who take the MC in. When the MC then reveals he was wronged by the same man as they were, and that the chieftain's daughter is living as a captive in their camp, then they all set out to take the camp out. In this alternative, the MC is even luckier.
Yet, could one say he is even that lucky? I mean, this is all happening in the same general location. The tribe in question is a nomadic one, meaning they move around in the location, which increases the likelihood the MC would eventually stumble over them. So, does this seem like a "deus ex machina" to you guys? How can one distinguish from a reasonable amount of luck, and a "deus ex machina" amount of luck? Does one simply have to experience the narrative objectively, to feel whether it feels contrived or not?