The MunchKING
Chieftain
- Joined
- Jul 8, 2008
- Messages
- 17
Alright I looked over the code in Notepad + +. What am I supposed to be seeing?
Here's the code. I basically took the other Barbarian SPawn code, and tried to make it work for my pirates. All I did was took out the bit about the counter units and changed the requirements around.
######## THE_PIRATE_LORDS ###########
def canTriggerThePirates(argsList):
kTriggeredData = argsList[0]
player = gc.getPlayer(kTriggeredData.ePlayer)
# If Barbarians are disabled in this game, this event will not occur.
if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_BARBARIANS):
return false
# At least one civ on the board must know Chemistry.
bFoundValid = false
iTech = CvUtil.findInfoTypeNum(gc.getTechInfo, gc.getNumTechInfos(), 'TECH_CHEMISTRY')
for iPlayer in range(gc.getMAX_CIV_PLAYERS()):
loopPlayer = gc.getPlayer(iPlayer)
if loopPlayer.isAlive():
if gc.getTeam(loopPlayer.getTeam()).isHasTech(iTech):
bFoundValid = true
break
if not bFoundValid:
return false
# At least one civ on the board must know Astronomy.
bFoundValid = false
iTech = CvUtil.findInfoTypeNum(gc.getTechInfo, gc.getNumTechInfos(), 'TECH_ASTRONOMY')
for iPlayer in range(gc.getMAX_CIV_PLAYERS()):
loopPlayer = gc.getPlayer(iPlayer)
if loopPlayer.isAlive():
if gc.getTeam(loopPlayer.getTeam()).isHasTech(iTech):
bFoundValid = true
break
if not bFoundValid:
return false
# Find an eligible plot
map = gc.getMap()
for i in range(map.numPlots()):
plot = map.plotByIndex(i)
if (plot.getOwner() == -1 and plot.isWater() and not plot.isImpassable() and plot.area().getCitiesPerPlayer(kTriggeredData.ePlayer) > 0 and plot.isAdjacentPlayer(kTriggeredData.ePlayer, true)):
return true
return false
def getHelpThePirates1(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
szHelp = localText.getText("TXT_KEY_EVENT_THE_PIRATE_LORDS_HELP_1", ())
return szHelp
def applyThePirates1(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
player = gc.getPlayer(kTriggeredData.ePlayer)
listPlots = []
map = gc.getMap()
for i in range(map.numPlots()):
plot = map.plotByIndex(i)
if (plot.getOwner() == -1 and plot.isWater() and not plot.isImpassable() and plot.area().getCitiesPerPlayer(kTriggeredData.ePlayer) > 0 and plot.isAdjacentPlayer(kTriggeredData.ePlayer, true)):
listPlots.append(i)
if 0 == len(listPlots):
return
plot = map.plotByIndex(listPlots[gc.getGame().getSorenRandNum(len(listPlots), "Pirate event location")])
if map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_DUEL'):
iNumUnits = 2
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_TINY'):
iNumUnits = 3
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_SMALL'):
iNumUnits = 4
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_STANDARD'):
iNumUnits = 5
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_LARGE'):
iNumUnits = 6
else:
iNumUnits = 8
iUnitType = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), 'UNIT_DREAD_PIRATE')
barbPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())
for i in range(iNumUnits):
barbPlayer.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.UNITAI_PIRATE_SEA, DirectionTypes.DIRECTION_SOUTH)
Here's the code. I basically took the other Barbarian SPawn code, and tried to make it work for my pirates. All I did was took out the bit about the counter units and changed the requirements around.
Spoiler :
######## THE_PIRATE_LORDS ###########
def canTriggerThePirates(argsList):
kTriggeredData = argsList[0]
player = gc.getPlayer(kTriggeredData.ePlayer)
# If Barbarians are disabled in this game, this event will not occur.
if gc.getGame().isOption(GameOptionTypes.GAMEOPTION_NO_BARBARIANS):
return false
# At least one civ on the board must know Chemistry.
bFoundValid = false
iTech = CvUtil.findInfoTypeNum(gc.getTechInfo, gc.getNumTechInfos(), 'TECH_CHEMISTRY')
for iPlayer in range(gc.getMAX_CIV_PLAYERS()):
loopPlayer = gc.getPlayer(iPlayer)
if loopPlayer.isAlive():
if gc.getTeam(loopPlayer.getTeam()).isHasTech(iTech):
bFoundValid = true
break
if not bFoundValid:
return false
# At least one civ on the board must know Astronomy.
bFoundValid = false
iTech = CvUtil.findInfoTypeNum(gc.getTechInfo, gc.getNumTechInfos(), 'TECH_ASTRONOMY')
for iPlayer in range(gc.getMAX_CIV_PLAYERS()):
loopPlayer = gc.getPlayer(iPlayer)
if loopPlayer.isAlive():
if gc.getTeam(loopPlayer.getTeam()).isHasTech(iTech):
bFoundValid = true
break
if not bFoundValid:
return false
# Find an eligible plot
map = gc.getMap()
for i in range(map.numPlots()):
plot = map.plotByIndex(i)
if (plot.getOwner() == -1 and plot.isWater() and not plot.isImpassable() and plot.area().getCitiesPerPlayer(kTriggeredData.ePlayer) > 0 and plot.isAdjacentPlayer(kTriggeredData.ePlayer, true)):
return true
return false
Spoiler :
def getHelpThePirates1(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
szHelp = localText.getText("TXT_KEY_EVENT_THE_PIRATE_LORDS_HELP_1", ())
return szHelp
Spoiler :
def applyThePirates1(argsList):
iEvent = argsList[0]
kTriggeredData = argsList[1]
player = gc.getPlayer(kTriggeredData.ePlayer)
listPlots = []
map = gc.getMap()
for i in range(map.numPlots()):
plot = map.plotByIndex(i)
if (plot.getOwner() == -1 and plot.isWater() and not plot.isImpassable() and plot.area().getCitiesPerPlayer(kTriggeredData.ePlayer) > 0 and plot.isAdjacentPlayer(kTriggeredData.ePlayer, true)):
listPlots.append(i)
if 0 == len(listPlots):
return
plot = map.plotByIndex(listPlots[gc.getGame().getSorenRandNum(len(listPlots), "Pirate event location")])
if map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_DUEL'):
iNumUnits = 2
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_TINY'):
iNumUnits = 3
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_SMALL'):
iNumUnits = 4
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_STANDARD'):
iNumUnits = 5
elif map.getWorldSize() == CvUtil.findInfoTypeNum(gc.getWorldInfo, gc.getNumWorldInfos(), 'WORLDSIZE_LARGE'):
iNumUnits = 6
else:
iNumUnits = 8
iUnitType = CvUtil.findInfoTypeNum(gc.getUnitInfo, gc.getNumUnitInfos(), 'UNIT_DREAD_PIRATE')
barbPlayer = gc.getPlayer(gc.getBARBARIAN_PLAYER())
for i in range(iNumUnits):
barbPlayer.initUnit(iUnitType, plot.getX(), plot.getY(), UnitAITypes.UNITAI_PIRATE_SEA, DirectionTypes.DIRECTION_SOUTH)