.

Do you tested your code with the normal version ? Once, I had a problem because of a missing description in a MOD (Green MOD).
It return "" instead !

Tcho!
 
Don't count on pPlayer.getNumUnits, its an unstructured array. Meaning that it doesnt fill gaps and keep the order straight.

You may have:

Unit(0)
Unit(1)
Unit(2)
Unit(4)
Unit(5)
Unit(7)
Unit(43)

In this case getNumUnits returns 7 units, which is correct, but you cant count on them being unit 0, 1, 2, 3, 4, 5 and 6.

Instead use the PyPlayer wrapper as follows:

Code:
	py = PyPlayer(iPlayer)
	for pUnit in py.getUnitList():
		code stuff.....

To do this you have to have the following definition:

Code:
PyPlayer = PyHelpers.PyPlayer
 
Lord Olleus said:
Thanks Kael. I'll try that instead.
Why did they even include pPlayer.getNUmUnits() if its so useless?

pPlayer.getNumUnits() is still really helpful for telling the total amount of units but pPlayer.getUnit() is unreliable. I don't know why they did't structure that array. They do structure pPlot.getUnit().

I had the same problem as you for the longest time, units would just seem to "escape" and wouldn't be effected by any of my functions anymore. It drove me crazy until Trip pointed this out.
 
Back
Top Bottom