Results 1 to 8 of 8

Thread: diplomacy_mission: how to use

  1. #1
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default diplomacy_mission: how to use

    There exists this console command which gives an AI faction a diplomacy mission, effectively telling them to do something diplomacy-related:

    diplomacy_mission <ai_faction> <target_faction> <mission_type> <opt:mission_target>

    mission_type is the hurdle. I have not found anything anywhere explaining what values to use here. After some trial and error I think I have it...

    "trade" = trade rights
    "alliance" = alliance
    (others: see below)

    I spawned an AI faction diplomat near to my settlements/generals then used that command to ask for trade. Ask he did. Without that command he did not ask: he always walked out of my regions without doing anything, in multiple tests. When I tried again with "alliance" it worked as well: this time he asked for an alliance (and trade rights which I did not tell it to do this time - so the AI must have decided to add that offer).

    Of course, this only makes them offer/demand something. Whether another AI faction (target_faction) will choose to accept is another matter. To make it more likely would involve tinkering with descr_campaign_ai_db.xml, possibly using special ai_labels - temporarily switched-to with script - containing rules geared towards accepting such offers.

    Whether the mission has an expiry time or not I have no idea. In all of my tests the diplomat made the offer as soon as he could: during his next turn, or as soon as he could reach a character/settlement to talk to.

    Example:

    Code:
    monitor_event FactionTurnStart FactionIsLocal
    
      console_command diplomacy_mission france england alliance
    
    terminate_monitor
    end_monitor
    This will make france ask for an alliance with england, if france is AI, during france's turn. The monitor's event type and condition is just an example.

    Testing this in the Kingdoms Grand Campaign (playing as England) resulted in the france princess asking for alliance, trade rights and offering to marry my heir. (Again, the AI is throwing other offers into the bargain of its own accord.) Normally she never asks for these things: she always asks for trade rights only.

    Other options for mission_type?

    I initially tried "trade" because I was looking through kingdoms.exe for that word, hoping to find something like TRADE_RIGHTS, i.e. a hardcoded word relating to trade in the exe. It was there, in a line with DIPLOMATIC_ATTITUDE near its start, that I found TRADE. Trying that failed but using it in lowercase worked. ALLIANCE is also in that line.

    Others in that line which might work are:
    INFO - map info
    GIFT - I thought this might be give region/money but it's probably the "Gift" button which explains why it doesn't work
    BRIBE
    THREAT - accept or we will attack
    ATTACK - attack other faction
    ACCESS - military access
    NULLIFY_ALLIANCE - cancel alliance
    CEASEFIRE
    PROTECTORATE - be my vassal

    These types are also in diplomacy.txt, e.g. {DRT_ARABIC_ACCESS}.

    See the next post for some test results of these types...
    Last edited by Withwnar; March 01, 2014 at 05:10 AM.

  2. #2
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: diplomacy_mission: how to use

    Some work, some don't. Here is what I have found so far...

    trade - Trade Rights
    Works.

    alliance
    Works.

    If you need to script an alliance between two AI factions then that can be done directly instead. What diplomacy_mission does provide is a way to make the AI ask the player for an alliance, letting the player decide. That could be a nice touch instead of a scripted auto-alliance.

    info - Map Info
    Doesn't work. The log reports "err: invalid mission_type".

    gift
    Doesn't work. The log reports "err: invalid mission_type".

    It appears that this is the "Gift" button, in which case small wonder it does not work. If there is a type for "Give Region" and the give-money options then I have not found them.

    bribe
    Doesn't work. The log reports "err: invalid mission_type".

    threat - Accept or we will attack
    Doesn't work. The log reports "err: invalid mission_type".

    I don't see what use it would be on its own anyway. In conjunction with another demand, sure.

    attack - Attack another faction
    Doesn't seem to do anything. No log error but the diplomat simply walked off. Might need more testing. I only tried with "slave" as the mission_target.

    access - Military Access
    Works! Partly: so far I have only been able to demand access, not offer it.

    mission_target is the access-to faction. This...

    Code:
    console_command diplomacy_mission france milan access milan
    ...makes france demand Military Access on milan's regions.

    NOTE: the factions must be allied at the time of calling this script. Allying them after does not work, even if france has not had its turn yet (the turn in which they will make this demand).

    This does not work:

    Code:
    console_command diplomacy_mission france milan alliance
    console_command diplomacy_mission france milan access milan
    One might expect that it would ask for an alliance and demand military access in the same diplomacy request. Not so: it asks for alliance only. (I don't know if multiple diplomacy_mission's can be used together like this at all. I haven't found any combination that works together so far.)

    Also, this does not work:

    Code:
    console_command diplomacy_mission france milan access france
    By rights it should be making an offer of military access to milan: giving milan M.A. on france's regions. No log error but the diplomat, despite performing his diplomacy animation, does not bring up the diplomacy scroll. This might need more testing: it is the only one so far that fails but looks like he's trying to do it ... maybe there's something else at play here.

    nullify_alliance - Cancel Alliance
    Untested.

    ceasefire
    Doesn't work. The log reports "err: invalid mission_type".

    protectorate - Become a vassal
    Works! The diplomat will demand that the target faction becomes a vassal.

    NOTE: the two factions must be at war. They do not need to be at war prior to this script being called (unlike the "access" type), just prior to the diplomat's turn.

    Whether or not his likelihood of asking depends on cost and standings (descr_diplomacy.xml) I don't know. I did not alter those values at all, simply tried it on two factions at the start of a campaign who were neutral (I used script to put them at war just before making that diplomacy_mission call).

    Getting an AI faction to agree takes an extra step but I'll come back to that later.
    Last edited by Withwnar; July 06, 2014 at 11:23 PM.

  3. #3
    Withwnar's Avatar Script To The Waist
    Join Date
    Oct 2008
    Location
    Earth
    Posts
    6,329

    Default Re: diplomacy_mission: how to use

    (reserved)

  4. #4
    Aikanár's Avatar no vaseline
    Join Date
    Mar 2009
    Location
    Sanctuary
    Posts
    12,516
    Blog Entries
    3

    Default Re: diplomacy_mission: how to use

    No response yet? A shame! Great tut Withwnar, as always


    Son of Louis Lux, brother of MaxMazi, father of Squeaks, Makrell, Kaiser Leonidas, Iskar, Neadal, Sheridan, Bercor and HigoChumbo, house of Siblesz

    Not everything that counts can be counted, and not everything that can be counted counts.

  5. #5
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: diplomacy_mission: how to use

    The protectorate option could come handy. I can imagine setting eternal love (but not peace) between the warring factions just prior to the command. It would be a way to script vassals.

    set relationship to war
    set faction standing to blissful love
    spawn diplomat near settlement
    ask for protectorate
    conditionally kill diplomat when peace (which will be automatic) has been declared, else try again










  6. #6
    Jadli's Avatar The Fallen God
    Gaming Emeritus

    Join Date
    Dec 2013
    Location
    Czech Republic
    Posts
    8,528

    Default Re: diplomacy_mission: how to use

    Interesting stuff... in regard to this, I was curious how does the "attack" (when you ask a faction via diplomat to attack other faction) actually works? From my experience in singleplayer, the AI never attacked anyone I asked them to? Does it work properly with some AI systems?

    Could it perhaps be modified via scripts in a way that it would enforce a war via script commands to fix this? But I assume there is no way to check if such an offer/demand was made via diplomat, is there?

  7. #7

    Default Re: diplomacy_mission: how to use

    That is influenced by the descr_campaign_ai_db in universal settings
    Code:
    
    	<invade_priority_assistance_offset int="1000.0"/>
    You can adjust that number, you could also adjust the "trusted ally" settings and use trusted_ally_enemy_auto_war.

  8. #8

    Default Re: diplomacy_mission: how to use

    I found two other parameters "war" and "neutral" (+ target faction), without being able to obtain any effect though. I don't know if they are just false positives or if they work in particular situations, but they return no error (while an invalid target faction used with them will be returned as an error).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •