How to make a custom civ compatible with vox populi

Hardstyle

Chieftain
Joined
Mar 14, 2013
Messages
20
Hi everyone!
So I just decided to start modding a civ for myself following this small tutorial:
Basically i'm now creating my UU and i wanted to add some "freepromotions" that are only avalaible in VP.
So is there anything I should do to make them usable? or can I just add those promotions to <Unit_FreePromotions>?
Thanks in advance.

Moderator Action: Moved your thread to the main C&C forum as that is where questions go. Best of luck with your modding. leif
 
Last edited by a moderator:
The only extra thing you would need to do is to mark Vox Populi as a dependency for your mod, to ensure that it gets loaded into the DB before your mod, and that your mod won’t run without it. Then the process is exactly the same as vanilla civs.

Best of luck with the modding! We can always use more good VP modmods.
 
I suggest you to look for your desired promotion in MODS\(2) Community Balance Overhaul\Balance Changes\Units\PromotionChanges.sql and PromotionChanges.xml, then when you find the one you want to give to your UU, you create a new promotion copying the characteristics of the desired one.
Doing so allows you to not put Vox Populi as a dependency, and anybody who wants to play your mod but not VP can do so.

If you want to enable one of the promotions in MODS\(1) Community Patch\Core Files\PNM Mods DB\PROMOTIONS , instead, then you need to put VP at least in the list of references.

EDIT: Same as above for any ability included in MODS\(1) Community Patch\Core Files\Core Tables\CoreTableEntries.sql
Spoiler :

-- Promotions

ALTER TABLE UnitPromotions ADD 'MinimumRangeRequired' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'MaximumRangeRequired' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AttackFullyHealedMod' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AttackAbove50HealthMod' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AttackBelowEqual50HealthMod' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'SplashDamage' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AOEDamageOnKill' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AoEWhileFortified' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'AoEDamageOnMove' INTEGER DEFAULT 0; -- JJ: Do AoE damage when the unit moves
ALTER TABLE UnitPromotions ADD 'WorkRateMod' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'ReconChange' INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD 'PromotionDuration' INTEGER DEFAULT 0;

-- Promotion restricted to tile. Lost if unit leaves it. Only used in conjuction with free promotions from features and terrains (see above)

ALTER TABLE UnitPromotions ADD COLUMN 'IsLostOnMove' BOOLEAN DEFAULT 0;

-- Put the name of the Promotion in this row in order to negate it with another promotion - currently only works with the terrain/feature related promotion functions above!
ALTER TABLE UnitPromotions ADD 'NegatesPromotion' TEXT DEFAULT NULL;

-- Forced sets the damage the unit will receive from the combat REGARDLESS of how much damage was calculated to be dealt to it.
ALTER TABLE UnitPromotions ADD 'ForcedDamageValue' INTEGER DEFAULT 0;

-- Change reduces damage the unit will receive BASED on how much damage was calculated to be dealt to it. Negative numbers to reduce!
ALTER TABLE UnitPromotions ADD 'ChangeDamageValue' INTEGER DEFAULT 0;

-- A unit cannot be captured by another player (i.e. from prize ships, etc.). Does not apply to civilians.
ALTER TABLE UnitPromotions ADD 'CannotBeCaptured' BOOLEAN DEFAULT 0;

-- A unit gains a combat bonus VS barbarians
ALTER TABLE UnitPromotions ADD COLUMN 'BarbarianCombatBonus' INTEGER DEFAULT 0;

-- Ranged units have a % chance to force another unit to retreat, taking additional damage if they cannot do so.
ALTER TABLE UnitPromotions ADD COLUMN 'MoraleBreakChance' INTEGER DEFAULT 0;

-- Promotion bonuses restricted to Barbarians.

ALTER TABLE UnitPromotions ADD COLUMN 'BarbarianOnly' BOOLEAN DEFAULT 0;

-- Promotion bonuses restricted to City States.

ALTER TABLE UnitPromotions ADD COLUMN 'CityStateOnly' BOOLEAN DEFAULT 0;

-- Promotion grants the same bonus as the Japan UA
ALTER TABLE UnitPromotions ADD COLUMN 'StrongerDamaged' BOOLEAN DEFAULT 0;

-- Double Movement on Mountains
ALTER TABLE UnitPromotions ADD COLUMN 'MountainsDoubleMove' BOOLEAN DEFAULT 0;

-- Double Heal in Feature/Terrain
ALTER TABLE UnitPromotions_Features ADD COLUMN 'DoubleHeal' BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions_Terrains ADD COLUMN 'DoubleHeal' BOOLEAN DEFAULT 0;

-- Combat Modifier for determined range near a defined UnitClass
ALTER TABLE UnitPromotions ADD CombatBonusFromNearbyUnitClass INTEGER DEFAULT -1;
ALTER TABLE UnitPromotions ADD NearbyUnitClassBonusRange INTEGER DEFAULT 0;
ALTER TABLE UnitPromotions ADD NearbyUnitClassBonus INTEGER DEFAULT 0;

-- Requres some Explanation: Unit A has X promotion, Unit B gains promotion by adding these Values to a Promotion that it wishes to gain when near some distance
-- AddedFromNearbyPromotion = 'Unit A's promotion' IsNearbyPromotion must be set to 1 or true, and NearbyRange is distance in which the promotion triggers.
ALTER TABLE UnitPromotions ADD AddedFromNearbyPromotion INTEGER DEFAULT -1;
ALTER TABLE UnitPromotions ADD IsNearbyPromotion BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions ADD NearbyRange INTEGER DEFAULT 0;

-- A unit gains a promotion if "NearbyRange" is set to a distance from City, RequiredUnit must be set to the unit that you wish to give the promotion to.
ALTER TABLE UnitPromotions ADD IsNearbyCityPromotion BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions ADD IsNearbyFriendlyCityPromotion BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions ADD IsNearbyEnemyCityPromotion BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions ADD IsFriendlyLands BOOLEAN DEFAULT 0;
ALTER TABLE UnitPromotions ADD RequiredUnit TEXT DEFAULT NULL REFERENCES Units(Type);

-- Changes the intercept range against air units (NEW)
ALTER TABLE UnitPromotions ADD AirInterceptRangeChange INTEGER DEFAULT 0;

-- Allows you to Convert a unit when it X plot is a different domain, e.g. A great general becomes a great admiral, etc.
ALTER TABLE UnitPromotions ADD ConvertDomainUnit TEXT DEFAULT NULL REFERENCES Units(Type);
ALTER TABLE UnitPromotions ADD ConvertDomain TEXT DEFAULT NULL REFERENCES Domains(Type);
ALTER TABLE Units ADD IsConvertUnit BOOLEAN DEFAULT 0;

-- City Gains Wonder Production Modifier while this Unit is stationed in this City
ALTER TABLE UnitPromotions ADD WonderProductionModifier INTEGER DEFAULT 0;
 
Last edited:
Hey, first thank both you guys for your replies! Appreciate it.
Well, so to give you the context I started with a idea 2 days ago about creating a Putin russian federation (to replace the one JFD made that is now not working as intended sadly) and I started to check guides and tutorials everywhere i could find them, but apparently some of them are getting outdated.
So, i'm basically a total newbie at modding in Civ 5, tho I think it shouldnt be too hard if i spend some time on the subject :D (Holydays be blessed.)
So, what I tried to do for now is use one of JFD's civ made for VP (Roosevelt) and use the file structure as a reference but there are still a lot of element i don't really get for now.
My custom civ would have these specificities:
UA
+2 influence per turn to city states that you have a pledge of protection with. When a civilization declares war on you all their city endure 1 turn of resistance for every 3 city states allied with you.

UB Oblast
Russian unique replacement for the coal refinery. Provide +2% gold, food and culture for every Global monopoly. Only 5 of this building can be built in the russian federation.

UU Sukhoi t-50
Russian unique replacement for the jet fighter. This unit specialize in defeating wounded ground units and has a slightly higher combat strenght than the jet fighter.

Something around those lines. I dont think it's balanced at all, but the global idea would be to flavor a wide play and make this civ suited for a sort of "police state" and aim toward a diplo or lategame domination victory.
so next questions would be :
-How do i use a global monopoly as a trigger to an effect?
-For the UU i was wondering if air units can be given for exemple the cossack promotion? or if it can't, how should I create a custom promotion?

Anyway, Maybe I'll figure it out on my own, but I have to admit some of this stuff would require the help of some more experienced peope than me on the matter :)
Thanks again!
 
Last edited:
UB Oblast
Russian unique replacement for the coal refinery. Provide +2% gold, food and culture for every Global monopoly. Only 5 of this building can be built in the russian federation.
[...]
-How do i use a global monopoly as a trigger to an effect?

For this one I think I can give you a hand. First, you can create a dummy building granting the +2% bonuses, e.g.:
Code:
INSERT INTO BuildingClasses     

        (Type,                             DefaultBuilding,             Description,                     NoLimit)
VALUES    ('BUILDINGCLASS_DUMMY_OBLAST',     'BUILDING_DUMMY_OBLAST',     'TXT_KEY_BUILDING_DUMMY_OBLAST', 1);

INSERT INTO Buildings     
        (Type,                             BuildingClass,                    Cost,    GreatWorkCount, FaithCost,     PrereqTech,    GoldMaintenance,    Description,                         MinAreaSize, HurryCostModifier, PortraitIndex,     IconAtlas,        NeverCapture)
VALUES    ('BUILDING_DUMMY_OBLAST',        'BUILDINGCLASS_DUMMY_OBLAST',    -1,        -1,                -1,            NULL,        0,                    'TXT_KEY_BUILDING_DUMMY_OBLAST',    -1,            -1,                    10,                'CITIZEN_ATLAS', 1);

INSERT INTO Building_YieldModifiers
        (BuildingType,                 YieldType,         Yield)
VALUES    ('BUILDING_DUMMY_OBLAST',    'YIELD_GOLD',    2),
        ('BUILDING_DUMMY_OBLAST',    'YIELD_CULTURE',    2),
        ('BUILDING_DUMMY_OBLAST',    'YIELD_FOOD',    2);
The NoLimit set to 1 allows to give to the city more than one building of the same type, in our case we will grant as much as the number of global monopolies the player has.

Now we have to count the resource monopolies and give to the city the dummy building conditional on the fact the city possesses already the Oblast building.
Code:
function Oblast_MonopolyBonus(iPlayer)
    local pPlayer = Players[iPlayer]
    if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_RUSSIA_HARDSTYLE and pPlayer:IsAlive()) then
        local monopolycount = 0
        for pResource in GameInfo.Resources() do
            if(pResource.IsMonopoly == 1) and pPlayer:GetMonopolyPercent(pResource.ID)>= 51 then
            monopolycount = monopolycount + 1
            end
        end
        for pCity in pPlayer:Cities() do
            if pCity:IsHasBuilding(GameInfoTypes["BUILDING_OBLAST"]) then
                pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_DUMMY_OBLAST"], monopolycount)
            end
        end
    end
end   
        
GameEvents.PlayerDoTurn.Add(Oblast_MonopolyBonus)

(If I made no mistakes the code should work).

-For the UU i was wondering if air units can be given for exemple the cossack promotion? or if it can't, how should I create a custom promotion?
In order to create custom promotion you can check the modiki and particularly this page that tells you all the fields that you can fill in order to give a certain effect (for example if you include IgnoreTerrainCost and set it to 1 then the unit with that promotion will ignore terrain costs), but Vox Populi has added more fields for a more variegated gameplay as you can see in the spoiler in my previous message (for example if you include SplashDamage and set it to 5 then the unit with such promotion deals 5 additional damage to the adjacent unit you attacked).
Example:
Code:
INSERT INTO UnitPromotions
        (Type,                              Description,                              Help,                     Sound,             LostWithUpgrade, OrderPriority, IgnoreTerrainCost, SplashDamage,CannotBeChosen,    PortraitIndex,     IconAtlas,            PediaType,             PediaEntry)
VALUES    ('PROMOTION_EXAMPLE1',     'TXT_KEY_PROMOTION_EXAMPLE1',     'TXT_KEY_PROMOTION_EXAMPLE1_HELP',        'AS2D_IF_LEVELUP',    0,                 0,             1,                 0,                    0,                59,     'ABILITY_ATLAS',     'PEDIA_ATTRIBUTES', 'TXT_KEY_PROMOTION_EXAMPLE1'),
        ('PROMOTION_EXAMPLE2',     'TXT_KEY_PROMOTION_EXAMPLE2',     'TXT_KEY_PROMOTION_EXAMPLE2_HELP',        'AS2D_IF_LEVELUP',    0,                 0,             0,                 5,                    0,                59,     'ABILITY_ATLAS',     'PEDIA_ATTRIBUTES', 'TXT_KEY_PROMOTION_EXAMPLE2');

Then with lua you iterate trough all the units conditional that the unit belongs to your Russia civ, then if the unit is of the specified combatclass (UNITCOMBAT_BOMBER or UNITCOMBAT_FIGHTER) and has not the promotion then you give the promotion you want.

In addition, I suggest you to download the useful resources that are here and here, they helped me a lot in creating units and promotions. :c5happy:
 
Wow, thanks.
That indeed saved some time, but I have another question not really related to the particular civ I"m trying to make and that's where can I learn more about these codes? Because you seem to understand a lot more about what everything does than I obviously do :)
 
This post is primarily for others reading this who are not using the CP/Vox Populi system:

Column NoLimit in table BuildingClasses has no effect under the game's standard DLL. William Howard (@whoward69) and @Gazebo may have changed this for VMC and CP but I doubt it in the case of VMC.

In the standard DLL whether the column is set to true or false you can add as many copies of the building as desired and the game implements correctly except for the "yields" that are never implemented across multiple copies of the same building in the same city no matter what trickery you attempt. VMC and CP cure these issues with non-implemented yields.

-------------------------------------------------

Also for those looking at this thread in posterity, 'YIELD_CULTURE' only works in table Building_YieldModifiers when using VMC or CP DLLs. The game's standard DLL file ignores such entries.

And you must use the CP DLL mod in order to use Vox Populi, so for people creating mods for Vox Populi (as the OP is I think) the issues related to what the game's standard DLL will implement are irrelevant. The issues come into play when someone wants to make a mod that is compatible to Vox Populi but can also be used with the game's standard DLL.
 
Thanks for the info Lee S.
I am indeed creating my civilization with vox populi in mind and not the vanilla game.

Also, could someone explain what does these lines do?

Code:
-- BUILDINGCLASSES
--=======================================================================================================================
-- BuildingClasses
------------------------------
INSERT INTO BuildingClasses
       (Type,                                    DefaultBuilding,                Description)
VALUES   ('BUILDINGCLASS_JFD_RUSSIA_PUTIN',        'BUILDING_JFD_RUSSIA_PUTIN',    'TXT_KEY_BUILDING_JFD_RUSSIA_PUTIN');

And

Code:
-- Buildings
------------------------------ 
INSERT INTO Buildings  
       (Type,                                        BuildingClass, Cost, SpecialistType, Happiness,   SpecialistCount, GoldMaintenance, PrereqTech, Description,                                        Help,                                        Civilopedia,                             Strategy,                                        ArtDefineTag, MinAreaSize, NeverCapture, Espionage, EspionageModifier, HurryCostModifier, PortraitIndex,    IconAtlas)
SELECT   'BUILDING_JFD_STATE_ASSEMBLY',               BuildingClass, Cost, SpecialistType, 1,           SpecialistCount, GoldMaintenance, PrereqTech, 'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY',            'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_HELP', 'TXT_KEY_CIV5_JFD_STATE_ASSEMBLY_TEXT',  'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_STRATEGY', ArtDefineTag, MinAreaSize, NeverCapture, Espionage, EspionageModifier, HurryCostModifier, 3,                'JFD_RUSSIA_PUTIN_ATLAS'
FROM Buildings WHERE Type = 'BUILDING_CONSTABLE';
for the second one i guess I understand what it does but the syntax is weird to me i dont understand why there is two times "Buildingclass,cost,...".

Because I'm trying to reverse engineer JFD's mod to better understand what the heck I'm doing :D
And I'm not completly sure what this one does.
 
Last edited:
This part adds a new Class of building called 'BUILDINGCLASS_JFD_RUSSIA_PUTIN' with a default building for the class of 'BUILDING_JFD_RUSSIA_PUTIN' and a reference for the new class' Description to whatever text is held within 'TXT_KEY_BUILDING_JFD_RUSSIA_PUTIN'
Code:
-- BUILDINGCLASSES
--=======================================================================================================================
-- BuildingClasses
------------------------------
INSERT INTO BuildingClasses
       (Type,                                    DefaultBuilding,                Description)
VALUES   ('BUILDINGCLASS_JFD_RUSSIA_PUTIN',        'BUILDING_JFD_RUSSIA_PUTIN',    'TXT_KEY_BUILDING_JFD_RUSSIA_PUTIN');
----------------------------------------------------------------------------------------------------------------------

This part adds a new Building called 'BUILDING_JFD_STATE_ASSEMBLY' but instructs the game to use whatever the existing 'BUILDING_CONSTABLE' uses for
BuildingClass, Cost, SpecialistType, SpecialistCount, GoldMaintenance, PrereqTech, ArtDefineTag, MinAreaSize, NeverCapture, Espionage, EspionageModifier, and HurryCostModifier
while setting direct values for
Type ('BUILDING_JFD_STATE_ASSEMBLY')
Happiness (1)
Description ('TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY')
Help ('TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_HELP')
Civilopedia ('TXT_KEY_CIV5_JFD_STATE_ASSEMBLY_TEXT')
Strategy ('TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_STRATEGY')
PortraitIndex (3)
IconAtlas ('JFD_RUSSIA_PUTIN_ATLAS')
Code:
-- Buildings
------------------------------ 
INSERT INTO Buildings  
       (Type,                                        BuildingClass, Cost, SpecialistType, Happiness,   SpecialistCount, GoldMaintenance, PrereqTech, Description,                                        Help,                                        Civilopedia,                             Strategy,                                        ArtDefineTag, MinAreaSize, NeverCapture, Espionage, EspionageModifier, HurryCostModifier, PortraitIndex,    IconAtlas)
SELECT   'BUILDING_JFD_STATE_ASSEMBLY',               BuildingClass, Cost, SpecialistType, 1,           SpecialistCount, GoldMaintenance, PrereqTech, 'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY',            'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_HELP', 'TXT_KEY_CIV5_JFD_STATE_ASSEMBLY_TEXT',  'TXT_KEY_BUILDING_JFD_STATE_ASSEMBLY_STRATEGY', ArtDefineTag, MinAreaSize, NeverCapture, Espionage, EspionageModifier, HurryCostModifier, 3,                'JFD_RUSSIA_PUTIN_ATLAS'
FROM Buildings WHERE Type = 'BUILDING_CONSTABLE';
  • The SELECT .. FROM syntax in SQL allows us to grab data from one part of the game's database and stick this data into a new row in the database.
  • So if some other mod had changed the Building-Class used by 'BUILDING_CONSTABLE', JFD's code would make his new building called 'BUILDING_JFD_STATE_ASSEMBLY' conform to this alteration.
  • XML files and syntax cannot do this dynamic data-grabbing.
 
OOOOOOOK!
Got it now, made me understand a few more things about how these codes works.
Thanks a lot Lee!
 
Code:
--=======================================================================================================================
-- BUILDINGCLASSES
--=======================================================================================================================
-- BuildingClasses
------------------------------ 
INSERT INTO BuildingClasses  
       (Type,                                 DefaultBuilding,                Description,                    NoLimit)
VALUES   ('BUILDINGCLASS_SMH_RUSFED',        'BUILDING_SMH_RUSFED',           'TXT_KEY_BUILDING_SMH_RUSFED',      1); 
--========================================================================================================================== 
-- BUILDINGS
--========================================================================================================================== 
-- Buildings
------------------------------ 
INSERT INTO Buildings  
       (Type,                                        BuildingClass, Cost, SpecialistType, SpecialistCount, GoldMaintenance, PrereqTech,  Description,                                        Help,                                        Civilopedia,                             Strategy,                                        ArtDefineTag, MinAreaSize, NeverCapture,  HurryCostModifier, PortraitIndex,    IconAtlas)
SELECT   'BUILDING_SMH_OBLAST',                       BuildingClass, 1500, SpecialistType, SpecialistCount, GoldMaintenance, STEAM_POWER, 'TXT_KEY_BUILDING_SMH_OBLAST',                       'TXT_KEY_SMH_OBLAST_HELP',                   'TXT_KEY_CIV5_SMH_OBLAST_TEXT',          'TXT_KEY_BUILDING_SMH_OBLAST_STRATEGY',         ArtDefineTag, MinAreaSize, NeverCapture,  HurryCostModifier, 3,                'JFD_RUSSIA_PUTIN_ATLAS'
FROM Buildings WHERE Type = 'BUILDING_COAL_PLANT'; 

INSERT INTO Buildings   
        (Type,                                          BuildingClass,                    Cost,    GreatWorkCount, FaithCost,     PrereqTech,    GoldMaintenance,       Description,                                      MinAreaSize, HurryCostModifier, PortraitIndex,     IconAtlas,        NeverCapture)
VALUES    ('BUILDING_SMH_OBLAST_YIELD_MODIFIER',        'BUILDINGCLASS_SMH_RUSFED',       -1,      -1,                -1,            NULL,        0,                    'TXT_KEY_BUILDING_SMH_OBLAST_YIELD_MODIFIER',     -1,           -1,               10,               'CITIZEN_ATLAS',          1);

------------------------------ 
-- Building_Flavors
------------------------------     
INSERT INTO Building_Flavors  
       (BuildingType,                    FlavorType,   Flavor)
SELECT   'BUILDING_SMH_OBLAST',   FlavorType,   Flavor
FROM Building_Flavors WHERE BuildingType = 'BUILDING_COAL_PLANT'; 

INSERT INTO Building_Flavors  
       (BuildingType,                    FlavorType,           Flavor)
VALUES   ('BUILDING_SMH_OBLAST',   'FLAVOR_INFRASTRUCTURE',   30);

INSERT INTO Building_Flavors  
       (BuildingType,                    FlavorType,           Flavor)
VALUES   ('BUILDING_SMH_OBLAST',   'FLAVOR_EXPANSION',           30);

INSERT INTO Building_Flavors  
       (BuildingType,                    FlavorType,           Flavor)
VALUES   ('BUILDING_SMH_OBLAST',   'FLAVOR_GROWTH',           15);

------------------------------ 
-- Building_YieldModifiers
------------------------------     
INSERT INTO Building_YieldModifiers
        (BuildingType,                 YieldType,         Yield)
VALUES    ('BUILDING_SMH_OBLAST_YIELD_MODIFIER',    'YIELD_GOLD',    5),
        ('BUILDING_SMH_OBLAST_YIELD_MODIFIER',    'YIELD_CULTURE',    5),
        ('BUILDING_SMH_OBLAST_YIELD_MODIFIER',    'YIELD_FOOD',    5);

As i said before I'm using JFD's Putin mod as a base since I'm far of beeing as talented as him.
I made some modification to "buildings" using Jarcast codes in the "function.lua" and added a dummy building from Jarcast again, but I may have missed something since I can't see the civ in the game.
I kept a back up of the original file and replaced mine with it and the civ is visible again.
If someone could check this and tell me what i have failed I'd be grateful. :D

Oops, I also added a buildingclassoverride

Code:
--------------------------------  
-- Civilization_BuildingClassOverrides
--------------------------------      
INSERT INTO Civilization_BuildingClassOverrides
       (CivilizationType,                    BuildingClassType,            BuildingType)
VALUES   ('CIVILIZATION_JFD_RUSSIA_PUTIN',    'BUILDINGCLASS_COAL_PLANT',    'BUILDING_SMH_OBLAST');
 
STEAM_POWER is text so needs ' ' which you are missing. Not sure if there are any other errors.

If you have not already enabled error logging, you should do so. While SQL files don't directly give quite as much info as XML files do in Database.log, there should have been a syntax or wrong column-name error being reported.

whoward69's enable error logging tutorial
 
Last edited:
Thank you very much.
I'm going to correct this and enable error logging.

Edit: That was it, thanks a lot Lee. :D
 
Last edited:
Welp, I tried to make my own code to make my civ get +2 influence with city state if you have a PoP with them but that didnt end well... I knew for sure it wouldnt work the first time ,so may I ask you guys if you could tell me what is wrong or if there is nothing to keep ( probably the case XD) to point me where I could find specific lua syntax for civ 5 if there is any out there... Thanks in advance.

Code:
function SMH_RUSSIAN_FEDERATION_PlayerDoTurn (playerID)
   local pPlayer = Players[iPlayer]
    if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_SMH_RUSSIAN_FEDERATION and pPlayer:IsAlive()) and
       if (otherPlayer:IsAlive() and otherPlayer:IsMinorCiv()) do
           for city in otherPlayer:Cities() do
           if IsProtectedByMajor(PlayerID activePlayer) then
                  otherPlayer:ChangeMinorCivFriendshipWithMajor(playerID, 5)  
               end
           end                  
       end
   end
end
GameEvents.PlayerDoTurn.Add(SMH_RUSSIAN_FEDERATION_PlayerDoTurn)
 
Last edited:
This
Code:
local pPlayer = Players[iPlayer]
returns a value of nil because you have defined the passed player ID variable as playerID here
Code:
function SMH_RUSSIAN_FEDERATION_PlayerDoTurn (playerID)
This is incorrect syntax
Code:
if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_SMH_RUSSIAN_FEDERATION and pPlayer:IsAlive()) and
lua is expecting another condition after the word and on this line followed by a then to terminate the condition line.

--------------------------------------------------------------------

do cannot be used in a conditional line (conditional lines start with if). For proper syntax of a conditional line you would need as
Code:
if (otherPlayer:IsAlive() and otherPlayer:IsMinorCiv()) then
but you have additional methodology errors which will still result in a syntax error for this particular bit of code.

--------------------------------------------------------------------

If I understand correctly what you want to do, you would need as

Code:
function SMH_RUSSIAN_FEDERATION_PlayerDoTurn(playerID)
	local pPlayer = Players[playerID]
	if (pPlayer:GetCivilizationType() == GameInfoTypes.CIVILIZATION_SMH_RUSSIAN_FEDERATION and pPlayer:IsAlive()) then
		for iOtherPlayer = (GameDefines.MAX_MAJOR_CIVS),(GameDefines.MAX_PLAYERS - 2) do
			local otherPlayer = Players[iOtherPlayer]
			if otherPlayer:IsAlive() then
				for city in otherPlayer:Cities() do
					if otherPlayer:IsProtectedByMajor(playerID) then
						otherPlayer:ChangeMinorCivFriendshipWithMajor(playerID, 5)  
					end
				end
			end
		end               
	end
end
GameEvents.PlayerDoTurn.Add(SMH_RUSSIAN_FEDERATION_PlayerDoTurn)
This chunk makes an lua "for" loop through all city-state players:
Code:
for iOtherPlayer = (GameDefines.MAX_MAJOR_CIVS),(GameDefines.MAX_PLAYERS - 2) do
	----stuff happens
end
  • "GameDefines.MAX_MAJOR_CIVS" is a static pre-defined value.
  • But player ID #'s within the game actually start with # "0"
  • Major Civs are listed first, so we know that any player ID# that is equal to or greater than the value for "GameDefines.MAX_MAJOR_CIVS" is either a city-state or the barbs.
  • Barbs are always the highest valid player # (#63 if you want to hard-code the barb player ID # for some reason).
  • Since we don't want to worry about the barbs, and we need to account for the fact that player ID's begin with "0", we subtract "2" from "GameDefines.MAX_PLAYERS" in order to tell lua which player ID# to terminate the loop on.

This line creates a temporary object variable for each player the loop "handles" in turn and that is only valid within the for-loop
Code:
local otherPlayer = Players[iOtherPlayer]

We then use this temporary variable called otherPlayer to check whether the player is alive, if it is protected by the major player whose ID# is contained within variable playerID, and then increase the influence amount for playerID by a value of "5" for each city the city-state owns.

There really isn't a complete guide (video or otherwise) that I know of for lua for civ5. @bane_ wrote a partial introductory tutorial to lua in civ5 that is in the tutorials and references forum.
 
Thanks! made everything aclrearer with the syntax, and I'll also check that tutorial.
 
Top Bottom