How exactly do I do that?![]()
When you click to download it gives two options: Open With and Save to Disk.
Save to disk.
How exactly do I do that?![]()
Hi tsentom1,
I am having trouble getting the King Richard's Crusade wonder to work. I have added the Crusade Unit and the Python code to CvEventManager.py. However, the event just never seems to fire. I don't see anything in the logs and the Crusader unit never gets created. Any hints on how I might be mucking this up?
Cheers,
ripple01
I'll have you know, tsentom1, that the rush for the School of Confucius in my game has become a tactic on the level of the Liberalism race, Oracle, the Great Library, and the Pyramids.
And it's not because I think it is a broken wonder. Without a double production resource, you have to invest a significant amount of time to build it. It's just such a cool effect, and it comes at a reasonable tradeoff, like the Pyramids.
So, I'm posting another thanks for the wonder. You have an eye for filling in the gaps and adding content without making it overbearing.
Tom, as always great work.
I tried out the code for the trafalger square (I was looking to incorproate the Comendeer code for one of the "Heros"). Anyway, the message that tells you, you captured a ship fires whether you capture one or not.
Tom, as always great work.
I tried out the code for the trafalger square (I was looking to incorproate the Comendeer code for one of the "Heros"). Anyway, the message that tells you, you captured a ship fires whether you capture one or not.
self.iNewPrivateerNumber = self.getRandomNumber( 4 )
if self.iNewPrivateerNumber == 0:
iPrivateer = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_PRIVATEER')
pClearPlot = self.findClearPlot(pLoser)
if (pLoser.plot().getNumUnits() == 1 and pClearPlot != -1):
pPlot = pLoser.plot()
pLoser.setXY(pClearPlot.getX(), pClearPlot.getY(), false, true, true)
else:
pPlot = pWinner.plot()
newUnit = pPlayer.initUnit(iPrivateer, pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
pLoser.setDamage(75, False)
newUnit.convert(pLoser)
pLoser.setDamage(100, False)
newUnit.finishMoves()
iXa = pLoser.getX()
iYa = pLoser.getY()
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_CAPTURE_SUCCESS",()),'',0,',Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,11',ColorTypes(44), iXa, iYa, True,True)
if self.iNewPrivateerNumber == 0:
iPrivateer = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_PRIVATEER')
pClearPlot = self.findClearPlot(pLoser)
if (pLoser.plot().getNumUnits() == 1 and pClearPlot != -1):
pPlot = pLoser.plot()
pLoser.setXY(pClearPlot.getX(), pClearPlot.getY(), false, true, true)
else:
pPlot = pWinner.plot()
newUnit = pPlayer.initUnit(iPrivateer, pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
pLoser.setDamage(75, False)
newUnit.convert(pLoser)
pLoser.setDamage(100, False)
newUnit.finishMoves()
[B]
iXa = pLoser.getX()
iYa = pLoser.getY()
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_CAPTURE_SUCCESS",()),'',0,',Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,11',ColorTypes(44), iXa, iYa, True,True)[/B]
Tom, as always great work.
I tried out the code for the trafalger square (I was looking to incorproate the Comendeer code for one of the "Heros"). Anyway, the message that tells you, you captured a ship fires whether you capture one or not.
iPrivateer = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_PRIVATEER')
pClearPlot = self.findClearPlot(pLoser)
iPrivateer = pLoser.getUnitType()
pClearPlot = self.findClearPlot(pLoser)
Thanks for the heads up. I have been expirimenting with Python since I came back from my Civ Sabatical.
My biggest issure right now is removing the building requirement. Ideally I would like: If Owner has Unit A, you get Unit B 20% chance.
Basically the same thing as the wonder only its unit specific instead of building specific.
def onCombatResult(self, argsList):
'Combat Result'
pWinner,pLoser = argsList
playerX = PyPlayer(pWinner.getOwner())
unitX = PyInfo.UnitInfo(pWinner.getUnitType())
playerY = PyPlayer(pLoser.getOwner())
unitY = PyInfo.UnitInfo(pLoser.getUnitType())
## Privateer Edit Start ##
if pWinner.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_PRIVATEER'):
pPlayer = gc.getPlayer(pWinner.getOwner())
[B]iGold = playerY.getGold( )
iGoldStolen = ( iGold//50 )
message = 0
if playerY.getGold( ) >= 2500:
playerY.changeGold( -50 )
elif playerY.getGold( ) >= 100:
playerY.changeGold( -iGoldStolen )
elif (playerY.getGold( ) >= 2) and (playerY.getGold( ) < 100):
playerY.changeGold( -2 )
iGold2 = playerX.getGold( )
if playerY.getGold( ) >= 2500:
playerX.changeGold( +50 )
message = 1
elif playerY.getGold( ) >= 100:
playerX.changeGold( +iGoldStolen )
message = 2
else:
playerX.changeGold( +2 )
message = 3
[/B]
pPID = pPlayer.getID()
[B] iX = pWinner.getX()
iY = pWinner.getY()
szName = pPlayer.getName()[/B]
[B] ## This only controls the text, all actual gold amounts are done above:
iGoldStolenMax = ( 2500//50 )
iGoldStolenMin = ( 100//50 )
if ( message == 1 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_GOLD1",(szName,iGoldStolenMax)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###
if ( message == 2 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_GOLD2",(szName,iGoldStolen)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###
if ( message == 3 ):
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_GOLD3",(szName,iGoldStolenMin)),'',0,',Art/Interface/Buttons/TechTree/Banking.dds,Art/Interface/Buttons/TechTree_Atlas.dds,8,1',ColorTypes(44), iX, iY, True,True)
### message: %s1 has plundered %d2 [ICON_GOLD]!###[/B]
self.iNewPrivateerNumber = self.getRandomNumber( 9 )
if self.iNewPrivateerNumber == 0:
iPrivateer = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_PRIVATEER')
pClearPlot = self.findClearPlot(pLoser)
if (pLoser.plot().getNumUnits() == 1 and pClearPlot != -1):
pPlot = pLoser.plot()
pLoser.setXY(pClearPlot.getX(), pClearPlot.getY(), false, true, true)
else:
pPlot = pWinner.plot()
newUnit = pPlayer.initUnit(iPrivateer, pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
pLoser.setDamage(75, False)
newUnit.convert(pLoser)
pLoser.setDamage(100, False)
newUnit.finishMoves()
iXa = pLoser.getX()
iYa = pLoser.getY()
CyInterface().addMessage(pPID,false,15,CyTranslator().getText("TXT_KEY_TRAFALGAR_CAPTURE_SUCCESS",()),'',0,',Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,8,11',ColorTypes(44), iXa, iYa, True,True)
## Privateer Edit End ##
if (not self.__LOG_COMBAT):
return
if playerX and playerX and unitX and playerY:
CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s'
%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(),
playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))
## Privateer Edit Start ##
def findClearPlot(self, pUnit):
BestPlot = -1
iBestPlot = 0
pOldPlot = pUnit.plot()
iX = pOldPlot.getX()
iY = pOldPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
iCurrentPlot = 0
pPlot = CyMap().plot(iiX,iiY)
if pPlot.getNumUnits() == 0:
iCurrentPlot = iCurrentPlot + 5
if iCurrentPlot >= 1:
iCurrentPlot = iCurrentPlot + CyGame().getSorenRandNum(5, "findClearPlot")
if iCurrentPlot >= iBestPlot:
BestPlot = pPlot
iBestPlot = iCurrentPlot
return BestPlot
def getRandomNumber(self, int):
return CyGame().getSorenRandNum(int, "Gods")
## Privateer Edit End ##
<TEXT>
<Tag>TXT_KEY_TRAFALGAR_GOLD1</Tag>
<English>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</English>
<French>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</French>
<German>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</German>
<Italian>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Italian>
<Spanish>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TRAFALGAR_GOLD2</Tag>
<English>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</English>
<French>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</French>
<German>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</German>
<Italian>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Italian>
<Spanish>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TRAFALGAR_GOLD3</Tag>
<English>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</English>
<French>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</French>
<German>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</German>
<Italian>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Italian>
<Spanish>[COLOR_SELECTED_TEXT]%s1 has plundered %d2 [ICON_GOLD]![COLOR_REVERT]</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_TRAFALGAR_CAPTURE_SUCCESS</Tag>
<English>[COLOR_SELECTED_TEXT]You have captured an enemy vessel![COLOR_REVERT]</English>
<French>[COLOR_SELECTED_TEXT]You have captured an enemy vessel![COLOR_REVERT]</French>
<German>[COLOR_SELECTED_TEXT]You have captured an enemy vessel![COLOR_REVERT]</German>
<Italian>[COLOR_SELECTED_TEXT]You have captured an enemy vessel![COLOR_REVERT]</Italian>
<Spanish>[COLOR_SELECTED_TEXT]You have captured an enemy vessel![COLOR_REVERT]</Spanish>
</TEXT>
if pWinner.getUnitClassType() == gc.getInfoTypeForString('UNITCLASS_PRIVATEER'):
Hey tsentom1,
Lets say one wanted to implement a handful of these mods into the base game. Have you posted any instructions on how to do so?
I'm assuming its really a matter of cruching out all the merges in all the files that come with each zipped wonder, right?