americanslon
Chieftain
- Joined
- Apr 3, 2019
- Messages
- 14
Some code
local player = Players[playerId];
local unit = player:GetUnits():FindID(unitId);
local plot = Map:GetPlot(unit:GetX(), unit:GetY());
local city = Cities:GetCityInPlot(unit:GetX(), unit:GetY());
This code gets triggered OnUnitSelectionChanged. The unit is currently at a city but no matter what city related function I try the city is never detected.
I tried plot:isCity as well.
The code is in a file that is loaded as AddUserInterfaces with Context set as InGame (on a related note how many contexts are there and what are they?)
This is my first mod so forgive me if I am not even asking the question correctly.
Thank you!
local player = Players[playerId];
local unit = player:GetUnits():FindID(unitId);
local plot = Map:GetPlot(unit:GetX(), unit:GetY());
local city = Cities:GetCityInPlot(unit:GetX(), unit:GetY());
This code gets triggered OnUnitSelectionChanged. The unit is currently at a city but no matter what city related function I try the city is never detected.
I tried plot:isCity as well.
The code is in a file that is loaded as AddUserInterfaces with Context set as InGame (on a related note how many contexts are there and what are they?)
This is my first mod so forgive me if I am not even asking the question correctly.
Thank you!