Lplate Esus (Allegedly) Joined Feb 8, 2011 Messages 578 Location Ireland Jun 12, 2011 #1 Hi, If I have the integer ID of a Unit, what function do I use to get the plot that the Unit is on? thanks, LPlate
Hi, If I have the integer ID of a Unit, what function do I use to get the plot that the Unit is on? thanks, LPlate
Asaf Sleep Deprived Joined Mar 22, 2010 Messages 1,326 Jun 12, 2011 #2 Assuming you know the player id (since two units from different players can have the same ID), you can do it like this: Code: # ePlayer is the player ID # iUnit is the unit ID pPlayer = gc.getPlayer(ePlayer) pUnit = pPlayer.getUnit(iUnit) pPlot = pUnit.plot() pPlot is of type CyPlot, and you can get everything you need from it.
Assuming you know the player id (since two units from different players can have the same ID), you can do it like this: Code: # ePlayer is the player ID # iUnit is the unit ID pPlayer = gc.getPlayer(ePlayer) pUnit = pPlayer.getUnit(iUnit) pPlot = pUnit.plot() pPlot is of type CyPlot, and you can get everything you need from it.
Lplate Esus (Allegedly) Joined Feb 8, 2011 Messages 578 Location Ireland Jun 12, 2011 #3 Thanks Asaf, It's working now. I thought I might need to use the player id also. LPlate
Baldyr "Hit It" Joined Dec 5, 2009 Messages 5,530 Location Sweden Jun 12, 2011 #4 Player ID is the same as PlayerType, which is represented by the ePlayer value in this case.