Craig_Sutter
Deity
I am trying to mod in changing CS influence. My testing of the following code shows that it is working (printing GetMinorCivFriendshipWithMajor before and after the function shows the change), but the altered influence is not showing up when hovering over the city state.
The log... showing my print results. Notice the change from 0 to 100.
[8614.234] DiplomacyCS: Wiht
[8614.250] DiplomacyCS: Alfred
[8614.250] DiplomacyCS: 0
[8614.250] DiplomacyCS: 100
Ideally, I eventually want to set this so that every turn +1 is added to influence over the CS. This would essentially set up almost permanent alliances.
I'll work on that coding next.
Anyhow, I'm not certain what I am missing... maybe the change from 0 to 100 is just adding a number and not in influence, because something basic is wrong with the code.
The log... showing my print results. Notice the change from 0 to 100.
Spoiler :
[8614.234] DiplomacyCS: Wiht
[8614.250] DiplomacyCS: Alfred
[8614.250] DiplomacyCS: 0
[8614.250] DiplomacyCS: 100
Ideally, I eventually want to set this so that every turn +1 is added to influence over the CS. This would essentially set up almost permanent alliances.
I'll work on that coding next.
Anyhow, I'm not certain what I am missing... maybe the change from 0 to 100 is just adding a number and not in influence, because something basic is wrong with the code.
Code:
-- Lua Script2
-- Author: Craig and Nancy
-- DateCreated: 8/11/2012 9:40:39 PM
--------------------------------------------------------------
function SetCsFriendships()
if Game.GetGameTurn() == 0 then
print(">>>> Friendship");
local pWiht
local pWessex
local Wessex
for iPlayer=0, GameDefines.MAX_MAJOR_CIVS-1 do
local pWessex = Players[iPlayer]
if (pWessex:IsAlive()) then
if (GameInfo.Civilizations.CIVILIZATION_ENGLAND.ID == pWessex:GetCivilizationType()) then
Wessex = pWessex:GetCivilizationType()
for iWiht = GameDefines.MAX_MAJOR_CIVS, GameDefines.MAX_CIV_PLAYERS-2, 1 do
local pWiht = Players[iWiht]
if (pWiht:IsAlive()) then
if (GameInfo.MinorCivilizations.MINOR_CIV_WIHT.ID == pWiht:GetMinorCivType()) then
print(pWiht:GetName());
print(pWessex:GetName());
print(pWiht:GetMinorCivFriendshipWithMajor(Wessex))
pWiht:ChangeMinorCivFriendshipWithMajor(Wessex, 100 + pWiht:GetMinorCivFriendshipWithMajor(Wessex))
print(pWiht:GetMinorCivFriendshipWithMajor(Wessex))
end
end
end
end
end
end
end
end
Events.ActivePlayerTurnEnd.Add(SetCsFriendships)