1) Not sure what you mean, but these entries appear under the 'Policies' tab in the civilopedia.
2) The 'Allows purchasing of Great Engineers upon entering the industrial era' from the Tradition finisher looks like it might almost do what you want, though I couldn't find how Firaxis coded this... (maybe it's hardcoded?). Next way I could think of is to add a 'fake spaceship part' that costs faith but cannot be produced (similar to how missionaries work), and use Lua and GameEvents.PlayerCanTrain(...). I'm not sure how this GameEvent interacts with (faith) purchasing though, so that's something you'd have to test. Then, once the fake spaceship spawns, replace it by the normal spaceship unit.
3) I don't get what you mean by +1 minimum SS influence level? Is it City State influence? If yes, that'd require use of dummy policies (the Patronage branch provides policies that raise this minimum level for example)
For the question in your first post, find out which .dds files these icons are taken from. Then, in your own mod, add a .dds file with the same name as the name of the icons you want to replace and set VFS=true for that file. Your new .dds file will replace the old one now.
See the Lua Reference Vault for an example (it's all the way down)2. It's too complex for me right now) May be sometime later on
It's a Lua-intensive method (and only works as the buildings have a global effect as policies are global too!), but it works.3. Yes, City-States. It was my typo. I don't understand how to merge building construction and dummy policy(( May be you could provide me some example? The goal is: every time certain building appears in city, minimum influence level to all CS raised by 1 point. +4 for four buildings in four cities and so on
-- RKT_Mon_UA
-- Author: Troller001
-- DateCreated: 12/21/2016 9:30:44 PM
--------------------------------------------------------------
print("RKT_Mon_UA.lua was loaded!");
--Allows the UA of Monaco to function
--Know bug: The culture gained from the UA does not show up in the toppanel.
--Bonus UA Tourism is applied up to a maximum of 255 Tourism (which corresponds to 2550 GPT)
--Up to a maximum of 63 Great People can be Maintenance Free
local iMon = GameInfoTypes.CIVILIZATION_RKT_MONACO;
--snip
local tFreeGP = {GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_1,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_2,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_4,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_8,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_16,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_32}
local tFreeGPDummy = {GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_1,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_2,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_4,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_8,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_16,GameInfoTypes.POLICY_RKT_NO_MAINTENANCE_DUMMY_32}
function CalculateMonUA(iPlayer)
local pPlayer = Players[iPlayer];
if pPlayer:GetCivilizationType() == iMon then
print("-------------UA: Playground of the Rich and Famous-------------------")
--snip
UpdateFreeGPPolicies(iPlayer);
--snip
print("-------------UA check done ------------------------------------------");
end
end
--snip
function UpdateFreeGPPolicies(iPlayer)
local iNumGreatPeople = CountGreatPersonType(iPlayer,-1)
SetFreeGPPolicies(iPlayer,iNumGreatPeople);
end
function SetFreeGPPolicies(iPlayer,iNumGreatPeople)
print("--------------Setting appropriate dummy policies for GP--------------")
local pPlayer = Players[iPlayer]
local tNumGreatPeople = toBits(iNumGreatPeople);
for i=1,6,1 do
print("Policy "..i.." set to: "..tNumGreatPeople[i])
print("Dummy Policy "..i.." set to: "..math.abs(tNumGreatPeople[i]-1))
if tNumGreatPeople[i]==0 then
pPlayer:SetHasPolicy(tFreeGP[i], false)
pPlayer:SetHasPolicy(tFreeGPDummy[i], true)
--in order for the 'policy swap trick' to work, a policy needs to be set to 'false'
--FIRST; it won't work the other way around (this prevents policy costs from increasing
--when swapping (or setting and unsetting) dummy policies)
else
pPlayer:SetHasPolicy(tFreeGPDummy[i], false)
pPlayer:SetHasPolicy(tFreeGP[i], true)
end
end
print("--------------Policy Update Done-------------------------------------");
end
function CheckMonacoGPChange(iPlayer,iUnit,_,_,_,bDelay)
--only execute once (bDelay prevents this code from firing twice)
if not bDelay then
local pPlayer = Players[iPlayer];
if pPlayer:GetCivilizationType() == iMon then
local pUnit = pPlayer:GetUnitByID(iUnit);
if pUnit:IsGreatPerson() then
print("A Monacon Great Person was expended or killed!");
local iNumGreatPeople = CountGreatPersonType(iPlayer,-1)
print((iNumGreatPeople-1).." Great People are sent to 'SetFreeGPPolicies'. ("..iNumGreatPeople.." were actually counted)");
SetFreeGPPolicies(iPlayer,iNumGreatPeople-1);
-- '-1' since CountGreatPersonType also counts the Great Person that just died!
end
end
end
end
function CheckMonacoGPSpawn(iPlayer, iUnit)
local pPlayer = Players[iPlayer];
if pPlayer:GetCivilizationType() == iMon then
local pUnit = pPlayer:GetUnitByID(iUnit);
if pUnit:IsGreatPerson() then
print("A Monacon Great Person Spawned! (or embarked, or upgraded, or sth else, but that doesn't matter anyways for this function!");
local iNumGreatPeople = CountGreatPersonType(iPlayer,-1)
SetFreeGPPolicies(iPlayer,iNumGreatPeople);
end
end
end
--for the GameEvents check the bottom of this file
-------------------
--counts all Great People with a specific type; Use -1 to count all Great People regardless of type
function CountGreatPersonType(iPlayer,iGPType)
local pPlayer = Players[iPlayer];
local iNumGreatPeople = 0;
for pUnit in pPlayer:Units() do
if iGPType == -1 then
if pUnit:IsGreatPerson() then
iNumGreatPeople = iNumGreatPeople + 1;
end
else
if pUnit:GetUnitType() == iGPType then
iNumGreatPeople = iNumGreatPeople + 1;
end
end
end
print(pPlayer:GetName().."("..iPlayer..") currently has "..iNumGreatPeople.." Great People alive in the empire");
return iNumGreatPeople;
end
--grants the initial dummy policies (used for maintenance free great people) to
--every player, so that they still start with the same scores
function GrantInitialDummies()
print("------------Distributing Dummy Policies-------------")
for iPlayer = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local pPlayer = Players[iPlayer]
--if the player exists, i.e. if the player is currently active/in the game
if pPlayer ~= nil then
if pPlayer:IsEverAlive() then
--execute once for each of the 'bit'-policies
for i=1,6,1 do
--the 'free policy trick' so that policy cost does not increase when granting dummy policies
pPlayer:SetNumFreePolicies(1)
pPlayer:SetNumFreePolicies(0)
pPlayer:SetHasPolicy(tFreeGPDummy[i], true)
end
print("Dummy (non-buffing) Policies given to "..pPlayer:GetName())
end
end
end
print("----------------------------------------")
end
function toBits(num)--UltimatePotato's toBits
-- returns a table of bits, least significant first.
t={} -- will contain the bits
while num>0 do
local rest=math.fmod(num,2)
t[#t+1]=rest
num=(num-rest)/2
end
for i=1,8,1 do
if(t[i]==nil)then
t[i]=0
end
end
return t
end
--whoward's IsCivInPlay
function IsCivInPlay(iCivType)
for iSlot = 0, GameDefines.MAX_MAJOR_CIVS-1, 1 do
local iSlotStatus = PreGame.GetSlotStatus(iSlot)
if (iSlotStatus == SlotStatus.SS_TAKEN or iSlotStatus == SlotStatus.SS_COMPUTER) then
if (PreGame.GetCivilization(iSlot) == iCivType) then
return true
end
end
end
return false
end
----------------------
if IsCivInPlay(iMon) then
print("Monaco is in play!");
GrantInitialDummies();
GameEvents.PlayerDoTurn.Add(CalculateMonUA);
GameEvents.UnitPrekill.Add(CheckMonacoGPChange)
Events.SerialEventUnitCreated.Add(CheckMonacoGPSpawn)
end
itemInstance.CultureVictory:SetHide(true);
itemInstance.DiplomaticVictory:SetHide(true);
itemInstance.DominationVictory:SetHide(true);
itemInstance.ScienceVictory:SetHide(true);
for _, victoryControl in ipairs(ideology.VictoryTypes) do
print(victoryControl);
itemInstance[victoryControl]:SetHide(false);
end
--[..]SNIPPED[..]
local ideologies = {
{
PolicyBranchType = "POLICY_BRANCH_AUTOCRACY",
VictoryTypes = {"CultureVictory", "DiplomaticVictory", "DominationVictory", "ReligionVictory"}, --EDIT: Relgion victory recommendation added.
Image = "SocialPoliciesAutocracy.dds",
ImageOffsetX = 0,
ImageOffsetY = 20,
},
{
PolicyBranchType = "POLICY_BRANCH_FREEDOM",
VictoryTypes = {"CultureVictory", "DiplomaticVictory", "ScienceVictory", "EconomicVictory"}, --EDIT: Economic Victory recommendation added
Image = "SocialPoliciesFreedom.dds",
ImageOffsetX = 0,
ImageOffsetY = 0,
},
{
PolicyBranchType = "POLICY_BRANCH_ORDER",
VictoryTypes = {"CultureVictory", "DominationVictory", "ScienceVictory"},
Image = "SocialPoliciesOrder.dds",
ImageOffsetX = 0,
ImageOffsetY = 0,
}
}
--[..]SNIPPED[..]
itemInstance.CultureVictory:SetHide(true);
itemInstance.DiplomaticVictory:SetHide(true);
itemInstance.DominationVictory:SetHide(true);
itemInstance.ScienceVictory:SetHide(true);
itemInstance.ReligionVictory:SetHide(true); --EDIT: hide the religion icon by default
itemInstance.EconomicVictory:SetHide(true); --EDIT: hide the economic icon by default
for _, victoryControl in ipairs(ideology.VictoryTypes) do
print(victoryControl);
itemInstance[victoryControl]:SetHide(false);
end
--[..]SNIPPED[..]
It's packed in one of the .fpk files. Here's how to actually get the .fpk files and how to unpack them:5. Where could I find VictoryConditions_64_Shared.dds ? Seems like it is in some archive, but where?
If you post the issues here I'll see what I can do. (Also depends on how 'clean' Runeless's code is, as I won't dig through giant piles of spaghetti; I have my own mods for that! )So, Troller0001, if you are so skilled in modding, could you please help me to fix two little (realy!) mods? I can't find its author for about a month (he seem to be off more than a year ago). His name is RuNeLess and his mods are very good, but have some bugs. And I don't skilled enough to fix them)
function Tokata_FundamentalismAdoptPolicy(playerID, policyID)
local pPlayer = Players[playerID]
--snip (other policy)
-- Pentecost
if (policyID == GameInfo.Policies["POLICY_PENTECOST"].ID) then
print("CheckpointA")
for plotLoop = 0, Map.GetNumPlots() - 1, 1 do
local pPlot = Map.GetPlotByIndex(plotLoop)
local pOwner = Players[pPlot:GetOwner()]
if (pOwner == pPlayer) then
print("CheckpointB")
if (pPlot:GetImprovementType() == GameInfoTypes["IMPROVEMENT_HOLY_SITE"]) then
local bUnit = false
if (pPlayer:IsHuman()) then
local pUnit = pPlot:GetUnit(0)
if (pUnit ~= nil) then
if (pUnit:IsCombatUnit()) then
bUnit = true
pUnit:Kill()
end
end
else
bUnit = true
end
if (bUnit == true) then
-- Get random great person
local nRandom = math.random(0, 4)
local iGreatPerson = GameInfoTypes["UNIT_GREAT_GENERAL"]
local iUnitAI = UNITAI_GENERAL
if (nRandom == 0) then
iGreatPerson = GameInfoTypes["UNIT_ARTIST"]
iUnitAI = UNITAI_ARTIST
elseif (nRandom == 1) then
iGreatPerson = GameInfoTypes["UNIT_WRITER"]
iUnitAI = UNITAI_WRITER
elseif (nRandom == 2) then
iGreatPerson = GameInfoTypes["UNIT_MUSICIAN"]
iUnitAI = UNITAI_MUSICIAN
end
local NewUnit = pPlayer:InitUnit(iGreatPerson, pPlot:GetX(), pPlot:GetY(), iUnitAI, DirectionTypes.DIRECTION_WEST)
-- NewUnit:JumpToNearestValidPlot()
-- Send Notification
Tokata_FundamentalismGreatPersonNotification(pPlayer, iGreatPerson, pPlot)
end
end
end
end
end
--snipped comment
end
GameEvents.PlayerAdoptPolicy.Add(Tokata_FundamentalismAdoptPolicy)
--snipped code
function Tokata_FundamentalismGreatPersonNotification(pPlayer, iGreatPerson, pPlot)
local nameGreatPerson = GameInfo.Units[iGreatPerson].Description
local pCity = pPlot:GetPlotCity()
if (pCity ~= nil) then
local nameCity = pCity:GetName()
local strGreatPerson = Locale.ConvertTextKey("TXT_KEY_TOKATA_FUNDAMENTALISM_GREAT_PERSON_A_TEXT", nameGreatPerson, nameCity)
else
local strGreatPerson = Locale.ConvertTextKey("TXT_KEY_TOKATA_FUNDAMENTALISM_GREAT_PERSON_B_TEXT", nameGreatPerson)
end
local strGreatPersonHeading = Locale.ConvertTextKey("TXT_KEY_TOKATA_FUNDAMENTALISM_GREAT_PERSON_HEADING")
pPlayer:AddNotification(NotificationTypes.NOTIFICATION_GENERICkk, strGreatPerson, strGreatPersonHeading, pPlot:GetX(), pPlot:GetY())
end
------------------------------------------------------------------------------------------------------
-- When player adopt a policy
------------------------------------------------------------------------------------------------------
--local variables added by Troller0001
local iPentecost = GameInfoTypes.POLICY_PENTECOST;
local iReligiousArt = GameInfoTypes.POLICY_RELIGIOUS_ART;
local tGreatPeople = {GameInfoTypes.UNIT_GREAT_GENERAL, GameInfoTypes.UNIT_ARTIST,GameInfoTypes.UNIT_WRITER,GameInfoTypes.UNIT_MUSICIAN}
local iHolySite = GameInfoTypes.IMPROVEMENT_HOLY_SITE;
--Function was Fixed and Edited by Troller0001 (with regards to the Pentecost Policy)
function Tokata_FundamentalismAdoptPolicy(iPlayer, iPolicy)
local pPlayer = Players[iPlayer];
if (iPolicy == iReligiousArt) then
-- Religious Art
Tokata_FundamentalismReligiousArt(iPlayer); --I did not check this function for bugs/issues
elseif (iPolicy == iPentecost) then
--pentecost
print("Pentecost adopted")
--loop through all of the player's units
for pUnit in pPlayer:Units() do
local pPlot = pUnit:GetPlot();
if pPlot:GetOwner() == iPlayer and pPlot:GetImprovementType() == iHolySite then
--plot is owned by the player who just adopted the policy AND the plot contained a Holy Site
print("Unit was in player terrritory on a Holy Site")
if pUnit:IsCombatUnit() then
print("Unit was not a civilian unit; killing it off and replacing it...");
pUnit:Kill();
--select a random unit from the table (units can simply be added and removed to it without editing this statement)
local iRandomUnit = tGreatPeople[Game.Rand(#tGreatPeople,"")+1];
--Game.Rand(value,msg) chooses an integer number between 0 and value-1.
local pNewUnit = pPlayer:InitUnit(iRandomUnit, pPlot:GetX(), pPlot:GetY());
print("Unit was spawned!");
Tokata_FundamentalismGreatPersonNotification(pPlayer, iRandomUnit, pPlot);
end
end
end
end
end
GameEvents.PlayerAdoptPolicy.Add(Tokata_FundamentalismAdoptPolicy)
It's a level 3 Tenet of an ideology that was added, so neither an opener nor a finisherPlayerAdoptPolicy doesn't fire for opening a Policy Branch nor as I recall for the Policy Branch "finisher" being given. Which may be the issue with the code not seeming to work for the POLICY_PENTECOST, if it is either an opener or a finisher.