View Full Version : How to test the relationship between two nations in scripts?
zxiang1983
07-14-2007, 16:28
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.:no:
Any help is appreciated!
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.
zxiang1983
07-15-2007, 11:59
Thank you, Alpaca!
I think I've found a proper event:
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.
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?
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!
Yes, I think that should work. It'll only be triggered once every turn though, just keep that in mind
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?
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.
Red Spot
07-29-2007, 05:29
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
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.
vBulletin® v3.7.1, Copyright ©2000-2025, Jelsoft Enterprises Ltd.