How to give a technology to a player via Python?

rezaf

Warlord
Joined
Dec 3, 2003
Messages
179
Has anybody successfully done this and/or could tell me how to achieve it?
Thanks in advance. :goodjob:
_____
rezaf
 
Depends on where you want to do it.

Techs are a per-team thing - everyone on the same team has the same techs. You need to get the player's team object first which is done in most places by
Code:
iTeamID = gc.getPlayer(iPlayerID).getTeam()
pTeam = gc.getTeam(iTeamID)
With iPlayerID being the player ID that you want to give the tech to (obviously).

Once you have pTeam there's a function to award techs
Code:
pTeam.setHasTech(iTechID, bNewValue, iPlayer, bFirst, bAnnounce)
- iTechID is the tech number you want to give (defined by the order in XML).
- bNewValue I'm not sure about, you can probably pass in true and it'll be okay.
- iPlayer is the player who is getting the tech (iPlayerID in this case)
- bFirst is whether or not this team is the first to get the tech (for things like awarding religions and great people)
- bAnnounce I think is whether or not the fact that the team got the tech is announced to either that player/team or to everyone, I'm not sure which.
 
Thanks Trip, you're really doing that line in your signature justice. :cool:

I had already tried that method, but it seems I haven't entirely gotten the hang of the Python objects and stuff yet. Got it to work with your help.
Thanks again!
_____
rezaf
 
Back
Top Bottom