View Full Version : Python question


cotdamn
Apr 25, 2007, 12:31 AM
Hi,

Can anyone post a python code snippet for the following:

Any player X, builds building Y, and gets specific free tech Z, only once.

I need this for Imperialism Mod, and if I am going to release it by the end of the month I could use some help with this, as I am bogged down with the XML stuff.

Of course you will be credited for your help.

thanks,
cotdamn

Kael
Apr 26, 2007, 04:56 PM
Something like onBuildingBuilt(self, argsList):


if iBuildingType == gc.getInfoTypeForString('BUILDING_WHATEVER'):
pPlayer = gc.getPlayer(player)
iTech = gc.getInfoTypeForString('TECH_WHATEVER')
eTeam = gc.getTeam(pPlayer.getTeam())
if eTeam.isHasTech(iTech) == False:
eTeam.setHasTech(iTech, True, player, False, True)

cotdamn
Apr 26, 2007, 10:52 PM
thanks Kael :goodjob: