I need some python...

Put this code in the onBeginGameTurn event (CvEventManager.py):
Code:
		for i in range(CyMap().numPlots()):
			pPlot = CyMap().plotByIndex(i)
			if pPlot.getTeam() >= 0 and pPlot.getBonusType(-1) < 0:
				impType = pPlot.getImprovementType()
				[i]if impType is gc.getInfoTypeForString("[b]IMPROVEMENT_FARM[/b]"):
					iBonus = gc.getInfoTypeForString("[b]BONUS_CORN[/b]")
					if gc.getTeam(pPlot.getTeam()).isHasTech(gc.getBonusInfo(iBonus).getTechReveal()):
						if CyGame().getSorenRandNum([b]1000[/b], "Placing Bonus") == 0:
							pPlot.setBonusType(iBonus)
							pCity = CyMap().findCity(pPlot.getX(), pPlot.getY(), pPlot.getOwner(), pPlot.getTeam(), False, False, -1, -1, CyCity())
							CyInterface().addMessage(pPlot.getOwner(), False, gc.getDefineINT("EVENT_MESSAGE_TIME"), '[u]Corn has been discovered near &#37;s[/u]' %(pCity.getName()), "AS2D_DISCOVERBONUS", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getBonusInfo(iBonus).getButton(), gc.getInfoTypeForString("COLOR_WHITE"), pPlot.getX(), pPlot.getY(), True, True)[/i]
Duplicate the italic code to add other improvements that give resources. Any bold text can be changed to any value you want. The bold 1000 is the chance that the resources is placed, if set to 1000 there is a 1 in a 1000 chance of it being placed (it happens:thumbsup:). Now in the message (I have it underlined) you will notice a %s this tells civ to display the name of the nearest city (only because I have told it that that %s means that, so don't start putting %s everywhere expecting the name of the nearest city).

Wow, my 800th post!!!!!! :party:
 
Try this:
Code:
        for i in range(CyMap().numPlots()):
            pPlot = CyMap().plotByIndex(i)
            if pPlot.getTeam() >= 0 and pPlot.getBonusType(-1) < 0:
                impType = pPlot.getImprovementType()
                [I]if impType is gc.getInfoTypeForString("[B]IMPROVEMENT_FARM[/B]"):
                    iBonus = gc.getInfoTypeForString("[B]BONUS_CORN[/B]")
                    if gc.getTeam(pPlot.getTeam()).isHasTech(gc.getBonusInfo(iBonus).getTechReveal()):
                        if CyGame().getSorenRandNum([B]1000[/B], "Placing Bonus") == 0 and gc.getPlayer(pPlot.getOwner()).getNumAvailableBonuses(gc.getInfoTypeForString("[B]BONUS_CORN[/B]")) > 0[/I][I]:
                            pPlot.setBonusType(iBonus)
                            pCity = CyMap().findCity(pPlot.getX(), pPlot.getY(), pPlot.getOwner(), pPlot.getTeam(), False, False, -1, -1, CyCity())
                            CyInterface().addMessage(pPlot.getOwner(), False, gc.getDefineINT("EVENT_MESSAGE_TIME"), '[U]Corn has been discovered near &#37;s[/U]' %(pCity.getName()), "AS2D_DISCOVERBONUS", InterfaceMessageTypes.MESSAGE_TYPE_MINOR_EVENT, gc.getBonusInfo(iBonus).getButton(), gc.getInfoTypeForString("COLOR_WHITE"), pPlot.getX(), pPlot.getY(), True, True)[/I]
 
Back
Top Bottom