Skip to content

Diplomacy operation

A Diplomacy operation is one of two operation subtypes for diplomatic content: diplomacyactionoperation (the player initiates an action — appease, threaten, gift, etc.) or diplomacyeventoperation (the engine generates a diplomacy event from world state — relations change, faction milestone reached). Both extend the abstract operation parent shared with Boardingoperation.

Inheritance chain:

operation
├── boardingoperation
├── diplomacyactionoperation
└── diplomacyeventoperation

Diplomacy operations are managed by the vanilla diplomacy.xml framework (~4500 lines). Modders extending diplomacy work through this framework rather than the operation datatypes directly.

diplomacyactionoperation — player-initiated

Section titled “diplomacyactionoperation — player-initiated”

Plus inherited from operation: .starttime, .duration, .owner.

PropertyTypeDescription
.agententityThe agent NPC executing the action
.agentresultagentresultFinal state of the agent at conclusion
.action.idstringAction id (e.g. 'appease', 'threaten')
.action.namestringDisplay name
.action.descriptionstringLong description
.action.shortdescriptionstringShort description
.action.durationtimeBase duration
.action.giftwareGift ware (for appease-type actions)
.action.agent.experienceintRequired agent experience
.action.$<param>variousAction-specific parameters

Plus inherited from operation.

PropertyTypeDescription
.factionfactionFirst involved faction
.otherfactionfactionSecond involved faction
.sourcediplomacyactionoperationSource action that triggered this event (may be null)
.agententityAgent assigned to this event
.agentresultagentresultAgent state at conclusion
.event.idstringEvent id
.event.sourcestringSource action id (or null)
.event.namestringDisplay name
.event.descriptionstringLong description
.event.shortdescriptionstringShort description
.event.conclusiontextstringConclusion text
.event.durationtimeBase duration
.optiondiplomacyeventoperationoptionCurrently selected option
.outcomediplomacyeventoperationoptionFinal outcome option

diplomacyeventoperationoption (pseudo-type)

Section titled “diplomacyeventoperationoption (pseudo-type)”
PropertyTypeDescription
.existsboolOption exists
.idstringOption id
.resulttextstringText shown when this option is selected
.conclusiontextstringConclusion text
.weightintBase weight for selection as outcome
.relationfloatResulting relation if chosen
.agent.riskagentriskRisk to assigned agent
.cost.influenceintInfluence cost
.cost.moneymoneyMoney cost
.cost.wareswareamountlistWares to remove

”Detect a diplomacy action completing”

Section titled “”Detect a diplomacy action completing””

Diplomacy operations don’t have a dedicated event family; observe via the parent operation pattern (see diplomacy.xml for the framework). The conclusion typically signals back to the originating cue.

”Read an agent’s current diplomacy work”

Section titled “”Read an agent’s current diplomacy work””
<do_if value="@$Agent.diplomacy.ship">
<!-- agent has an assigned ship for diplomacy missions -->
</do_if>

The diplomacy.ship is on Ship and Entity — the diplomacy framework uses this for agent assignment.

  • Two distinct datatypes for “diplomacy”. diplomacyactionoperation (player-initiated) vs diplomacyeventoperation (engine-generated). Don’t conflate.
  • Vanilla diplomacy.xml is the canonical framework. ~4500 lines of MD covering the full UI flow. Modders extending diplomacy should work through this rather than reimplementing.
  • .option is what’s currently selected; .outcome is what was finally applied. They can differ if the agent / event resolver modifies the choice.
  • Costs are deducted at conclusion, not selection. .cost.money only leaves the player’s wallet when the event concludes. Mods that need to gate based on cost must check at conclusion event.
  • Agent risk is per-option. Different choices have different .agent.risk levels — high risk may kill the agent. Vanilla UX surfaces this.
  • DLC-gated content. Some diplomacy actions / events require specific DLCs (Tides of Avarice influence system). Check macro availability.
  • Diplomacy framework: Architectural overview Diplomacy systemdiplomacy.xml end-to-end pipeline (action selection → agent execution → event generation → outcome resolution).
  • Agent lifecycle: Architectural overview Diplomacy agents — recruitment, experience, risk, death.
  • Influence economy: Architectural overview Influence — Tides of Avarice resource that gates high-end diplomacy actions.