shaglio
The Prince of Dorkness
Wow!!!!! This is awesome UA! and it has full support as well!
I guess you didn't read the part about the E&D error.
Wow!!!!! This is awesome UA! and it has full support as well!
If you loved the last civ...
...to be honest, you'll probably be much less impressed with this one.
But maybe you'll like it anyway:
Spoiler :
If no one can guess this...
For this civ I'm offering positions of beta-version playtester - since some of the unique component effects require in-game environments that I can't produce with FireTuner or IGE, I'm hoping someone will have the patience to play a significant way into a game with the civ in order to test the effects. Basically, because I'm lazy.
Beta playtesters also get to have input on UA effects. (like, if I should make them more creative, because right now...) They will, of course, be sworn to secrecy regarding any aspect of the mod. Can't let too much information that people like to have be leaker out, after all.
--[[
This file is a congolmeration of the Crops, Metal and Livestock files.
The need arose due to load attribute restrictions for UI files.
]]--
-- Credit to JFD for this function
function GetRandom(lower, upper)
return Game.Rand((upper + 1) - lower, "") + lower
end
DebugPrintMessages = true
function PrintDebug(sMessage)
if DebugPrintMessages then
print(sMessage)
end
end
tPlainsTiles = {}
tGrassTiles = {}
tElseTiles = {}
include("PlotIterators.lua")
include("IconSupport")
-- CROPS
function AW_Urartu_UA_UI_Crops_Popup(iPlayer, iCity)
local pPlayer = Players[iPlayer]
local pCity = pPlayer:GetCityByID(iCity)
Controls.AW_Urartu_UA_UI_Crops_Label:LocalizeAndSetText("TXT_KEY_AW_URARTU_UA_UI_CROPS_LABEL", pCity:GetName())
CivIconHookup(iPlayer, 64, Controls.Icon, Controls.CivIconBG, Controls.CivIconShadow, false, true )
Controls.AW_Urartu_UA_UI_BG:SetHide(false)
Controls.AW_Urartu_UA_UI_Crops_UI:SetHide(false)
end
Controls.SelectWheat:RegisterCallback(Mouse.eLClick, function()
-- Place wheat
local pPlot = tPlainsTiles[GetRandom(1, #tPlainsTiles)]
pPlot:SetResourceType(GameInfoTypes.RESOURCE_WHEAT, 1)
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Crops_UI:SetHide(true)
end)
Controls.SelectWine:RegisterCallback(Mouse.eLClick, function()
-- Place Wine --
local pPlot = tPlainsTiles[GetRandom(1, #tPlainsTiles)]
pPlot:SetResourceType(GameInfoTypes.RESOURCE_WINE, 1)
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Crops_UI:SetHide(true)
end)
-- LIVESTOCK
function AW_Urartu_UA_UI_Livestock_Popup(iPlayer, iCity)
local pPlayer = Players[iPlayer]
local pCity = pPlayer:GetCityByID(iCity)
Controls.AW_Urartu_UA_UI_Livestock_Label:LocalizeAndSetText("TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_LABEL", pCity:GetName())
CivIconHookup(iPlayer, 64, Controls.Icon, Controls.CivIconBG, Controls.CivIconShadow, false, true )
Controls.AW_Urartu_UA_UI_BG:SetHide(false)
Controls.AW_Urartu_UA_UI_Livestock_UI:SetHide(false)
end
Controls.SelectCattle:RegisterCallback(Mouse.eLClick, function()
-- Place Cattle --
local pPlot = tGrassTiles[GetRandom(1, #tGrassTiles)]
pPlot:SetResourceType(GameInfoTypes.RESOURCE_COW, 1)
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Livestock_UI:SetHide(true)
end)
Controls.SelectHorses:RegisterCallback(Mouse.eLClick, function()
-- Place Horses --
local pPlot = tGrassTiles[GetRandom(1, #tGrassTiles)]
local HorseQuantities = {}
HorseQuantities[1] = 2
HorseQuantities[2] = 4
pPlot:SetResourceType(GameInfoTypes.RESOURCE_HORSE, HorseQuantities[GetRandom(1,2)])
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Livestock_UI:SetHide(true)
end)
-- METAL
function AW_Urartu_UA_UI_Metal_Popup(iPlayer, iCity)
local pPlayer = Players[iPlayer]
local pCity = pPlayer:GetCityByID(iCity)
Controls.AW_Urartu_UA_UI_Metal_Label:LocalizeAndSetText("TXT_KEY_AW_URARTU_UA_UI_METAL_LABEL", pCity:GetName())
CivIconHookup(iPlayer, 64, Controls.Icon, Controls.CivIconBG, Controls.CivIconShadow, false, true )
Controls.AW_Urartu_UA_UI_BG:SetHide(false)
Controls.AW_Urartu_UA_UI_Metal_UI:SetHide(false)
end
Controls.SelectCopper:RegisterCallback(Mouse.eLClick, function()
-- Place Copper -
local pPlot = tElseTiles[GetRandom(1, #tElseTiles)]
pPlot:SetResourceType(GameInfoTypes.RESOURCE_COPPER, 1)
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Metal_UI:SetHide(true)
end)
Controls.SelectIron:RegisterCallback(Mouse.eLClick, function()
-- Place Iron --
local pPlot = tElseTiles[GetRandom(1, #tElseTiles)]
local IronQuantities = {}
IronQuantities[1] = 2
IronQuantities[2] = 6
pPlot:SetResourceType(GameInfoTypes.RESOURCE_IRON, IronQuantities[GetRandom(1,2)])
-- Close Window
Controls.AW_Urartu_UA_UI_BG:SetHide(true)
Controls.AW_Urartu_UA_UI_Metal_UI:SetHide(true)
end)
GameEvents.PlayerCityFounded.Add(
function(iPlayer, iX, iY)
local pPlayer = Players[iPlayer]
if not (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_AW_URARTU) then return end
if not (pPlayer:IsHuman()) then return end
PrintDebug("Hoo[ra{h,y}] four Your Are Too!")
local iChance = GetRandom(1,2)
PrintDebug("Rolling dice...")
if (iChance == 2) then
PrintDebug("Gambling paid off! We\'s got\'s ourselves a 2!")
local pPlot = Map.GetPlot(iX, iY)
local pCity = pPlot:GetPlotCity()
PrintDebug("Deleting tables. Don\'t cry; we\'ll reinitialize them later...")
tPlainsTiles = {}
tGrassTiles = {}
tElseTiles = {}
-- if (tPlainsTiles == nil) then
-- PrintDebug("tPlainsTiles is nil?!?!? NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
-- tPlainsTiles = {}
-- end
-- if (tGrassTiles == nil) then
-- PrintDebug("tGrassTiles is nil?!?!? NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
-- tGrassTiles = {}
-- end
-- if (tElseTiles == nil) then
-- PrintDebug("tElseTiles is nil?!?!? NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
-- tElseTiles = {}
-- end
for pLoopPlot in PlotAreaSweepIterator(pPlot, 1, SECTOR_NORTH, DIRECTION_CLOCKWISE, DIRECTION_OUTWARDS, CENTRE_EXCLUDE) do
if (not ((pLoopPlot:GetPlotType() == PlotTypes.NO_PLOT) or (pLoopPlot:GetPlotType() == PlotTypes.PLOT_MOUNTAIN) or (pLoopPlot:GetPlotType() == PlotTypes.PLOT_OCEAN))) and (pLoopPlot:GetResourceType() == -1) then
if (pLoopPlot:GetTerrainType() == GameInfoTypes.TERRAIN_PLAINS) and (pLoopPlot:GetFeatureType() == -1) and (pLoopPlot:GetPlotType() ~= PlotTypes.PLOT_HILLS) then
PrintDebug("Inserting to tPlainsTiles.?!@#$%^&*()")
table.insert(tPlainsTiles, pLoopPlot)
elseif (pLoopPlot:GetTerrainType() == GameInfoTypes.TERRAIN_GRASS) and (pLoopPlot:GetFeatureType() == -1) and (pLoopPlot:GetPlotType() ~= PlotTypes.PLOT_HILLS) then
PrintDebug("Inserting to tGrassTiles")
table.insert(tGrassTiles, pLoopPlot)
else
PrintDebug("Inserting to tElseTiles")
table.insert(tElseTiles, pLoopPlot)
end
end
end
PrintDebug("Hold up! Let's check our variables!")
PrintDebug("There are "..#tPlainsTiles.." plots in tPlainsTiles, "..#tGrassTiles.." plots in tGrassTiles, and "..#tElseTiles.." plots in tElseTiles.")
if (#tPlainsTiles >= #tGrassTiles) and (#tPlainsTiles >= #tElseTiles) then
PrintDebug("Ergo crops!")
AW_Urartu_UA_UI_Crops_Popup(iPlayer, pCity:GetID())
elseif (#tGrassTiles >= #tPlainsTiles) and (#tGrassTiles >= #tElseTiles) then
PrintDebug("Ergo livestock")
AW_Urartu_UA_UI_Livestock_Popup(iPlayer, pCity:GetID())
elseif (#tElseTiles >= #tGrassTiles) and (#tElseTiles >= #tPlainsTiles) then
PrintDebug("Ergo metal!")
AW_Urartu_UA_UI_Metal_Popup(iPlayer, pCity:GetID())
end
else
PrintDebug("These dice suck -- we got a 1! Time to rage-quit and reload a savegame! ARRRRGH!")
end
end)
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is a congolmeration of the Crops, Metal and Livestock files.
The need arose due to load attribute restrictions for UI files. -->
<Context>
<Box ID="AW_Urartu_UA_UI_BG" Style="BGBlock_ClearTopBar" Hidden="1"/>
<!-- CROPS -->
<Grid ID="AW_Urartu_UA_UI_Crops_UI" Size="600,300" Anchor="C,C" Style="Grid9DetailFive140" ConsumeMouse="1" Hidden="1">
<Image Anchor="C,T" AnchorSide="I.O" Size="256,64" Offset="0,-14" Texture="assets\UI\Art\Icons\Top512IconTrim.dds" >
<Image ID="CivIconBG" Size="64.64" Anchor="C,C" Offset="-1,-1" TextureOffset="77,0" Texture="CivIconBGSizes.dds" />
<Image ID="CivIconShadow" Size="48.48" Anchor="C,C" Offset="0,0" Texture="CivSymbolAtlas48.dds" Color="Black.128"/>
<Image ID="Icon" Size="48,48" Offset="-1,-1" Anchor="C,C" Texture="CivSymbolsColor512.dds" />
</Image>
<Label ID="AW_Urartu_UA_UI_Crops_Label" Offset="0,-20" WrapWidth="500" Anchor="C,C" Font="TwCenMT22" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_AW_URARTU_UA_UI_CROPS_LABEL"/>
<Box Anchor="C,B" AnchorSide="I.I" Offset="0,54" Size="450,56" Color="255,255,255,0">
<!-- Wheat -->
<GridButton ID="SelectWheat" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="-100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_CROPS_WHEAT_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_CROPS_WHEAT" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
<!-- Wine -->
<GridButton ID="SelectWine" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_CROPS_WINE_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_CROPS_WINE" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
</Box>
</Grid>
<!-- LIVESTOCK -->
<Grid ID="AW_Urartu_UA_UI_Livestock_UI" Size="600,300" Anchor="C,C" Style="Grid9DetailFive140" ConsumeMouse="1" Hidden="1">
<Image Anchor="C,T" AnchorSide="I.O" Size="256,64" Offset="0,-14" Texture="assets\UI\Art\Icons\Top512IconTrim.dds" >
<Image ID="CivIconBG" Size="64.64" Anchor="C,C" Offset="-1,-1" TextureOffset="77,0" Texture="CivIconBGSizes.dds" />
<Image ID="CivIconShadow" Size="48.48" Anchor="C,C" Offset="0,0" Texture="CivSymbolAtlas48.dds" Color="Black.128"/>
<Image ID="Icon" Size="48,48" Offset="-1,-1" Anchor="C,C" Texture="CivSymbolsColor512.dds" />
</Image>
<Label ID="AW_Urartu_UA_UI_Livestock_Label" Offset="0,-20" WrapWidth="500" Anchor="C,C" Font="TwCenMT22" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_LABEL"/>
<Box Anchor="C,B" AnchorSide="I.I" Offset="0,54" Size="450,56" Color="255,255,255,0">
<!-- Cattle -->
<GridButton ID="SelectCattle" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="-100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_CATTLE_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_CATTLE" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
<!-- Horses -->
<GridButton ID="SelectHorses" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_HORSES_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_LIVESTOCK_HORSES" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
</Box>
</Grid>
<!-- METAL -->
<Grid ID="AW_Urartu_UA_UI_Metal_UI" Size="600,300" Anchor="C,C" Style="Grid9DetailFive140" ConsumeMouse="1" Hidden="1">
<Image Anchor="C,T" AnchorSide="I.O" Size="256,64" Offset="0,-14" Texture="assets\UI\Art\Icons\Top512IconTrim.dds" >
<Image ID="CivIconBG" Size="64.64" Anchor="C,C" Offset="-1,-1" TextureOffset="77,0" Texture="CivIconBGSizes.dds" />
<Image ID="CivIconShadow" Size="48.48" Anchor="C,C" Offset="0,0" Texture="CivSymbolAtlas48.dds" Color="Black.128"/>
<Image ID="Icon" Size="48,48" Offset="-1,-1" Anchor="C,C" Texture="CivSymbolsColor512.dds" />
</Image>
<Label ID="AW_Urartu_UA_UI_Metal_Label" Offset="0,-20" WrapWidth="500" Anchor="C,C" Font="TwCenMT22" FontStyle="Shadow" ColorSet="Beige_Black_Alpha" String="TXT_KEY_AW_URARTU_UA_UI_METAL_LABEL"/>
<Box Anchor="C,B" AnchorSide="I.I" Offset="0,54" Size="450,56" Color="255,255,255,0">
<!-- Copper -->
<GridButton ID="SelectCopper" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="-100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_METAL_COPPER_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_METAL_COPPER" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
<!-- Iron -->
<GridButton ID="SelectIron" Anchor="C,C" Style="SmallButton" Size="150,32" Offset="100,0" StateOffsetIncrement="0,0" ToolTip="TXT_KEY_AW_URARTU_UA_UI_METAL_IRON_TOOLTIP">
<Label Anchor="C,C" Offset="0,0" String="TXT_KEY_AW_URARTU_UA_UI_METAL_IRON" Font="TwCenMT18" ColorSet="Beige_Black_Alpha" FontStyle="Shadow"/>
</GridButton>
</Box>
</Grid>
</Context>