LAU - Help with Diplomacy for Scenarios

sman1975

Emperor
Joined
Aug 27, 2016
Messages
1,376
Location
Dallas, TX
Hello, I'm working on an historical scenario, based on World War 1 - with several playable civs representing the great and not-so-great powers in Europe.

Obviously, I need to some "alliances" between those civs. I've been using the 'GetScenarioDiploModifier' statement in LUA, but am getting mixed results.

Here is the code:

Code:
--==============================================================================================================================================
--
--        Starting Diplo Relations Functions

    
GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == FRANCE and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == FRANCE)) then   
        print("Adjusting relations for France-Germany")
        return 100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier2.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == UNITEDKINGDOM and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == UNITEDKINGDOM)) then   
        print("Adjusting relations for UK-Germany")       
        return 100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier3.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == RUSSIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == RUSSIA)) then   
        print("Adjusting relations for Russia-Germany")       
        return 50
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier4.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == AUSTRIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == AUSTRIA)) then   
        print("Adjusting relations for Austria-Germany")       
        return -100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier5.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == AMERICA and eCiv2 == FRANCE) or (eCiv1 == FRANCE and eCiv2 == AMERICA)) then   
        print("Adjusting relations for America-France")       
        return -100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier6.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == AMERICA and eCiv2 == UNITEDKINGDOM) or (eCiv1 == UNITEDKINGDOM and eCiv2 == AMERICA)) then   
        print("Adjusting relations for America-UK")       
        return -100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier7.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == AUSTRIA and eCiv2 == SERBIA) or (eCiv1 == SERBIA and eCiv2 == AUSTRIA)) then   
        print("Adjusting relations for Austria-Serbia")       
        return 100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier8.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == ITALY and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == ITALY)) then   
        print("Adjusting relations for Italy-Germany")       
        return -25
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier9.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == BULGARIA and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == BULGARIA)) then   
        print("Adjusting relations for Ottoman-Bulgaria")       
        return 25
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier10.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == ROMANIA and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == ROMANIA)) then   
        print("Adjusting relations for Ottoman-Romania")       
        return 25
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier11.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == GREECE and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == GREECE)) then   
        print("Adjusting relations for Ottoman-Greece")       
        return 25
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier12.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == UNITEDKINGDOM and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == UNITEDKINGDOM)) then   
        print("Adjusting relations for Ottoman-UK")       
        return 50
    else
        return 0
    end
end)


GameEvents.GetScenarioDiploModifier13.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == AUSTRIA and eCiv2 == RUSSIA) or (eCiv1 == RUSSIA and eCiv2 == AUSTRIA)) then   
        print("Adjusting relations for Austria-Russia")       
        return 100
    else
        return 0
    end
end)

GameEvents.GetScenarioDiploModifier14.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()
    if ((eCiv1 == FRANCE and eCiv2 == UNITEDKINGDOM) or (eCiv1 == UNITEDKINGDOM and eCiv2 == FRANCE)) then   
        print("Adjusting relations for France-UK")
        return -100
    else
        return 0
    end
end)


The "Civ names" (such as AMERICA and UNITEDKINGDOM) are generated like this in the global file:

Code:
AMERICA =        GameInfoTypes["CIVILIZATION_GW_AMERICA"]   


UNITEDKINGDOM = GameInfoTypes["CIVILIZATION_GW_ENGLAND"]


From looking at the LUA log, here's what I see (over the course of a few game turns):

InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany
InitDiplomacy: Adjusting relations for France-Germany
InitDiplomacy: Adjusting relations for UK-Germany
InitDiplomacy: Adjusting relations for Russia-Germany


These specific relationships are about the only ones I'm seeing in the log - representing 3 of the 14 different relationships, and fire frequently during the game. I never see the other relationships fire at all - especially the ones where the return value is negative (i.e. reinforcing a friendly relationship).

Appreciate it if anyone can advise if I'm using these correctly, or if as usual I'm off in left field somewhere...

Thanks!
 
D'oh! That would explain it, now wouldn't it...? :wallbash:

Thanks @Enginseer! Sorry, didn't realize there was a hard limit. From the looks of things, the post you linked describes creating a custom event to implement more than 3 diplomatic relations, but it requires one of those DLLs to actually work?

Well, let's say I'm not always that ambitious (i.e. capable...) in modding, are there any other ways (LUA, etc.) to "nudge" civs to either liking each other (or not) without using a DLL?
 
No. Not that I know of, you could just use a lot of if statements inside those GetScenarioDiploModifier functions. Assuming you make a generic text... I believe? (like just say "we just hate each other" or something like that. I'm not sure.
 
Hmmmm.... Well, since we're dealing with 2 basic alliances, how do you think this might work?

Code:
GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)
    local eCiv1 = Players[ePlayer1]:GetCivilizationType()
    local eCiv2 = Players[ePlayer2]:GetCivilizationType()

if   ((eCiv1 == FRANCE and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == FRANCE))  or
     ((eCiv1 == UNITEDKINGDOM and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == UNITEDKINGDOM))  or
     ((eCiv1 == RUSSIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == RUSSIA))  then  
       
        print("Adjusting relations for Entente-Triple Alliance...")
        return 100

    else

        return 0

    end
end)
 
1st define all your variables for FRANCE, UNITEDKINGDOM, etc., as you are already doing. Then:
Code:
local tEntenteMajor = { [FRANCE] = true,
	[UNITEDKINGDOM] = true,
	[RUSSIA] = true,
	[AMERICA] = true }
local tEntenteMinor = { [SERBIA] = { [AUSTRIA] = 100 },
	[ITALY] = { [GERMANY] = -25},
	[GREECE] = { [OTTOMANS] = 25 },
	[ROMANIA] = { [OTTOMANS] = 25 },
	[BULGARIA] = { [OTTOMANS] = 25 } }
local tAxisMajor = { [GERMANY] = true,
	[AUSTRIA] = true,
	[OTTOMANS] = true }


GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)
	local eCiv1 = Players[ePlayer1]:GetCivilizationType()
	local eCiv2 = Players[ePlayer2]:GetCivilizationType()

	if (tEntenteMajor[eCiv1] and tAxisMajor[eCiv2]) or (tEntenteMajor[eCiv2] and tAxisMajor[eCiv1]) then
		if ((eCiv1 == UNITEDKINGDOM and eCiv2 == OTTOMANS) or (eCiv1 == OTTOMANS and eCiv2 == UNITEDKINGDOM)) then
			return 50
		end
		if ((eCiv1 == RUSSIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == RUSSIA)) then
			return 50
		end
		return 100
	end
	if (tEntenteMajor[eCiv1] and tEntenteMajor[eCiv2]) then
		return -100
	end
	if (tAxisMajor[eCiv1] and tAxisMajor[eCiv2]) then
		if (eCiv1 ~= OTTOMANS) and (eCiv2 ~= OTTOMANS) then
			return -100
		end
		--what to do for Ottomans re Germany/Austria ?
	end
	if (tEntenteMinor[eCiv1] or tEntenteMinor[eCiv2]) then
		if tEntenteMinor[eCiv1] then
			if tEntenteMinor[eCiv1][eCiv2] then
				return tEntenteMinor[eCiv1][eCiv2]
			end
		else
			if tEntenteMinor[eCiv2][eCiv1] then
				return tEntenteMinor[eCiv2][eCiv1]
			end
		end
	end
        return 0
end)
It's the exceptions that kill you.
 
@LeeS - man, you always know what's going on! :worship:

I am looking over the code you sent, but am thinking about a slight adjustment. As the WW1 Scenario has some complex (at least initially) relationships with 13 playable civs with evolving relationships during the game, I was thinking about using all 3 of the GetScenarioDiploModifier functions. One for Major Civs, one for minor civs (not city states, however), and the last for neutrals.

I've been looking over a vast library of mods with AgentRansack (Lord, how did I ever mod before finding this!?!?!?), and have seen some interesting usages.

One of the thing that intrigued me the most - was adding conditionals within the various functions based on specific game turns. So, I could actually change the return value for, say Italy in 1914 (vis-a-vis Germany) but return a different value for 1916.

I suppose the bottom line is, as far as the function is concerned: you have 2 pieces of data coming in, representing 2 specific major civs. You can do almost any manipulation you'd like inside the function, but you have to return a single value that represents the current "quality" of the relationship at that moment in time. So, you can get quite sophisticated inside the function, as long as the logic leads you to the proper return value...

This will take a bit of time to work out right, but at least at the end of the effort, I'll have a much better "acting" mod....

Now, if I could only find a "trench" terrain improvement.... Maybe a recolored version of Bouncymischa's Future Worlds Gray Goo...

Thanks again, you're AWESOME!


P.s. Send me a PayPal link!!!!! :lol:
 
Last edited:
@LeeS - based on your code, I made a few changes to fit a little better in the overall scenario design. I still plan on expanding it to adjust to the evolving diplomatic situation, but the initial version is working pretty well - appreciate your design!

Code:
-- Initial Diplomacy
-- Author: sman
-- DateCreated: 11/17/18 10:20:18 PM
--------------------------------------------------------------

--==============================================================================================================================================
--
--       InitDiplomacy - set up relationships between the various civs - if they have one...
--
--       Key:   Ally: -80   Friend: -40       Favorable: -15       Neutral: -14..14       Competitor: 14       Enemy: 40       Unforgivable: 80

-- Bulgaria likes axis, romania, monte, and greece like allies

include("WAW_GW_Globals.lua")

local tEntente =  { [FRANCE] = true,                                                       -- Major civs different, as their numbers don't change
                   [UNITEDKINGDOM] = true,
                   [RUSSIA] = true }

local tAxis   =    {   [GERMANY] = true,
                   [AUSTRIA] = true }

local tNeutrals = {   [AMERICA] =       { [FRANCE] = -25 },                                       -- Minor/neutral values can change during scenario; initial values
                   [AMERICA] =       { [UNITEDKINGDOM] = -25 },
                   [OTTOMANS] =   { [AUSTRIA] = -50 },
                   [OTTOMANS] =   { [GERMANY] = -50 },
                   [OTTOMANS] =   { [UNITEDKINGDOM] = 50 },
                   [SERBIA] =       { [AUSTRIA] = 100 },
                   [SERBIA] =       { [BULGARIA] = 5 },
                   [ITALY] =       { [GERMANY] = -25},
                   [GREECE] =       { [OTTOMANS] = 25 },
                   [ROMANIA] =       { [OTTOMANS] = 25 },
                   [BULGARIA] =   { [OTTOMANS] = 25 } }


--==============================================================================================================================================
--
--       Starting Diplo Relations Functions

GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)                       -- Major Powers Relationship
   local eCiv1 = Players[ePlayer1]:GetCivilizationType()
   local sCiv1Name = Players[ePlayer1]:GetCivilizationShortDescription()

   local eCiv2 = Players[ePlayer2]:GetCivilizationType()
   local sCiv2Name = Players[ePlayer2]:GetCivilizationShortDescription()

   local iReturnValue = 0
  
   -- Adjust the global relationship tables, based on passage of time (GT 0 = Jan 1914, GT 12 = Jan 1915, GT 24 = Jan 1916, GT 36 = Jan 1917, GT 48 = Jan 1918
   local iGameTurn = Game.GetGameTurn()

   if iGameTurn > 12 then                                                                   --
       local iItalyGermanyDelta = 0
       local iOttomanAxisDelta = -25  
       local iSerbiaBulgariaDelta = 15  

       if iGameTurn > 24 then
           iItalyGermanyDelta = 25
           iOttomanAxisDelta = 0
           iSerbiaBulgariaDelta = 25
       end
      
       tNeutrals[ITALY][GERMANY] = iItalyGermanyDelta
      
       tNeutrals[OTTOMANS][AUSTRIA] = iOttomanAxisDelta
       tNeutrals[OTTOMANS][GERMANY] = iOttomanAxisDelta

       tNeutrals[SERBIA][BULGARIA] = iSerbiaBulgariaDelta

   end
  

   -- Implement relationships, based on the current contents of the global tables
   if (tEntente[eCiv1] and tAxis[eCiv2]) or (tEntente[eCiv2] and tAxis[eCiv1]) then       -- Set for MAJOR powers: 1 each of major sides, then...  
       if ((eCiv1 == RUSSIA and eCiv2 == GERMANY) or (eCiv1 == GERMANY and eCiv2 == RUSSIA)) then   -- Russia doesn't hate Germany as much as France or UK          
           iReturnValue =  50                                                               -- RetVal 50 = major hate
       else      
           iReturnValue = 100                                                               -- RetVal 100 = existential hate:  FRA/UK - GER/AUS
       end
   end

   if (tEntente[eCiv1] and tEntente[eCiv2]) then
       iReturnValue = -100                                                                   -- RetVal -100 = blood bros forever
   end

   if (tAxis[eCiv1] and tAxis[eCiv2]) then
       iReturnValue = -100
   end
  
   -- Process the relationships of the "Minor" table, if there is a match...
   if (tNeutrals[eCiv1] or tNeutrals[eCiv2]) then                                           -- Is there a defined relationship for eCiv 1 or 2?              
       if tNeutrals[eCiv1] then                                                           -- Is there a defined relationship for eCiv1?
           if tNeutrals[eCiv1][eCiv2] then                                                   -- Is there a defined relationship for eCiv2?
               iReturnValue = tNeutrals[eCiv1][eCiv2]                                       -- If so, return the current relationship value
           end
       else
           if tNeutrals[eCiv2][eCiv1] then                                                   -- Is there a defined relationship for eCiv2?
               iReturnValue = tNeutrals[eCiv2][eCiv1]                                       -- If so, return the current relationship value
           end
       end
   end

   dPrint("InitDiplo. " .. sCiv1Name .. " <-> " .. sCiv2Name .. "     Relationship: " .. iReturnValue .. "    (Negative numbers = Positive relationship)")
  
    return iReturnValue                                                                       -- If the actual relationship is none of the previously defined relationships, then return 0

end)

There just one little area that I still need to look more closely:
- The OTTOMANS & AUSTRIA/GERMANY comparisons both return 0, not -50 - but ITALY & GERMANY does correctly return -25 (need to add steps in the last big IF tNeutrals block)

Still working it, but can't thank you enough for such good suggestions!
 
Last edited:
Maybe because it's Ottoman and not Ottomans? Not sure how you're getting the civ types, but that's how CIVILIZATION_OTTOMAN is written.
 
Code:
[OTTOMANS] =   { [UNITEDKINGDOM] = 50 },
This over-writes the previous values you've entered. You need
Code:
[OTTOMANS] =   { [AUSTRIA] = -50 , [GERMANY] = -50, [UNITEDKINGDOM] = 50 },
instead of these three lines
Code:
[OTTOMANS] =   { [AUSTRIA] = -50 },
[OTTOMANS] =   { [GERMANY] = -50 },
[OTTOMANS] =   { [UNITEDKINGDOM] = 50 },
"OTTOMANS" is a 'key' within the tNeutrals table. Its 'value' is another table. But as you are attempting to write the code you are attempting to create the same "OTTOMANS" key multiple times, which cannot be done. Serbia, etc., will demonstrate the same issue.

haven't looked at the rest of your re-draft, but you need to fix this misunderstanding on lua-table use first.

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

The other re-draft option is to set all relationships from one civ towards all others within one master table, regardless of whether they're neutral, axis, or entente.
 
D'oh! It's (kinda not) funny how it's so bleedin' obvious once someone points out the error....:crazyeye:

My fault, really, for trying to code before coffee.....

Thanks again, @LeeS - you are a blessing on this site!
 
Code:
local t1914Relations = {
	[AMERICA] = { [FRANCE] = -25, [UNITEDKINGDOM] = -25 },
	[UNITEDKINGDOM] = {  [AMERICA] = -25, [FRANCE] = -100, [RUSSIA] = -100, [GERMANY] = 100, [AUSTRIA] = 100 , [OTTOMANS] = 50},
	[FRANCE] = {  [AMERICA] = -25, [UNITEDKINGDOM] = -100, [RUSSIA] = -100, [GERMANY] = 100, [AUSTRIA] = 100 },
	[RUSSIA] = {  [UNITEDKINGDOM] = -100, [FRANCE] = -100, [GERMANY] = 50, [AUSTRIA] = 100 },
	[GERMANY] = {  [UNITEDKINGDOM] = 100, [FRANCE] = 100, [RUSSIA] = 50, [OTTOMANS] = -50, [AUSTRIA] = -100, [ITALY] = -25 },
	[AUSTRIA] = {  [UNITEDKINGDOM] = 100, [FRANCE] = 100, [RUSSIA] = 100, [OTTOMANS] = -50, [GERMANY] = -100, [SERBIA] = 100 },
	[SERBIA] = {  [BULGARIA] = 5, [AUSTRIA] = 100 },
	[OTTOMANS] = {  [UNITEDKINGDOM] = 50, [GERMANY] = -50, [AUSTRIA] = -50, [GREECE] = 25, [ROMANIA] = 25, [BULGARIA] = 25 },
	[GREECE] = {  [OTTOMANS] = 25 },
	[ROMANIA] = {  [OTTOMANS] = 25 },
	[BULGARIA] = {  [OTTOMANS] = 25, [SERBIA] = 5 },
	[ITALY] = {  [GERMANY] = -25 }
}

local t1916Relations = {
	[AMERICA] = { [FRANCE] = -25, [UNITEDKINGDOM] = -25 },
	[UNITEDKINGDOM] = {  [AMERICA] = -25, [FRANCE] = -100, [RUSSIA] = -100, [GERMANY] = 100, [AUSTRIA] = 100 , [OTTOMANS] = 50},
	[FRANCE] = {  [AMERICA] = -25, [UNITEDKINGDOM] = -100, [RUSSIA] = -100, [GERMANY] = 100, [AUSTRIA] = 100 },
	[RUSSIA] = {  [UNITEDKINGDOM] = -100, [FRANCE] = -100, [GERMANY] = 50, [AUSTRIA] = 100 },
	[GERMANY] = {  [UNITEDKINGDOM] = 100, [FRANCE] = 100, [RUSSIA] = 50, [OTTOMANS] = -50, [AUSTRIA] = -100, [ITALY] = -25 },
	[AUSTRIA] = {  [UNITEDKINGDOM] = 100, [FRANCE] = 100, [RUSSIA] = 100, [OTTOMANS] = -50, [GERMANY] = -100, [SERBIA] = 100 },
	[SERBIA] = {  [BULGARIA] = 5, [AUSTRIA] = 100 },
	[OTTOMANS] = {  [UNITEDKINGDOM] = 50, [GERMANY] = -50, [AUSTRIA] = -50, [GREECE] = 25, [ROMANIA] = 25, [BULGARIA] = 25 },
	[GREECE] = {  [OTTOMANS] = 25 },
	[ROMANIA] = {  [OTTOMANS] = 25 },
	[BULGARIA] = {  [OTTOMANS] = 25, [SERBIA] = 5 },
	[ITALY] = {  [GERMANY] = -25 }
}

GameEvents.GetScenarioDiploModifier1.Add(function(ePlayer1, ePlayer2)                       -- Major Powers Relationship
	local eCiv1 = Players[ePlayer1]:GetCivilizationType()
	local sCiv1Name = Players[ePlayer1]:GetCivilizationShortDescription()

	local eCiv2 = Players[ePlayer2]:GetCivilizationType()
	local sCiv2Name = Players[ePlayer2]:GetCivilizationShortDescription()

	local tTableToUse = t1914Relations
	if Game.GetGameTurn() >= 12 then
		tTableToUse = t1916Relations
	end
	if tTableToUse[eCiv1] then
		if tTableToUse[eCiv1][eCiv2] then
			print("Relations between " .. sCiv1Name .. " and " .. sCiv2Name .. " are not normal: returning " .. tTableToUse[eCiv1][eCiv2])
			return tTableToUse[eCiv1][eCiv2]
		end
	end
	print("Relations between " .. sCiv1Name .. " and " .. sCiv2Name .. " are normal: returning 0")
	return 0
end)
As written you have to 'mirror' the relationships in the table. So if Serbia and Austria hate each other by "100", there needs to be a mirrored relationship between the two in the table. You'd need to edit the 1916 Relationships table. And also double-check I did not miss anything in the 1914 table.

You can add more "date" tables as needed. I think you were also using a different set of values after turn 25. You would just need to add a different table for each different "milestone turn" and edit this part as needed:
Code:
	if Game.GetGameTurn() >= 12 then
		tTableToUse = t1916Relations
	end
The remainder of the function would not need to change.
 
Last edited:
Thanks for the last example, @LeeS - it works perfectly. You probably saved me 10 hours of work and the end product wouldn't have been nearly so elegant - or reliable!
 
Back
Top Bottom