Python help Event to place units on a certain date.

The Great Apple said:
Hmmm. Good question.

You'd probably have to iterate through all the player's to find the one with the right Civ:
Code:
iCivPlayer = -1

for i in range(gc.getMAX_CIV_PLAYERS()):
	if gc.getPlayer(i).getCivilizationType() == gc.getInfoTypeForString("<Insert civ name>"):
		iCivPlayer = i
		break

I would think that if you're trying to figure out how to get a players id, there would be some sort of reference (either a city, unit, plot, etc.) that you are drawing from. Isn't it possible to have multiple players be the same civ type?
 
Okay, I am confused. I thought that line

if iPlayer == 0:

was asking if the player taking the turn is player 0, ie the human player.

I want, on my (the human players) turn, for one of the AI civ's units to show up on a plot. So I want the code to ask

If is the human players turn, and if there turn is X, then have 3 AI units created on a plot
 
wotan321 said:
Okay, I am confused. I thought that line

if iPlayer == 0:

was asking if the player taking the turn is player 0, ie the human player.

I want, on my (the human players) turn, for one of the AI civ's units to show up on a plot. So I want the code to ask

If is the human players turn, and if there turn is X, then have 3 AI units created on a plot
Is it really necessary that the AI unit must show up on the human player's turn rather than the AI player's turn? Doesn't seem like it would really make much of a difference.


@TGA
Talking about what? I swear, sometimes my eyes play tricks on me ;)
 
Gerikes said:
I would think that if you're trying to figure out how to get a players id, there would be some sort of reference (either a city, unit, plot, etc.) that you are drawing from. Isn't it possible to have multiple players be the same civ type?
True. Some referance would be better. You could always check other stuff such as the leaderheard.

@wotan321
Oh right. In that case replace iPlayer in that line with the player ID of the player you want to spawn the thing of.
 
In that case replace iPlayer in that line with the player ID of the player you want to spawn the thing of.

Excellent suggestion.... how would I express that in code? Instead of iPlayer, I would put in there..... what? How do I identify the players?
 
A number. If you slot the code I put above in, assuming you only have one player per Civ, it should find the right player and iCivPlayer will be assigned to that player.

If you have more then one player for Civ then it would need some tinkering - I'd need to know what is unique about each player.
 
Back
Top Bottom