hey guys,
I'm newbe at LUA Programming and trying since weeks a small Lua Mod to get running correctly.
The idea is that Cities get with Puppet Status a Blue CityBanner and a Blue CityBorder.
Cities with Resistance Status get a Red CityBanner and a Red CityBorder.
The city limits are also visible to the state borders. I have created HexHighligts for it.
Here is a picture for that:
[/URL][/IMG]
The problem is that when changes the City Status from ''isPuppet'' or ''isResistance'' to ''normal'' City Status the CityBannerColor changes correctly
back. But the CityBorders not disappear.
If the CityStatus changes from ''normal'' to ''isPuppet'' or ''isResistance'' the CityBannerColor not changes correctly. But the CityBorders become
visible correctly.
Only after reload the Game i see all changes correctly.
Here is my Code i added it in the ''local function RefreshCityBannersNow()'' Function at CityBannerManager.lua - (6a)CBP - Compatibility Files (EUI)
The HexHiglights and Banner Colors are Defined in CityBannerManager.xml and
Highlights.xml(added from EUI in CBP - Compatibility Files )
I tryed something with ClearHexHighlights function, ''else'' commands for the Borders Code but nothing works correctly without a game reload.
Please help me, what am I doing wrong ?
I'm newbe at LUA Programming and trying since weeks a small Lua Mod to get running correctly.
The idea is that Cities get with Puppet Status a Blue CityBanner and a Blue CityBorder.
Cities with Resistance Status get a Red CityBanner and a Red CityBorder.
The city limits are also visible to the state borders. I have created HexHighligts for it.
Here is a picture for that:
The problem is that when changes the City Status from ''isPuppet'' or ''isResistance'' to ''normal'' City Status the CityBannerColor changes correctly
back. But the CityBorders not disappear.
If the CityStatus changes from ''normal'' to ''isPuppet'' or ''isResistance'' the CityBannerColor not changes correctly. But the CityBorders become
visible correctly.
Only after reload the Game i see all changes correctly.
Here is my Code i added it in the ''local function RefreshCityBannersNow()'' Function at CityBannerManager.lua - (6a)CBP - Compatibility Files (EUI)
The HexHiglights and Banner Colors are Defined in CityBannerManager.xml and
Highlights.xml(added from EUI in CBP - Compatibility Files )
Code:
-- Is Resistance/Is Puppet CityBorder changes
for plot in CityPlots( city ) do
g_cityHexHighlight = true
if city:IsPuppet() and not city:IsResistance() then
local hexPos = ToHexFromGrid{ x=plot:GetX(), y=plot:GetY() }
Events_SerialEventHexHighlight( hexPos , true, nil, "PuppetOwnedFill" )
Events_SerialEventHexHighlight( hexPos , true, nil, "PuppetOwnedOutline" )
end
if city:IsResistance() then
g_cityHexHighlight = true
local hexPos = ToHexFromGrid{ x=plot:GetX(), y=plot:GetY() }
Events_SerialEventHexHighlight( hexPos , true, nil, "ResOwnedFill" )
Events_SerialEventHexHighlight( hexPos , true, nil, "ResOwnedOutline" )
end
end
-- Is Resistance/Is Puppet BannerColorChange
if city:IsPuppet() and not city:IsResistance() then
instance.CityBannerBackground:SetColor( backgroundColor )
instance.CityBannerRightBackground:SetColor( backgroundColor )
instance.CityBannerLeftBackground:SetColor( backgroundColor )
else
instance.PuppetCityBannerBackground:SetColor( backgroundColor )
instance.PuppetCityBannerLeftBackground:SetColor( backgroundColor )
instance.PuppetCityBannerRightBackground:SetColor( backgroundColor )
end
if city:IsResistance() then
instance.CityBannerBackground:SetColor( backgroundColor )
instance.CityBannerRightBackground:SetColor( backgroundColor )
instance.CityBannerLeftBackground:SetColor( backgroundColor )
else
instance.ResCityBannerBackground:SetColor( backgroundColor )
instance.ResCityBannerLeftBackground:SetColor( backgroundColor )
instance.ResCityBannerRightBackground:SetColor( backgroundColor )
end
I tryed something with ClearHexHighlights function, ''else'' commands for the Borders Code but nothing works correctly without a game reload.
Please help me, what am I doing wrong ?