LeeS
Imperator
Code in Spoiler assumes there is no modifier applied for user's chosen gamespeed.
This doesn't look like it would be really necessary but it might come in handy:
There are a few other threshold values defined in C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\assets\DLC\Expansion2\Gameplay\XML\AI\GlobalAIDefines.xml
This doesn't look like it would be really necessary but it might come in handy:
Code:
local iAlliesThreshold = GameDefines.FRIENDSHIP_THRESHOLD_ALLIES
Spoiler :
Code:
--When Player is Allied with Jomsvikings add 7 buildings to its capital.
--If Friends with Jomsvikings add only 2 buildings.
--If neither Friends nor Allies with Jomsvikings 0 buildings.
local iJomsvikingCiv = GameInfoTypes.MINOR_CIV_JOMSVIKING
local iFriendsThreshold = GameDefines.FRIENDSHIP_THRESHOLD_FRIENDS
local iAlliesThreshold = GameDefines.FRIENDSHIP_THRESHOLD_ALLIES
function MinorAllyChanged(iMinor, iMajor, bIsAlly, iOldFriendship, iNewFriendship)
print("MinorAllyChanged fired")
local pPlayer = Players[iMajor]
local pMinor = Players[iMinor]
if (iJomsvikingCiv == pMinor:GetMinorCivType()) then
print("MinorAllyChanged: iJomsvikingCiv == pMinor:GetMinorCivType()")
local pCity = pPlayer:GetCapitalCity()
if pCity ~= nil then
print("MinorAllyChanged: pPlayer:GetCapitalCity() ~= nil")
if bIsAlly then
print("MinorAllyChanged: bIsAlly is true", pPlayer:GetName(), "...is their new Ally")
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_JOMSVIKING_HALL"], 7);
print("We Are Allies With Jomsburg: 7 BUILDING_JOMSVIKING_HALL")
else
if iNewFriendship >= iFriendsThreshold then
print("MinorAllyChanged: iNewFriendship >= iFriendsThreshold", pPlayer:GetName(), "...is new Friend")
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_JOMSVIKING_HALL"], 2);
print("We Are Friends With Jomsburg: 2 BUILDING_JOMSVIKING_HALL")
else
print("MinorAllyChanged: bIsAlly is false, iNewFriendship < iFriendsThreshold, so ", pPlayer:GetName(), "... can no longer be their Ally or Friend")
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_JOMSVIKING_HALL"], 0);
print("We Are not Friends or Allies With Jomsburg: 0 BUILDING_JOMSVIKING_HALL")
end
end
end
end
end
function MinorFriendChanged(iMinor, iMajor, bIsFriend, iOldFriendship, iNewFriendship)
print("MinorFriendChanged fired")
local pPlayer = Players[iMajor]
local pMinor = Players[iMinor]
if (iJomsvikingCiv == pMinor:GetMinorCivType()) then
print("MinorFriendChanged: iJomsvikingCiv == pMinor:GetMinorCivType()")
local pCity = pPlayer:GetCapitalCity()
if pCity ~= nil then
print("MinorFriendChanged: pPlayer:GetCapitalCity() ~= nil")
if bIsFriend then
print("MinorFriendChanged: bIsFriend is true", pPlayer:GetName(), "...is their new Friend")
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_JOMSVIKING_HALL"], 2);
print("We Are Friends With Jomsburg: 2 BUILDING_JOMSVIKING_HALL")
else
print("MinorFriendChanged: bIsFriend is false, so ", pPlayer:GetName(), "...can no longer be their Friend")
pCity:SetNumRealBuilding(GameInfoTypes["BUILDING_JOMSVIKING_HALL"], 0);
print("We Are Not Friends With Jomsburg: 0 BUILDING_JOMSVIKING_HALL")
end
end
end
end
GameEvents.MinorAlliesChanged.Add(MinorAllyChanged);
GameEvents.MinorFriendsChanged.Add(MinorFriendChanged);