Ewok-Bacon-Bits
Warlord
- Joined
- Oct 23, 2016
- Messages
- 169
Hey, I'm not sure if anyone has any clue but I would just like to post this as possibly a warning that this could be broken or maybe I'm missing something but pPlayer:GetDistricts() is always nil. I can confirm that pPlayer:GetCities() is working as well as the for city loop.
I got the code "pPlayer:GetDistricts()" from the city banner/Report UI code so I know that it has to at least be used. If this is broken it seems it could be problematic as we cannot loop through districts. Am I missing something?? I should also say I also tried pCity:GetDistricts() which also failed. Here is the code it is the 8th line having the error:
On a more positive note there seems to be tooons of events including for combat which I am very excited about!
I got the code "pPlayer:GetDistricts()" from the city banner/Report UI code so I know that it has to at least be used. If this is broken it seems it could be problematic as we cannot loop through districts. Am I missing something?? I should also say I also tried pCity:GetDistricts() which also failed. Here is the code it is the 8th line having the error:
Code:
function OnPlayerTurnActivated(player, isFirstTimeThisTurn)
-- PlayerTurnActivated is post DoTurn processing for the beginning of the turn.
-- Loop Through all of this player's cities if they are under siege subract health (if human do this more depending on difficulty)
local pPlayer = Players[player]; -- WORKS
if (pPlayer ~= nil) then -- WORKS
local pCities = pPlayer:GetCities(); -- WORKS
local playerDistricts = Players[player]:GetDistricts(); -- ERROR HERE
for i, pCity in pCities:Members() do -- WORKS
print("**************LOOPING THROUGH CITIES**************"); -- WORKS
end
end
-- if (isFirstTimeThisTurn and Game.GetLocalPlayer() == player) then
-- end
end
function Initialize()
Events.PlayerTurnActivated.Add( OnPlayerTurnActivated);
end
Initialize();
On a more positive note there seems to be tooons of events including for combat which I am very excited about!
Last edited: