Hi, I'm new to modding. For my first mod I decided to see if I could make city states stronger. It bothered me that a sovereign nation state should be so weak in the early game.
I figured the best way to do this would be to give city states a building with very good stats when they founded a city, and make the building unconquerable. I'm not sure if city states follow the same production and growth rules as major civs. In fact, i'm fairly sure that they don't because city states built in the snow are often the same size as those built on grasslands. But to test it out I wrote this mod. However I'm having a hard time giving my own cities the building let alone a city state.
StrongerCityStates.lua
CityStateOnly.xml
I enabled logs and both xml.log and lua.log have no errors reported. What did I do wrong? I'd understand if city states don't actually have buildings until they're captured but I should at least be able to give buildings to my own cities.
I figured the best way to do this would be to give city states a building with very good stats when they founded a city, and make the building unconquerable. I'm not sure if city states follow the same production and growth rules as major civs. In fact, i'm fairly sure that they don't because city states built in the snow are often the same size as those built on grasslands. But to test it out I wrote this mod. However I'm having a hard time giving my own cities the building let alone a city state.
StrongerCityStates.lua
Code:
function StrongerCityStates(playerID, iX, iY)
local plot = Map.GetPlot(iX, iY);
-- If the city is owned by a city-state give it the building
if(plot:IsCity()) and --[[(Players[playerID]:IsMinorCiv())]] then
plot:GetPlotCity():SetNumRealBuilding(GameInfoTypes["BUILDING_CityStateOnly"], 1)
end
end
GameEvents.PlayerCityFounded.Add(StrongerCityStates);
CityStateOnly.xml
Code:
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 7/17/2015 3:19:03 PM -->
<GameData>
<BuildingClasses>
<Row>
<Type>BUILDINGCLASS_CityStateOnly</Type>
<DefaultBuilding>BUILDING_CityStateOnly</DefaultBuilding>
<Description>TXT_KEY_BUILDING_CityStateOnly</Description>
</Row>
</BuildingClasses>
<Buildings>
<Row>
<Type>BUILDING_CityStateOnly</Type>
<BuildingClass>BUILDINGCLASS_CityStateOnly</BuildingClass>
<Cost>1</Cost>
<NukeImmune>true</NukeImmune>
<NeverCapture>true</NeverCapture>
<BuildingProductionModifier>50</BuildingProductionModifier>
<FoodKept>30</FoodKept>
<IconAtlas>BW_ATLAS_1</IconAtlas>
<PortraitIndex>19</PortraitIndex>
<Description>TXT_KEY_BUILDING_CityStateOnly</Description>
<Help>TXT_KEY_BUILDING_CityStateOnly_HELP</Help>
</Row>
</Buildings>
<Building_YieldChanges>
<Row>
<BuildingType>BUILDING_CityStateOnly</BuildingType>
<YieldType>YIELD_FOOD</YieldType>
<Yield>5</Yield>
</Row>
<Row>
<BuildingType>BUILDING_CityStateOnly</BuildingType>
<YieldType>YIELD_PRODUCTION</YieldType>
<Yield>5</Yield>
</Row>
</Building_YieldChanges>
<Language_en_US>
<Row Tag="TXT_KEY_BUILDING_CityStateOnly">
<Text>City State</Text>
</Row>
<Row Tag="TXT_KEY_BUILDING_CityStateOnly_HELP">
<Text>City belongs to City State</Text>
</Row>
</Language_en_US>
</GameData>
Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="fd29a09f-20b4-4479-ad7b-8742b969a501" version="1">
<Properties>
<Name>Stronger City States</Name>
<Stability>Alpha</Stability>
<Teaser>City States are historically large cities with all the autonomy of a nation. However, in civ city states are generally complete</Teaser>
<Description>City States are historically large cities with all the autonomy of a nation. However, in civ city states are generally completely helpless, and not worth trading with until very late in the game. I decided to fix that</Description>
<Authors>Mohammed Ali</Authors>
<HideSetupGame>0</HideSetupGame>
<AffectsSavedGames>0</AffectsSavedGames>
<SupportsSinglePlayer>1</SupportsSinglePlayer>
<SupportsMultiplayer>1</SupportsMultiplayer>
<SupportsHotSeat>1</SupportsHotSeat>
<SupportsMac>1</SupportsMac>
<ReloadAudioSystem>0</ReloadAudioSystem>
<ReloadLandmarkSystem>0</ReloadLandmarkSystem>
<ReloadStrategicViewSystem>0</ReloadStrategicViewSystem>
<ReloadUnitSystem>0</ReloadUnitSystem>
</Properties>
<Dependencies />
<References />
<Blocks />
<Files>
<File md5="8F87B0AC8D5BCE698B8638BECCC2EB38" import="0">CityStateOnly.xml</File>
<File md5="5BBE23367C682390E2682B40BBA61744" import="0">StrongerCityStates.lua</File>
</Files>
<Actions>
<OnModActivated>
<UpdateDatabase>CityStateOnly.xml</UpdateDatabase>
</OnModActivated>
</Actions>
<EntryPoints>
<EntryPoint type="InGameUIAddin" file="CityStateOnly.lua">
<Name>CityStateOnlySto</Name>
<Description>CityStateOnlySto</Description>
</EntryPoint>
</EntryPoints>
</Mod>
I enabled logs and both xml.log and lua.log have no errors reported. What did I do wrong? I'd understand if city states don't actually have buildings until they're captured but I should at least be able to give buildings to my own cities.