civ specific python code - why doesn't this code work?

sab89

Chieftain
Joined
Mar 6, 2008
Messages
25
Here's my code:

Code:
	def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		iGameTurn, iPlayer = argsList
		py = PyPlayer(iPlayer)
		pPlayer = gc.getPlayer(iPlayer)
		unitList = py.getUnitList()
		
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_J'):
			self.addPopup('You are playing Civ J!')
		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_F'):
			self.addPopup('You are playing Civ F!')

At the start of each turn BOTH messages appear. WHY!? :(
 
I changed it to:
Code:
		if gc.getActivePlayer().getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_J'):

This works, but displays 5 messages, instead of just one. :crazyeye:
 
What you want to do is add a check that sees if a player is human before it displays a pop-up.
 
Top Bottom