View Full Version : BTS: Anyone had luck with a civ-specific event?


Seidrik_The_Gray
Aug 08, 2007, 01:18 PM
I am dabbling with modding at the moment, trying to get the hang of the python call backs, etc...

I'm stumped as to how to properly make a python script for pythonCanDo that executes the event only when the civ is for example Greece.

def canDoBlahBlah(arslist):

iEvent = argsList[0]
kTriggeredData = argsList[1]

player = gc.getPlayer(kTriggeredData.ePlayer)

if player.getCiv() != Greek
return false

return true

This seems like the simplist way, but as my first piece of Python scripting, I'm sure I'm missing something here. The idea is to have the canDo return a true value if and only if the civ is the Greeks.

Did I do this right?

JeBuS27
Aug 08, 2007, 06:33 PM
Well, if I had to guess, I'd say getting the player's Civilization would look something like this:greek = CvUtil.findInfoTypeNum(gc.getCivilizationInfo,gc.g etNumCivilizationInfos(),'CIVILIZATION_GREECE')
civ = gc.getPlayer(kTriggeredData.ePlayer).getCivilizati onType()

if civ != greek:
return False
else:
return true

Assuming kTriggeredData.ePlayer gives you a player number, this should work. But I've never used any kTriggeredData before, so I couldn't tell you if that part is correct. Hope this helps.

Seidrik_The_Gray
Aug 09, 2007, 06:39 AM
That looks good...it even seems like it might account for the odd situation where a player might play Greece under a different civ name...but that's for another time. I'll try what you have presented here and report back. Thank you! If this works, then I will have the linch pin in an even I'm trying to run :)