This thread is for scripts which aid the AI. You can suggest scripts of this nature or amendments to existing scripts here.
Currently planned sub-scripts:
- Garrison (0% Done)
- Lucky Factions (100% Done)
- Income Boost (0% Done)
- Debt Remover (0% Done)
Garrison
The purpose of all garrison scripts is to cope with the AI consistently leaving its cities undefended by spawning local garrison to take up the defense of its cities when they come under siege. One of the key problems with most garrison scripts is they don't seem to distinguish if it's the AI or Player laying siege. This could be problematic as having units spawn when AI siege AI could mess up their AI Decision Trees determining that they could win the battle by effecting it through a medium they can't understand(scripts). So that should be the first thing to solve when this script is made.
Lucky Factions
The goal of the lucky factions is to randomly give an edge to a few select factions every game(namely incrementing the kings purse substantially). This should create interesting scenarios where different factions take the fore in different games and dominate.
Considerations
- Should be based on difficulty level (Done)
- Based on player faction (Done)
- Enable multiple lucky factions (Done)
- Cope with hotseat games (Done)
- Insure 3 separate factions get lucky (Done)
13 factions are eligible to become 'lucky'(exc. Local, Ghurid). Of these 13 factions:
- 5 should have a Low chance (3% Chance)
- 5 should have a Medium chance (8% Chance)
- 3 should have a High chance (15% Chance)
This is based on factions that can present the player with a challenge. 2 of the 3 should be close countries, 1 should be a distant country which can build up to challenge the player.
Current List of High/Medium/Low per Faction:
Spoiler Alert, click show to read:
Left to do:
- Potentially come up with other benefits to give AI Lucky Factions
Code Snippet:
Income BoostCode:;**********Script 1H-1. Lucky Factions********** ;|Author| Augustus Lucifer ;|Purpose| Designates a certain # of lucky factions each game which get bonuses. ;|Changelog| ; o Script Created 7-05-09 ; o 7-06-09 ; Difficulty Levels, While, Faction Derivatives added declare_counter champa_got_lucky declare_counter song_got_lucky declare_counter jin_got_lucky declare_counter goryeo_got_lucky declare_counter xixia_got_lucky declare_counter mongols_got_lucky declare_counter khitans_got_lucky declare_counter daiviet_got_lucky declare_counter dali_got_lucky declare_counter khmer_got_lucky declare_counter pagan_got_lucky declare_counter tibet_got_lucky declare_counter minamoto_got_lucky declare_counter taira_got_lucky declare_counter lucky_factions set_counter champa_got_lucky 0 set_counter song_got_lucky 0 set_counter jin_got_lucky 0 set_counter goryeo_got_lucky 0 set_counter xixia_got_lucky 0 set_counter mongols_got_lucky 0 set_counter khitans_got_lucky 0 set_counter daiviet_got_lucky 0 set_counter dali_got_lucky 0 set_counter khmer_got_lucky 0 set_counter pagan_got_lucky 0 set_counter tibet_got_lucky 0 set_counter minamoto_got_lucky 0 set_counter taira_got_lucky 0 set_counter lucky_factions 0 ;Generate 3 Lucky Factions and increase their kings purses, then terminate monitor_event PreFactionTurnStart FactionIsLocal ;;Player = Song Dynasty;; if I_LocalFaction song ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Champa if I_LocalFaction champa ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Dai Viet if I_LocalFaction daiviet ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Dali if I_LocalFaction dali ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Goryeo if I_LocalFaction goryeo ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Jin if I_LocalFaction jin ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Khitans if I_LocalFaction khitans ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Khmer if I_LocalFaction khmer ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Minamoto if I_LocalFaction minamoto ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Mongols if I_LocalFaction mongols ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Pagan if I_LocalFaction pagan ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Taira if I_LocalFaction taira ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Tibet if I_LocalFaction tibet ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse xixia 1000 inc_counter xixia_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if ;;Player = Xi Xia if I_LocalFaction xixia ;;Run loop until 3 lucky factions chosen while I_CompareCounter lucky_factions < 3 generate_random_counter lucky_faction 1 100 if I_EventCounter lucky_faction < 16 ; 15% Chance increment_kings_purse goryeo 1000 inc_counter goryeo_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 31 and I_EventCounter lucky_faction > 15 ; 15% Chance increment_kings_purse tibet 1000 inc_counter tibet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 46 and I_EventCounter lucky_faction > 30 ; 15% Chance increment_kings_purse pagan 1000 inc_counter pagan_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 54 and I_EventCounter lucky_faction > 45 ; 8% Chance increment_kings_purse jin 1000 inc_counter jin_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 62 and I_EventCounter lucky_faction > 53 ; 8% Chance increment_kings_purse khitans 1000 inc_counter khitans_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 70 and I_EventCounter lucky_faction > 61 ; 8% Chance increment_kings_purse mongols 1000 inc_counter mongols_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 78 and I_EventCounter lucky_faction > 69 ; 8% Chance increment_kings_purse khmer 1000 inc_counter khmer_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 86 and I_EventCounter lucky_faction > 77 ; 8% Chance increment_kings_purse song 1000 inc_counter song_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 89 and I_EventCounter lucky_faction > 85 ; 3% Chance increment_kings_purse champa 1000 inc_counter champa_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 92 and I_EventCounter lucky_faction > 88 ; 3% Chance increment_kings_purse minamoto 1000 inc_counter minamoto_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 95 and I_EventCounter lucky_faction > 91 ; 3% Chance increment_kings_purse taira 1000 inc_counter taira_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction < 98 and I_EventCounter lucky_faction > 94 ; 3% Chance increment_kings_purse daiviet 1000 inc_counter daiviet_got_lucky 1 inc_counter lucky_factions 1 end_if if I_EventCounter lucky_faction > 97 ;3% Chance increment_kings_purse dali 1000 inc_counter dali_got_lucky 1 inc_counter lucky_factions 1 end_if ;;Prevent same faction from getting lucky twice if I_CompareCounter champa_got_lucky > 1 increment_kings_purse champa -1000 inc_counter champa_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter daiviet_got_lucky > 1 increment_kings_purse daiviet -1000 inc_counter daiviet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter dali_got_lucky > 1 increment_kings_purse dali -1000 inc_counter dali_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter goryeo_got_lucky > 1 increment_kings_purse goryeo -1000 inc_counter goryeo_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter jin_got_lucky > 1 increment_kings_purse jin -1000 inc_counter jin_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khitans_got_lucky > 1 increment_kings_purse khitans -1000 inc_counter khitans_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter khmer_got_lucky > 1 increment_kings_purse khmer -1000 inc_counter khmer_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter minamoto_got_lucky > 1 increment_kings_purse minamoto -1000 inc_counter minamoto_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter mongols_got_lucky > 1 increment_kings_purse mongols -1000 inc_counter mongols_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter pagan_got_lucky > 1 increment_kings_purse pagan -1000 inc_counter pagan_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter song_got_lucky > 1 increment_kings_purse song -1000 inc_counter song_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter taira_got_lucky > 1 increment_kings_purse taira -1000 inc_counter taira_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter tibet_got_lucky > 1 increment_kings_purse tibet -1000 inc_counter tibet_got_lucky -1 inc_counter lucky_factions -1 end_if if I_CompareCounter xixia_got_lucky > 1 increment_kings_purse xixia -1000 inc_counter xixia_got_lucky -1 inc_counter lucky_factions -1 end_if end_while end_if terminate_monitor end_monitor ;Additional bonuses for lucky faction based on difficulty setting monitor_event PreFactionTurnStart FactionIsLocal and not I_HotseatEnabled if I_CompareCounter champa_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse champa 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse champa 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse champa 9000 end_if end_if if I_CompareCounter daiviet_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse daiviet 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse daiviet 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse daiviet 9000 end_if end_if if I_CompareCounter dali_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse dali 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse dali 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse dali 9000 end_if end_if if I_CompareCounter goryeo_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse goryeo 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse goryeo 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse goryeo 9000 end_if end_if if I_CompareCounter jin_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse jin 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse jin 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse jin 9000 end_if end_if if I_CompareCounter khitans_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse khitans 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse khitans 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse khitans 9000 end_if end_if if I_CompareCounter khmer_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse khmer 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse khmer 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse khmer 9000 end_if end_if if I_CompareCounter minamoto_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse minamoto 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse minamoto 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse minamoto 9000 end_if end_if if I_CompareCounter mongols_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse mongols 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse mongols 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse mongols 9000 end_if end_if if I_CompareCounter pagan_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse pagan 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse pagan 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse pagan 9000 end_if end_if if I_CompareCounter song_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse song 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse song 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse song 9000 end_if end_if if I_CompareCounter taira_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse taira 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse taira 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse taira 9000 end_if end_if if I_CompareCounter tibet_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse tibet 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse tibet 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse tibet 9000 end_if end_if if I_CompareCounter xixia_got_lucky == 1 if I_EventCounter difficulty_medium == 1 increment_kings_purse xixia 1500 end_if if I_EventCounter difficulty_hard == 1 increment_kings_purse xixia 4000 end_if if I_EventCounter difficulty_very_hard == 1 increment_kings_purse xixia 9000 end_if end_if terminate_monitor end_monitor ;Make sure that a player faction in hotseat isn't getting bonus monitor_event FactionTurnStart FactionIsLocal and I_HotseatEnabled if I_LocalFaction champa if I_CompareCounter champa_got_lucky == 1 increment_kings_purse champa -1000 set_counter champa_got_lucky 0 end_if end_if if I_LocalFaction daiviet if I_CompareCounter daiviet_got_lucky == 1 increment_kings_purse daiviet -1000 set_counter daiviet_got_lucky 0 end_if end_if if I_LocalFaction dali if I_CompareCounter dali_got_lucky == 1 increment_kings_purse dali -1000 set_counter dali_got_lucky 0 end_if end_if if I_LocalFaction goryeo if I_CompareCounter goryeo_got_lucky == 1 increment_kings_purse goryeo -1000 set_counter goryeo_got_lucky 0 end_if end_if if I_LocalFaction jin if I_CompareCounter jin_got_lucky == 1 increment_kings_purse jin -1000 set_counter jin_got_lucky 0 end_if end_if if I_LocalFaction khitans if I_CompareCounter khitans_got_lucky == 1 increment_kings_purse khitans -1000 set_counter khitans_got_lucky 0 end_if end_if if I_LocalFaction khmer if I_CompareCounter khmer_got_lucky == 1 increment_kings_purse khmer -1000 set_counter khmer_got_lucky 0 end_if end_if if I_LocalFaction minamoto if I_CompareCounter minamoto_got_lucky == 1 increment_kings_purse minamoto -1000 set_counter minamoto_got_lucky 0 end_if end_if if I_LocalFaction mongols if I_CompareCounter mongols_got_lucky == 1 increment_kings_purse mongols -1000 set_counter mongols_got_lucky 0 end_if end_if if I_LocalFaction pagan if I_CompareCounter pagan_got_lucky == 1 increment_kings_purse pagan -1000 set_counter pagan_got_lucky 0 end_if end_if if I_LocalFaction song if I_CompareCounter song_got_lucky == 1 increment_kings_purse song -1000 set_counter song_got_lucky 0 end_if end_if if I_LocalFaction taira if I_CompareCounter taira_got_lucky == 1 increment_kings_purse taira -1000 set_counter taira_got_lucky 0 end_if end_if if I_LocalFaction tibet if I_CompareCounter tibet_got_lucky == 1 increment_kings_purse tibet -1000 set_counter tibet_got_lucky 0 end_if end_if if I_LocalFaction xixia if I_CompareCounter xixia_got_lucky == 1 increment_kings_purse xixia -1000 set_counter xixia_got_lucky 0 end_if end_if end_monitor
King's purse will be increased for all factions that are not the player faction to better suit the AI(independent of the lucky factions modifier). In addition the "AI Building" will provide valuable benefits and only persist in AI-held settlements.
Debt Remover
Simple debt removing script to check if the AI has plunged into the negatives and give them some money to help keep them afloat.
Possible new solution to this common problem, using the Income condition check various levels of losing money and increment the kings purse temporarily accordingly to stabilize, coupled with the funding of finite money to hopefully encourage economic investment. May also want to experiment with killing off all priests/assassins/spies/boats when dip into negatives.






Reply With Quote






