Point counter - how to give players points?

sab89

Chieftain
Joined
Mar 6, 2008
Messages
25
I am doing a capture the flagish mod. I've a 'flag' which spawns when a unit steps onto it and if the flag is returned to a target xy, the player earns a point (and a message pops up). When the player's 'points' count up to 10 they win.

You'll see, if the active player has the Flag Carrier unit on the target xy, they are told via pop up (easy enough to add 'points this way too).

What I can't figure out is how to determine which player is rewarded.

Code:
	def onBeginPlayerTurn(self, argsList):
		'Called at the beginning of a players turn'
		iGameTurn, iPlayer = argsList
		py = PyPlayer(iPlayer)
		iFC = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_FLAGCARRIER')
		pPlayer = gc.getPlayer(iPlayer)
		unitList = py.getUnitList()

		for iTest in unitList:
			iX = iTest.getX()
			iY = iTest.getY()
			if iTest.getUnitType() == iFC:
				if iX == 12 and iY == 33:
					self.addPopUp()

How can I write an if statement checking if it's player 0?

Here's what I've tried and hasn't worked:

Code:
		for iTest in unitList:
			iX = iTest.getX()
			iY = iTest.getY()
			if iTest.getUnitType() == iSC:
				if iPlayer == 0:
					if iX == 12 and iY == 33:
						self.addPopUp()

and

Code:
if gc.getPlayer(iPlayer) == 0:

help.
 
Back
Top Bottom