how to: "if pPlayer has had contact to all other civilizations"

Cybah

Emperor
Joined
Jun 22, 2007
Messages
1,481
I need ya help. How can I check if a player has already met all other players?
 
Loop though all the players skipping yourself and check to see if you've made contact. Are you wanting to do this in python or the SDK?
 
This is stored on the team, not the player. So for your player, get your team. You may want to see if getHasMetCivCount directly returns the number you want, that is, your work is simple if this value == (number of teams - 1). Otherwise you need to loop each other team and call isHasMet.
 
TeamID# is retained for dead civs, so you'd also need to ensure you're only counting civs that are alive.
 
thanks so far. :) will report if I need additional help.

edit: hum that gets more complicated.
 
OK I need additional help. I need the code for this:

PHP:
	iTeam = pPlayer.getTeam()
	pTeam = gc.getTeam(iTeam)
	l_rivalUU = []
	for iPlayer in range(gc.getMAX_PLAYERS()):
		ppPlayer = gc.getPlayer(iPlayer)
		if ( (ppPlayer.isAlive()==true) and (ppPlayer.isBarbarian()==false) ):
			if (ppPlayer.getTeam() != pPlayer.getTeam()):
				if ( gc.getTeam(ppPlayer.getTeam()).isVassal(iTeam) == false ):
					civ_type = gc.getPlayer(iPlayer).getCivilizationType()
					for iUnit in range(gc.getNumUnitClassInfos()):
						iUniqueUnit = gc.getCivilizationInfo(civ_type).getCivilizationUnits(iUnit);
						iDefaultUnit = gc.getUnitClassInfo(iUnit).getDefaultUnitIndex();
						if (iDefaultUnit > -1 and iUniqueUnit > -1 and iDefaultUnit != iUniqueUnit):
							if ( iUnitType == iDefaultUnit ):
												l_rivalUU.append(iUniqueUnit)
	if ( len(l_rivalUU) >= 1 ):
		self.iRivalUUChance = self.getRandomNumber( 3 )
		if self.iRivalUUChance == 0:
			chance = CyGame().getSorenRandNum(len(l_rivalUU), "Random for UU")
			iX = pUnit.getX()
			iY = pUnit.getY()
			pNewUnit = pPlayer.initUnit( l_rivalUU[chance], iX, iY, UnitAITypes.NO_UNITAI, DirectionTypes.NO_DIRECTION )
			pNewUnit.convert(pUnit)

this code counts all unique units of rival players and let pplayer build one of those units at a chance of 25% instead of the own unit.

the reason why I opened this thread was: I want, that this player will only be able to 'build' other unique units of players he already met.

how can I append only those unique units from civs he already met?

what about this? is this correct?

PHP:
if ( (gc.getTeam(ppPlayer.getTeam()).isHasMet(iTeam)) and (ppPlayer.isAlive()==true) and (ppPlayer.isBarbarian()==false) ):
 
Top Bottom