Lua declaration of war?

skywalker

Waffle
Joined
Oct 3, 2001
Messages
317
Location
Virginia
There is some non-working code in Debug/Player.ltp that suggests this is how to declare war:

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.
 
Code:
kParams = {}
kParams.WarState = WarTypes.SURPRISE_WAR
DiplomacyManager.SendAction(playerID, player2ID, DiplomacyActionTypes.SET_WAR_STATE, kParams)
 
Top Bottom