Giving a player a tech in a script?

Thalassicus

Bytes and Nibblers
Joined
Nov 9, 2005
Messages
11,057
Location
Texas
I'm trying to give a player a technology in a script, and have this so far:

Code:
ePlayer = gc.getPlayer(iPlayer)
eTeam = gc.getTeam(ePlayer.getTeam())
                
CyInterface().addMessage(iPlayer,True,25,'DebugA','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),0,0,False,False)
eTeam.setHasTech(TECH_ROBOTICS, True, ePlayer, False, False)
CyInterface().addMessage(iPlayer,True,25,'DebugB','AS2D_DISCOVERBONUS',1,'Art/Interface/Buttons/TerrainFeatures/Forest.dds',ColorTypes(8),0,0,False,False)
DebugA displays, DebugB does not, the tech is not recieved. This is the setHasTech function for the CyTeam class:

VOID setHasTech(TechType eIndex, BOOL bNewValue, PlayerType ePlayer, BOOL bFirst, BOOL bAnnounce)

Any idea what I'm doing wrong?
41.gif
 
I can't see anoything wrong off the top of my head.

Have you got python error messages switched on, as well as logging? I find them alot better for degugging than geting messages to display on the interface - they tell you what line the error is on, as well as usually giving you a hint as to what the error is.

From you're testing it would seem that the setHasTech is going wrong - maybe TECH_ROBOTICS has to be in quotation marks? I'm not sure.
 
Ah. The argument "PlayerType ePlayer" actually has to be the integer value. PlayerType is an integer corresponding to the player # in the game, cyPlayer is a player object. The ePlayer reference in the documention is rather confusing, you'd think it'd be iPlayer...oh well. :)
 
Back
Top Bottom