There is some non-working code in Debug/Player.ltp that suggests this is how to declare war:
However, not only does this not work but it obviously can't work since wars are now typed (surprise, holy, etc.).
UI/Popups/DeclareWarPopup.lua has the following:
Unfortunately it looks like you need to also call something like:
The problem is that I don't see any way to get the session ID, since RequestSession just returns a boolean.
Having hunted through the rest of the Lua code, I don't see any other way to trigger a war between two civs.
Code:
Player1:GetDiplomacy():SetAtWarWith(Player2:GetID(), true);
However, not only does this not work but it obviously can't work since wars are now typed (surprise, holy, etc.).
UI/Popups/DeclareWarPopup.lua has the following:
Code:
DiplomacyManager.RequestSession(attacker, defender, "DECLARE_SURPRISE_WAR");
Unfortunately it looks like you need to also call something like:
Code:
DiplomacyManager.AddResponse(sessionID, defender, responseType);
The problem is that I don't see any way to get the session ID, since RequestSession just returns a boolean.
Having hunted through the rest of the Lua code, I don't see any other way to trigger a war between two civs.