jkp1187
Unindicted Co-Conspirator
Okay, this is for a NextWar random event. When the event is fired, I want Barbarians to spawn inside the player's territory (as this is happening late in the game, there probably won't be many unsettled squares). I'm having trouble getting the event to work at all, so I thought I'd post what I have here and see what you guys thought. Yes, as far as I can tell, all of the event criteria are met.
This is the script that determines whether or not the event will fire. There are no other prerequisites.
What am I doing wrong (other than not going to sleep yet)?
This is the script that determines whether or not the event will fire. There are no other prerequisites.
Code:
def canTriggerNWTheCylons(argsList):
kTriggeredData = argsList[0]
pPlayer = 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 TECH_CYBERNETICS.
bFoundValid = false
iTech = CvUtil.findInfoTypeNum(gc.getTechInfo, gc.getNumTechInfos(), 'TECH_CYBERNETICS')
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() == pPlayer and not plot.isWater() and not plot.isImpassable()):
return true
return false
What am I doing wrong (other than not going to sleep yet)?