Geekob
Chieftain
- Joined
- Apr 30, 2017
- Messages
- 20
Hi guys,
I have a small problem. Im making outpost mode where forts get adjacent territory. I added feature where if fort is pillaged or removed and its territory is not directly connected to any city, it will lose it. But I have problem with visibility. It removes owner, but area keeps visible. I tried to use RevealAll and then UnrevealAll in case there is some update problem or something, but it keeps visible even after that. Only when someone builds city in that area it gets removed. I tried to look for some functions or events that handle this but I found only some get functions and UI functions responsible for Icon/panel visibility or something. Does anyone have experience with this problem? I would be thankful for any responses.
This is code im using for that operation
I have a small problem. Im making outpost mode where forts get adjacent territory. I added feature where if fort is pillaged or removed and its territory is not directly connected to any city, it will lose it. But I have problem with visibility. It removes owner, but area keeps visible. I tried to use RevealAll and then UnrevealAll in case there is some update problem or something, but it keeps visible even after that. Only when someone builds city in that area it gets removed. I tried to look for some functions or events that handle this but I found only some get functions and UI functions responsible for Icon/panel visibility or something. Does anyone have experience with this problem? I would be thankful for any responses.
Spoiler active improvement :
Spoiler pillaged improvement :
This is code im using for that operation
Code:
function OnImprovementChanged(locationX, locationY, improvementType, improvementOwner, resource, isPillaged, isWorked)
local plot = Map.GetPlot(locationX, locationY);
local adjacentPlots = GetPlotsNotNearCity(plot);
if (adjacentPlots ~= nil) then
for _,plt in ipairs(adjacentPlots) do
plt:SetOwner(-1);
end
end
end