• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

No "onMapReload" event? Need help with OnGameStart

Cybah

Emperor
Joined
Jun 22, 2007
Messages
1,481
This code is not loading when reloading the map. I've also tried onBeginGameTurn, onBeginPlayerTurn, ... (with iGameTurn < 1) but all of them are not called either when reloading the map - even without the "if iGameTurn".

Any ideas?

When reloading the map and playing with "no starting techs" no player shall have knowledge of the techs - like on game start.


Code:
	def onGameStart(self, argsList):
		'Called at the start of the game'

		if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START)):
			for iPlayer in range(gc.getMAX_PLAYERS()):
				player = gc.getPlayer(iPlayer)
				if (player.isAlive() and player.isHuman()):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
					popupInfo.setText(u"showDawnOfMan")
					popupInfo.addPopup(iPlayer)
		else:
			CyInterface().setSoundSelectionReady(true)

		if gc.getGame().isPbem():
			for iPlayer in range(gc.getMAX_PLAYERS()):
				player = gc.getPlayer(iPlayer)
				if (player.isAlive() and player.isHuman()):
					popupInfo = CyPopupInfo()
					popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_DETAILS)
					popupInfo.setOption1(true)
					popupInfo.addPopup(iPlayer)

## NO STARTING TECHS START ##

		if (gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR") and gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_STARTING_TECHS)):

			for iPlayerLoop in range(gc.getMAX_CIV_PLAYERS()):

				pPlayer = gc.getPlayer(iPlayerLoop)

				iPlayer = pPlayer.getID()

				if pPlayer.isAlive():

					iTech1 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_FISHING')
					iTech2 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_THE_WHEEL')
					iTech3 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_AGRICULTURE')
					iTech4 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_HUNTING')
					iTech5 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MYSTICISM')
					iTech6 = CvUtil.findInfoTypeNum(gc.getTechInfo,gc.getNumTechInfos(),'TECH_MINING')
					pTeam = gc.getTeam(pPlayer.getTeam())
					pTeam.setHasTech(iTech1, false, iPlayer, false, false)
					pTeam.setHasTech(iTech2, false, iPlayer, false, false)
					pTeam.setHasTech(iTech3, false, iPlayer, false, false)
					pTeam.setHasTech(iTech4, false, iPlayer, false, false)
					pTeam.setHasTech(iTech5, false, iPlayer, false, false)
					pTeam.setHasTech(iTech6, false, iPlayer, false, false)

## NO STARTING TECHS END ##
 
What exactly do you mean by reloading the map? Tell us what buttons/keys you press in game to make that happen.

If you mean loading a saved game, you want the OnLoad event. If you mean regenerating the map, you're SOL.
 
"Somewhat" out of luck. Not really "somewhat" but the forum doesn't allow certain words. Many mods recommend not using "regenerate map" for just this reason. It can give different funny results, depending on how much the mod relies on the game start event to do stuff.
 
Back
Top Bottom