Unit.GetX (Civ5 API)

From Civilization Modding Wiki
Revision as of 19:07, 21 February 2014 by Slserpent (talk | contribs) (→‎Usage: wrong return type)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

This page is a part of the Lua and UI Reference (Civ5).


Function.png This function is a member of Unit.

This is an instance method, invoke it with a colon.


Usage

int Unit:GetX()


Returned Value

No description available.

Source code samples

Redundant occurences have been removed.

Bombardment.lua

UI/InGame/Bombardment.lua
0034
thisX = pHeadSelectedUnit:GetX();
0193
Events.SpawnArrowEvent( attacker:GetX(), attacker:GetY(), hexX, hexY );


EnemyUnitPanel.lua (G&K)

DLC/Expansion/UI/InGame/WorldView/EnemyUnitPanel.lua
0931
local plotDistance = Map.PlotDistance(pCapital:GetX(), pCapital:GetY(), pMyUnit:GetX(), pMyUnit:GetY());
1480
local plotDistance = Map.PlotDistance(pCapital:GetX(), pCapital:GetY(), pTheirUnit:GetX(), pTheirUnit:GetY());
1821
local plotDistance = Map.PlotDistance(pCapital:GetX(), pCapital:GetY(), theirUnit:GetX(), theirUnit:GetY());


InGame.lua

UI/InGame/InGame.lua
0422
local hexID = ToHexFromGrid( Vector2( unit:GetX(), unit:GetY() ) );
0450
local unitX = unit:GetX();
0544
local thisX = pHeadSelectedUnit:GetX();
0999
Events.RequestYieldDisplay( YieldDisplayTypes.AREA, 2, unit:GetX(), unit:GetY() );


TurnsRemaining.lua - DLC_02 DLC

DLC/DLC_02/Scenarios/NewWorldScenario/TurnsRemaining.lua
0538
if (pUnit:GetX() > 9) then
0556
iDistance = Map.PlotDistance(1, iY, pUnit:GetX(), pUnit:GetY());


TurnsRemaining.lua - DLC_04 DLC

DLC/DLC_04/Scenarios/1066Scenario/TurnsRemaining.lua
0200
iX = unit:GetX();


UnitFlagManager.lua

UI/InGame/UnitFlagManager.lua
0242
local worldPosX, worldPosY, worldPosZ = GridToWorld( pUnit:GetX(), pUnit:GetY() );
1409
local plot = Map.GetPlot( unit:GetX(), unit:GetY() );


UnitPanel.lua

UI/InGame/WorldView/UnitPanel.lua
0744
x = unit and unit:GetX() or 0,



The initial version of this page was created by the Civ5 API Bot, see the Civ5 API Reference FAQ. Some of the texts come from the 2kgames' wiki and most of code samples are copyrighted to Firaxis.
Functions' signatures were either copied from the 2kgames' wiki, or infered from the Lua source files and the binaries. Errors are possible.
Contributors may find help in the Contributors guide to the Civ5 API.