Results 1 to 9 of 9

Thread: How to test the relationship between two nations in scripts?

  1. #1

    Default How to test the relationship between two nations in scripts?

    I'm trying to write a script to make an "ally support" feature. Once two factions have a relationship better than, for example, "Amiable", the script can trigger an event and then both of them can build a building. Once the building is finished, you can get some unique units from your ally.


    Now the problem is I don't know how to test the relationship between two factions.

    If I_CompareCounter (relationship_between_england_france) > 0.5
    set_event_counter relationship_amiable 1


    How can I describe the red part?

    I find "FactionStanding" condition in docudemon files but I don't know how to use it.

    Any help is appreciated!

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to test the relationship between two nations in scripts?

    Well there's no independent condition for that, FactionStanding needs to be declared in a monitor_event using an event that exports both a faction, and a target faction, such as FactionWarDeclared.
    You can trigger on those events and use counters to store the value though.

  3. #3

    Default Re: How to test the relationship between two nations in scripts?

    Thank you, Alpaca!

    I think I've found a proper event:

    Code:
    Identifier:         UpdateAttitude
    Event:              A faction to faction attitude update has occurred (once every round)
    Exports:            faction, target_faction
    Class:              ET_UPDATE_ATTITUDE
    Author:             ScottL
    But I still don't know how to use the "FactionStanding" condition. Actually I don't know the grammar of this condition.


    Code:
    Identifier:              FactionStanding
    Trigger requirements:    faction, target_faction
    Parameters:              logic token, quantity
    Sample use:              FactionStanding > 0.0
    Description:             what is the standing (relationship) of a faction towards the target faction
    Battle or Strat:         Either
    Class:                   FACTION_STANDING
    Implemented:             Yes
    Author:                  ScottL
    Can I write it like this? When you use france, and your relationship is good with England, then send a diplomat to england and negotiate for several rounds, then the relationship_amiable will be triggered. Do you suggest any other better event than UpdateAttitude to use?

    Code:
    set_event_counter relationship_amiable 0
    
    monitor_event UpdateAttitude FactionType england
    and TargetFactionType france
    and FactionStanding > 0.0
    set_event_counter relationship_amiable 1
    end_monitor
    Thanks again, Alpaca. You are so warm hearted!
    Last edited by zxiang1983; 07-15-2007 at 17:42.

  4. #4
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to test the relationship between two nations in scripts?

    Yes, I think that should work. It'll only be triggered once every turn though, just keep that in mind

  5. #5

    Default Re: How to test the relationship between two nations in scripts?

    Hmm, I got a very similar question as asked in this thread. I would like to make a script that makes an allied faction to automatically declare war upon my enemies if relations are very good. What is the easiest way doing this?

  6. #6
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to test the relationship between two nations in scripts?

    Quote Originally Posted by Jackbob
    Hmm, I got a very similar question as asked in this thread. I would like to make a script that makes an allied faction to automatically declare war upon my enemies if relations are very good. What is the easiest way doing this?
    I think the best way is probably fiddling with descr_campaign_ai_db.xml

    You should make a new condition there near the top and give a huge invasion priority.

  7. #7

    Default Re: How to test the relationship between two nations in scripts?

    Ok, thanks!

  8. #8
    Notepad user Member Red Spot's Avatar
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    491

    Default Re: How to test the relationship between two nations in scripts?

    am not a 100% sure, but iirc there is a setting in the descr_campaign_ai_db.xml file wich allows you to set the game so when an Ally get war declared on it the Allied factions auto. turn enemy on the agressor as well (now you get those "ally declares war"/"war declared on ally" messages)


    edit;
    this is it;
    <trusted_ally_enemy_auto_war bool="false"/>
    set it to "true", not sure if it has the expected result but thats at least the impression it gives me
    /edit


    G

  9. #9

    Default Re: How to test the relationship between two nations in scripts?

    Yes, the trusted_ally_enemy_auto_war bool makes it so that trusted allies automatically declares war upon an enemy. I want a more flexible system, but I'm not so good at scripting and stuff.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO