Results 1 to 6 of 6

Thread: 098: Army-related SSHIP mechanics

  1. #1

    Icon14 098: Army-related SSHIP mechanics

    Army-related SSHIP mechanisms

    The mechanisms are crafted to increase historical immersion, to provide incentives for the player to play (somehow) historically, and also to make him making a real management effort to overcome hurdlesses in his game.
    In particular, the modding goals here are:
    - to make offensive actions costly and limited - as it was in history.
    - to prevent never-ending offensives (historically, the troops were resting most of their lives ;-).
    - to induce using generals for all actions.
    - what' related: to pay attention to the traits of generals.
    - to think about logistics in transferring troops from recruitment place to the spots they're needed.
    - to raise the bar of playing at higher difficulties.

    So it's mostly about generals. You'll need to manage your pool of nobles wisely: the generals is your scarce resource and you'll need to decide what to do with them carefully. At times, in your kingdoms may be really short of capable generals, eg. when some of them are old and unfit for any reasonable action. You'll need to spend such time building up, gathering funds, defending, and waiting for better situation. Furthermore, you'll need to think about age structure of your generals. This will induce you to think about marriages - the game will give you the number of generals more-or-less eqal to the number of the settlements, and max. 4 children per married general, so agree to marriages also to in this in mind.

    The SSHIP follows the path trodden by the Byg's Grim Reality submod for the base Stainless Steel. You may read the discussion on particular solutions here.


    Army supply costs (only for Very Hard difficulty)

    The supply system makes you pay for your armies (i.e. generals - as it technically works through the generals' traits) staying in the enemy lands, travelling by boat or besieging an enemy settlement. The amount of money depends also on certain other traits (Logistician) and special ancillaries of the relevant general (eg Siege Engineer). If he's got none, the costs may be significant.
    Spoiler Alert, click show to read: 


    Costs for captain-led armies (for Hard and Very Hard difficulties)

    An army should be lead by a noble (a general). However, you may decide to send units without any (eg. as you're sending reinforcements accross your realm, or for your army abroad), so technically led by a 'captain'. The costs of such armies cost 2k for each abroad, and 1k for each in home territories. They do not depend on the size of the army. Bear in mind, that such armies are also likely to stage a mutiny.
    Spoiler Alert, click show to read: 


    Attacking only with generals (optional for all difficulties)

    A medieval army should be led by a noble (a general). You may have such a home rule (JoC: I do observe it), but to give you an additional incentive to do so, in the SSHIP, there's an (optional) script that prevents you from attacking / sieging by army withot one.
    Spoiler Alert, click show to read: 




    Army morale (for Hard and Very Hard difficulties)

    Each general has a trait describing the current morale of the troops under his command. If they have been resting in their homelands for some time, they are likely to be "Ready for Action". If the general is a Good Commander, they may even be "Eager To Fight". In both cases, they will have good morale in battles. Once the army moves, it will lose morale after a few turns of marching and the troops will became "Weary". This happens faster if the troops are in enemy lands or at sea, or if they are conducting a siege, or they are lead by a Bad Commander. If they campaign for very long time, they will became "Despondent", "Undisciplined" and even "Mutinous". Such traits will result in lower morale on the battlefield and slower movement on the campaign map. The general will also (temporarily) lose Loyalty and Command. In order for troops to recover their morale, the army must return to its homeland. The speed of recovery once at home depends upon: initial state of morale (very low levels improve more quickly), faith of the province population (if faction's own religion is above 50%, then recovery is faster), sitting in a settlement.
    You may read more here.
    Spoiler Alert, click show to read: 


    Spoils of War, or Camp looted after a field battle
    (for all difficulties)

    The player will both gain some money after a victory, as well as loose after a defeat. The size of the loot depends on the size of the defeated army plus the difference in size between the armies - not strenght, but the number of soldiers involved. If you defeat a large enemy army with just a handful of units, the loot may be large. As usual, small faction (1-3 settlements) has special bonus for victories to enable its survival (this mechanism is ingrained in many other scripts).
    The player has an option to share a part of this loot with his soldiers what can impact the Faction Leader traits (Generous, Think of his People etc. - but there's also a chance to impact negatively), but obviously lower his prize from the battle.
    This script will be used also to inform the player on the number of battles fought personally by himself (after certain numbers are reached: 10, 25, 50 ...).
    Spoiler Alert, click show to read: 
    Last edited by Jurand of Cracow; June 14, 2023 at 12:19 AM.

  2. #2
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,451

    Default Re: BGR for SSHIP?

    Army morale system [note that this system works only at the Very Hard campaign difficulty]
    Each general has a trait describing current state of morale of troops under his command. If they have been in the homelands for some time, they’re likely to be Ready for Action. If the general is a Good Commander or Inspiring Speaker, they may even be Eager To Fight. In both cases they will have good morale in battles.
    Once the army moves, it will lose morale after a few turns of marching and the troops will became Weary. It happens faster if they’re in enemy lands or at the sea, or they conduct a siege, or they lead by a Bad Commander. If they do campaign for very long time, they will became Despondent, Undisciplined and even Mutinous. It will result in lower morale in battles and slower movement on the campaign map. The general will also (temporarily) lose Loyalty and Command.
    Anyway, for the troops to recover their morale, the army has to come back to the homelands and rest a bit, preferably in a settlement. Alternatively, it may fight ferociously stronger enemies – the victories will buoy up the spirit of every soldier!

    The trait
    Code:
    ;=========================================================================================;----- Army Campaign Morale -----------------------------
    ;--------------------------------------------------------
    ;--- levels(points): 1(4),2(8), 3(12), 4(16),5(20),6(24),7(28),8(32),9(36)
    
    ;------------------------------------------
    Trait ArmyCampaignMorale
        Characters family
    
        Level ACM_Bent_On_Glory
            Description ACM_Bent_On_Glory_desc
            EffectsDescription ACM_Bent_On_Glory_effects_desc
            Threshold 1
    
            Effect Loyalty -2
            Effect TroopMorale 3
    
        Level ACM_Eager_To_Fight
            Description ACM_Eager_To_Fight_desc
            EffectsDescription ACM_Eager_To_Fight_effects_desc
            LoseMessage  ACM_Eager_To_Fight_lose_desc
            Threshold 5
    
            Effect TroopMorale 2
    
        Level ACM_Ready_For_Action
            Description ACM_Ready_For_Action_desc
            EffectsDescription ACM_Ready_For_Action_effects_desc
            Threshold 9
    
            Effect TroopMorale 1
            
        Level ACM_Troops_Weary
            Description ACM_Troops_Weary_desc
            EffectsDescription ACM_Troops_Weary_effects_desc
            Threshold 13
    
            Effect TroopMorale -1
            Effect MovementPoints -1
            
        Level ACM_Troops_Despondent
            Description ACM_Troops_Despondent_desc
            EffectsDescription ACM_Troops_Despondent_effects_desc
            Threshold 17
    
            Effect TroopMorale -2
            Effect MovementPoints -2
    
        Level ACM_Troops_Undisciplined
            Description ACM_Troops_Undisciplined_desc
            EffectsDescription ACM_Troops_Undisciplined_effects_desc
            GainMessage ACM_Troops_Undisciplined_gain_desc
            Threshold 21
    
            Effect TroopMorale -3
            Effect MovementPoints -3
            Effect Command -1
            Effect Loyalty -1
    
        Level ACM_Troops_Desperate
            Description ACM_Troops_Desperate_desc
            EffectsDescription ACM_Troops_Desperate_effects_desc
            GainMessage ACM_Troops_Desperate_gain_desc
            Threshold 25
    
            Effect TroopMorale -4
            Effect MovementPoints -4
            Effect Command -2
            Effect Loyalty -2
    
        Level ACM_Troops_Mutinous
            Description ACM_Troops_Mutinous_desc
            EffectsDescription ACM_Troops_Mutinous_effects_desc
            GainMessage ACM_Troops_Mutinous_gain_desc
            Threshold 29
    
    
            Effect TroopMorale -5
            Effect MovementPoints -5
            Effect Command -3
            Effect Loyalty -3
    
    
        Level ACM_Too_Many_Years_Away
            Description ACM_Too_Many_Years_Away_desc
            EffectsDescription ACM_Too_Many_Years_Away_effects_desc
            Threshold 33
    
    
            Effect TroopMorale -5
            Effect MovementPoints -5
            Effect Command -3
            Effect Loyalty -3
    The in-game descriptions for the player
    Code:
    {ACM_Bent_On_Glory}    Army Bent On Glory{ACM_Bent_On_Glory_desc} This General is inspiring his troops through great victories. They will follow him anywhere, even on the longest, hardest adventures. His Glory hunting is causing suspicion and resentment at home and creates dangerous thoughts about going his way alone.
    {ACM_Bent_On_Glory_effects_desc} -2 Loyalty, +3 Morale for troops on the battlefield.  Troops likely to keep their morale high for a long time.
    {ACM_Eager_To_Fight}    Troops Eager To Fight
    {ACM_Eager_To_Fight_desc} His troops are eager to fight for him in a long campaign.
    {ACM_Eager_To_Fight_effects_desc} +2 Morale for troops on the battlefield. Troops likely to keep their morale high for a long time.
    {ACM_Eager_To_Fight_lose_desc} Strike while the iron is hot! This General is inspiring his troops, through great victories, they will follow him anywhere, even on the longest, hardest adventures!
    {ACM_Ready_For_Action}    Troops Ready For Action
    {ACM_Ready_For_Action_desc} His troops are ready to fight for him in a campaign.
    {ACM_Ready_For_Action_effects_desc} +1 Morale for troops on the battlefield
    {ACM_Troops_Weary}    Troops Weary
    {ACM_Troops_Weary_desc} The troops need to recuperate their strenghts by resting in home lands, and even better in a settlement. A great battle won would make miracles to their morale, though.
    {ACM_Troops_Weary_effects_desc} -1 Morale for troops on the battlefield, -1 movement point
    {ACM_Troops_Despondent}    Troops Despondent
    {ACM_Troops_Despondent_desc} The army needs to rest in home lands, and even better in a settlement. A great battle won would make miracles to their morale, though.
    {ACM_Troops_Despondent_effects_desc} -2 Morale for troops on the battlefield, -2 movement point
    {ACM_Troops_Undisciplined}    Troops Undisciplined
    {ACM_Troops_Undisciplined_desc}Years on active service has taken it's toll. The army needs to rest in home lands, and even better in a settlement. A great battle won would make miracles to their morale, though.
    {ACM_Troops_Undisciplined_effects_desc} -3 Morale for troops on the battlefield, -3 movement point\n -1 Command, -1 Loyalty
    {ACM_Troops_Undisciplined_gain_desc}The troops need to recuperate their strenghts!
    {ACM_Troops_Desperate}    Troops Desperate
    {ACM_Troops_Desperate_desc}Many years away from home have eroded this army's native values and discipline to a severe extent. It needs to rest in home lands, and even better in a settlement. A battle won would also help to recover morale.
    {ACM_Troops_Desperate_effects_desc}-4 Morale for troops on the battlefield, -4 movement point\n -2 Command, -2 Loyalty
    {ACM_Troops_Desperate_gain_desc}Many years away from home have eroded this army's native values and discipline to a severe extent. It lost it's fighting value and need to recuperate.
    {ACM_Troops_Mutinous}    Troops Mutinous
    {ACM_Troops_Mutinous_desc}This army has not returned home for many years. It needs to rest in home lands, and even better in a settlement. A battle won would also help to recover morale.
    {ACM_Troops_Mutinous_effects_desc}-5 Morale for troops on the battlefield, -5 movement point\n -3 Command, -3 Loyalty
    {ACM_Troops_Mutinous_gain_desc}This army has not returned home for many years. As a matter of fact, it's unlikely to return at all.
    {ACM_Too_Many_Years_Away}    Too Many Years Away
    {ACM_Too_Many_Years_Away_desc}This army has not returned home for many years. It needs to rest in home lands, and even better in a settlement. A battle won would also help to recover morale.
    {ACM_Too_Many_Years_Away_effects_desc}-5 Morale for troops on the battlefield, -5 movement point\n -3 Command, -3 Loyalty
    The triggers:
    Code:
    ;========================================================================================= Army Campaign Morale;----- Army Campaign Morale ---------------------------
    ;--- levels(points): 1(1),2(5) - 3(9) - 4(13),5(17),6(21),7(25),8(29),9(33)
    
    
        
    ;----------------------------------------------------------------------- ACM safety valves
    Trigger ACM_Safety_In_Case_of_Bug_Min
        WhenToTest CharacterTurnStart
        
     Condition Trait ArmyCampaignMorale < 1
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 9 Chance 100
        
    ;------------------------------------------
    Trigger ACM_Safety_In_Case_of_Bug_Max
        WhenToTest CharacterTurnStart
    
    
        Condition Trait ArmyCampaignMorale > 8    ; level 9 is currently not used
            
        Affects ArmyCampaignMorale -4 Chance 100
    
    
    ;----------------------------------------------------------------------- ACM decrease at home (cumulative triggers)
    Trigger ACM_Improve_From_High_Value_AtHome
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 5
            and not InEnemyLands
            and not EndedInEnemyZOC
    
    
        Affects ArmyCampaignMorale -2 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Improve_From_High_Value_AtHome_Resting
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 5
            and not InEnemyLands
            and not EndedInEnemyZOC
            and RemainingMPPercentage > 90
            
        Affects ArmyCampaignMorale -2 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Home_Improve_In_Settlement
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 3
            and EndedInSettlement
            and not EndedInEnemyZOC
            and Treasury > 0                       ; the kingdom is able pay the troops for ease they woes
    
    
        Affects ArmyCampaignMorale -1 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Home_Improve_In_Settlement_Resting
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 3
            and not InEnemyLands
            and not EndedInEnemyZOC
            and RemainingMPPercentage > 80
    
    
        Affects ArmyCampaignMorale -1  Chance  100
    
    
    ;------------------------------------------
    Trigger ACM_Home_Improve_GoodCommander
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 2    ; goes to level "Eager Troops"
            and not InEnemyLands
            and not EndedInEnemyZOC
            and Trait GoodCommander > 0
            and Trait FitForOffice > 1            ; not insane or ill
    
    
        Affects ArmyCampaignMorale -1 Chance 50
    
    
    ;------------------------------------------
    Trigger ACM_Home_Improve_Before_Expedition_GoodSpeaker
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale > 2
            and Trait ArmyCampaignMorale < 3
            and not InEnemyLands
            and not EndedInEnemyZOC
            and Trait InspiringSpeaker > 1
            and Trait FitForOffice > 1
            
        Affects ArmyCampaignMorale -1 Chance 33
    
    
    ;----------------------------------------------------------------------- ACM decrease due to battles won
    Trigger ACM_Improve_Clear_Victory
        WhenToTest PostBattle
    
    
        Condition IsGeneral
              and WonBattle
              and BattleOdds < 1
              and BattleSuccess >= clear
              and PercentageEnemyKilled > 40
              and Trait ArmyCampaignMorale > 1            ; may get to Bent on Glory, especially if other triggers fire
              and CharacterIsLocal
    
    
        Affects ArmyCampaignMorale -2 Chance 100
        
    ;------------------------------------------
    Trigger ACM_Improve_Average_Victory
        WhenToTest PostBattle
    
    
        Condition IsGeneral
              and WonBattle
              and BattleOdds < 1
              and BattleSuccess >= average
              and PercentageEnemyKilled > 40
              and Trait ArmyCampaignMorale > 1
              and CharacterIsLocal
    
    
        Affects ArmyCampaignMorale -2 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Improve_Close_Victory
        WhenToTest PostBattle
    
    
        Condition IsGeneral
              and WonBattle
              and BattleOdds < 1.4
              and PercentageEnemyKilled > 40
              and Trait ArmyCampaignMorale > 1
              and CharacterIsLocal
    
    
        Affects ArmyCampaignMorale -1 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Improve_Any_Victory
        WhenToTest PostBattle
    
    
        Condition IsGeneral
              and WonBattle
              and PercentageEnemyKilled > 40
              and Trait ArmyCampaignMorale > 1
              and CharacterIsLocal
    
    
        Affects ArmyCampaignMorale -1 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Improve_SettlementCapture
        WhenToTest GeneralCaptureSettlement
    
    
        Condition CharacterIsLocal
              and Trait ArmyCampaignMorale > 1
    
    
        Affects ArmyCampaignMorale -2 Chance 100
    
    
    ;----------------------------------------------------------------------- ACM increase (cumulative!)
    Trigger ACM_Deteriorate_Troops_Moving
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale < 6      ; moving won't make troops mutinous
            and RemainingMPPercentage < 80
            and FactionIsLocal
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 1 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Deteriorate_Troops_Abroad
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale < 8
            and InEnemyLands                         ; also at sea
            and I_EventCounter DifficultyLevel = 4        
    
    
        Affects ArmyCampaignMorale 1 Chance 50
    
    
    ;------------------------------------------
    Trigger ACM_Deteriorate_BadCommander
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale < 8
            and InEnemyLands
            and Trait NaturalMilitarySkill < 1
            and Trait BadCommander > 0              ; also low Military / Pagan education is thus taken into account
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 1 Chance 50
        
    ;------------------------------------------
    Trigger ACM_Deteriorate_EnemyContact
        WhenToTest CharacterTurnEnd
    
    
        Condition Trait ArmyCampaignMorale < 8
            and InEnemyLands
            and EndedInEnemyZOC                  ; also besieging
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 1 Chance 50
    
    
    ;------------------------------------------
    Trigger ACM_Deteriorate_AnyDefeat
        WhenToTest PostBattle
            
        Condition IsGeneral
              and not WonBattle
              and Trait ArmyCampaignMorale < 8
              and CharacterIsLocal
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 2 Chance 100
    
    
    ;------------------------------------------
    Trigger ACM_Deteriorate_Defeat_Woeful
        WhenToTest PostBattle
            
        Condition IsGeneral
              and not WonBattle
              and BattleOdds > 1.2
              and Trait ArmyCampaignMorale < 8
              and CharacterIsLocal
            and I_EventCounter DifficultyLevel = 4
            
        Affects ArmyCampaignMorale 2 Chance 100
    Last edited by Jurand of Cracow; June 14, 2023 at 12:24 AM.

  3. #3
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,451

    Default Re: Supply costs system

    Army supply costs + Supply costs for captain-led armies

    Mind that this system works throgh a general traits. If there's no general in the army, then it is "led by a captain" and the script gives flat-rate payment. The costs are comparable, but only the captain-led armies require payments within your realm (this is also to compensate for the lack of the Morale system for such armies)>

    In in the script the coding as follows:

    Code:
        ;================== SUPPLY & BESIEGE COSTS  =========================== info through a trait gain message
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait ArmyCost = 1
                log --- Army costs --- -250
                console_command add_money -250
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if            
        end_monitor
    
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait ArmyCost = 2
                log --- Army costs --- -500
                console_command add_money -500
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait ArmyCost = 3
                log --- Army costs --- -1000
                console_command add_money -1000
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait ArmyCost = 4
                log --- Army costs --- -1500
                console_command add_money -1500
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait ArmyCost = 5
                log --- Army costs --- -2000
                console_command add_money -2000
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    
        monitor_event CharacterTurnEnd FactionIsLocal
            and I_TurnNumber > 0
            and InEnemyLands
            and not EndedInSettlement
            and not IsBesieging
            and not AgentType = admiral
            and not AgentType = spy
            and not AgentType = diplomat
            and not AgentType = assassin
            and not AgentType = priest
            and not AgentType = princess
            and not AgentType = merchant
            and not AgentType = named character
    
    
                console_command add_money -2000
                historic_event COSTS_CAPTAIN_LEAD_ARMY_ABROAD
                if I_EventCounter DifficultyLevel < 3                        ; only for H/VH difficulty
                    terminate_monitor
                end_if
    
    
        end_monitor
    
    
        monitor_event CharacterTurnEnd FactionIsLocal
            and I_TurnNumber > 0
            and not InEnemyLands
            and not EndedInSettlement
            and not IsBesieging
            and not AgentType = admiral
            and not AgentType = spy
            and not AgentType = diplomat
            and not AgentType = assassin
            and not AgentType = priest
            and not AgentType = princess
            and not AgentType = merchant
            and not AgentType = named character
    
                console_command add_money -1000
                historic_event COSTS_CAPTAIN_LEAD_ARMY_HOME
                if I_EventCounter DifficultyLevel < 3                        ; only for H/VH difficulty
                    terminate_monitor
                end_if
                
        end_monitor
    
        ;================== AT SEA COSTS ======================================= info through a trait gain message
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait AtSeaCost = 1
                log --- At sea costs --- -500
                console_command add_money -500
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    
    
        monitor_event CharacterTurnStart CharacterIsLocal
            and IsGeneral
            and Trait AtSeaCost = 2
                log --- At sea costs --- -1000
                console_command add_money -1000
                if I_EventCounter DifficultyLevel < 4                        ; only for VH difficulty
                    terminate_monitor
                end_if    
        end_monitor
    In the EDCT, the general will get the traits
    Code:
    ;======================================================================= Supply and Siege Costs;----- Supply and Siege Costs
    ; the costs are defined in the script.txt
    ; descriptions of these costs are edited in a way to appear in-game in a best possible right way (amounts in part "_desc", not "effects_desc")
    
    
    ;--------------------------------------------------------
    Trait ArmyCost
     Characters family
    
    
     Level Campaigning_Costs1
       Description Campaigning_Costs1_desc
       EffectsDescription Campaigning_Costs1_effects_desc
       GainMessage Campaigning_Costs1_gain_desc
       Threshold 1
       
     Level Campaigning_Costs2
       Description Campaigning_Costs2_desc
       EffectsDescription Campaigning_Costs2_effects_desc
       Threshold 2
       
     Level Campaigning_Costs3
       Description Campaigning_Costs3_desc
       EffectsDescription Campaigning_Costs3_effects_desc
       Threshold 3
       
     Level Campaigning_Costs4
       Description Campaigning_Costs4_desc
       EffectsDescription Campaigning_Costs4_effects_desc
       GainMessage Campaigning_Costs4_gain_desc
       Threshold 4
    
    
     Level Campaigning_Costs5
       Description Campaigning_Costs5_desc
       EffectsDescription Campaigning_Costs5_effects_desc
       Threshold 5
    
    
    ;--------------------------------------------------------
    Trait AtSeaCost
     Characters family
    
    
     Level AtSea_Cost_Low
       Description AtSea_Cost_Low_desc
       EffectsDescription AtSea_Cost_Low_effects_desc
       GainMessage AtSea_Cost_Low_gain_desc
       Threshold 1
    
    
     Level AtSea_Cost_High
       Description AtSea_Cost_High_desc
       EffectsDescription AtSea_Cost_High_effects_desc
       Threshold 2
    Code:
    ;======================================================== Supply and Siege Costs;----- Supply and Siege Costs ---------------------------
    ;-- used with script
    ;-- the triggers are ordered in (logically) reverse way but keep this order - this economises on the triggers
    ;-- it's also easy to add other criteria for moving 1->2 and 2->3
    ;-- in one of the GeneralCaptureSettlement triggers there's a drop of ArmyCosts to 0
    ;-- IDEA: introduce at some point criterium related to 1. Embezzler, 2. King having a crown 
    
    
    ;------------------------------------------ 5->0
    Trigger ArmyCost_Remove_BackHome
     WhenToTest CharacterTurnEnd      ; it's possible that at the end you're in enemy lands, but after the AI attack you're in home lands - so use End
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and not InEnemyLands
           and Trait ArmyCost > 0
           
     Affects ArmyCost -5 Chance 100
    
    
    ;------------------------------------------ 5->0
    Trigger ArmyCost_Remove_SecondaryGeneral
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and TimeWithArmy > 0         ; the first general in the army doesn't get this attribute
           and Trait ArmyCost > 0
           
     Affects ArmyCost -5 Chance 100
     
    ;------------------------------------------ X->0   (settlement captured event is in another place)
    Trigger ArmyCost_Remove_BattleLost         ; this trigger is to avoid having the traits when after the battle the army retreats to home territory
     WhenToTest PostBattle
    
    
     Condition not WonBattle
        and Trait ArmyCost > 0
    
    
     Affects ArmyCost -5 Chance 100
     
    ;------------------------------------------ 5->1
    Trigger ArmyCost_Siege_Remove_Engineer
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and InEnemyLands
           and not IsBesieging
           and Trait ArmyCost > 4
    
    
     Affects ArmyCost -4 Chance 100
    
    
    ;------------------------------------------ 4->1
    Trigger ArmyCost_Siege_Remove_NoEng
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and InEnemyLands
           and not IsBesieging
           and Trait ArmyCost > 3
    
    
     Affects ArmyCost -3 Chance 100
    
    
    ;------------------------------------------ 0->1,  250 fl.
    Trigger ArmyCost_Campaign_HighLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and InEnemyLands
           and TimeWithArmy < 1
           and not AtSea
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 1
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 1 Chance 100
    
    
    ;------------------------------------------ 1->2,  500 fl.
    Trigger ArmyCost_Campaign_AverageLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and InEnemyLands
           and not AtSea
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 2
           and Trait LogisticalSkill < 2
           and Trait Military_Edu < 4
           and Trait NaturalMilitarySkill < 4
           and not CharacterReligion pagan
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 1 Chance 100
     
    ;------------------------------------------ 2->3,  1000 fl.
    Trigger ArmyCost_Campaign_LowLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and InEnemyLands
           and not AtSea
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 3
           and Trait LogisticalSkill < 1
           and Trait Military_Edu < 3
           and Trait NaturalMilitarySkill < 3
           and not HasAncType MilitaryEngineer
           and not CharacterReligion pagan
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 1 Chance 100
    
    
    ;------------------------------------------ just a safety valve if the Med2 engine goes nuts
    Trigger ArmyCost_Siege_Started_from_Home
     WhenToTest CharacterTurnEnd
    
    
     Condition IsBesieging
           and CharacterIsLocal
           and TimeWithArmy < 1
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 1
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 4 Chance 100
    
    
    ;------------------------------------------ 1->4
    Trigger ArmyCost_Siege_Started_HighLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsBesieging
           and CharacterIsLocal
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 2
           and Trait ArmyCost > 0
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 3 Chance 100
    
    
    ;------------------------------------------ 2->4
    Trigger ArmyCost_Siege_Started_AverageLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsBesieging
           and CharacterIsLocal
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 3
           and Trait ArmyCost > 1
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 2 Chance 100
     
    ;------------------------------------------ 3->4
    Trigger ArmyCost_Siege_Started_LowLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsBesieging
           and CharacterIsLocal
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 4
           and Trait ArmyCost > 2
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 1 Chance 100
     
    ;------------------------------------------ 4->5
    Trigger ArmyCost_Siege_NotEngineer
     WhenToTest CharacterTurnEnd
    
    
     Condition IsBesieging
           and CharacterIsLocal
           and not IsOnCrusade
           and not IsOnJihad
           and Trait ArmyCost < 5
           and Trait Military_Edu < 4
           and Trait GoodEngineer < 1
           and not HasAncType SiegeEngineer    
           and not CharacterReligion pagan
           and I_EventCounter DifficultyLevel = 4
            
     Affects ArmyCost 1 Chance 100
    
    
    
    
    ;======================================================== AtSeaCost
    ;----- At Sea Costs  ------------------------------------
    ;-- used with script
    ;-- in the future might be more modded with RulerOfSicily and MaritimeInterests
    
    
    ;------------------------------------------ this trigger should be before the follwing one!
    Trigger AtSeaCost_Remove_SecondaryGeneral
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and TimeWithArmy > 0
           and Trait AtSeaCost > 0
           
     Affects AtSeaCost -2 Chance 100
     
    ;------------------------------------------
    Trigger AtSeaCost_Remove_NotAnymore
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and not AtSea
           and Trait AtSeaCost > 0
           
     Affects AtSeaCost -2 Chance 100
    
    
    ;------------------------------------------
    Trigger AtSeaCost_Start
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
            and CharacterIsLocal
            and TimeWithArmy < 1
            and AtSea
            and not IsOnCrusade
            and not IsOnJihad
            and Trait AtSeaCost < 1
            and I_EventCounter DifficultyLevel = 4
            
     Affects AtSeaCost 1 Chance 100
    
    
    ;------------------------------------------
    Trigger AtSeaCost_BadLogistics
     WhenToTest CharacterTurnEnd
    
    
     Condition IsGeneral
           and CharacterIsLocal
           and TimeWithArmy < 1
           and AtSea
           and not IsOnCrusade
           and not IsOnJihad
           and Trait AtSeaCost < 2
           and Trait LogisticalSkill < 1
           and FactionLeaderTrait MaritimeInterests < 1    
           and I_EventCounter DifficultyLevel = 4
            
     Affects AtSeaCost 1 Chance 100
    I would call the system complicated. Compare to the systems in the other mods, eg. Broken Crescent - Buff&Shine:

    Code:
    ;============ Warcost Scrip============ 
    
        monitor_event CharacterTurnEnd CharFactionType byzantium
        and not EndedInSettlement
        and not IsBesieging
        and not AgentType = admiral
        and not AgentType = spy
        and not AgentType = diplomat
        and not AgentType = assassin
        and not AgentType = priest
        and not AgentType = princess
        and not AgentType = merchant
        and not AgentType = inquisitor    
        and InEnemyLands
    
        add_money byzantium -200
    
        end_monitor
    .....
    Last edited by Jurand of Cracow; June 13, 2023 at 06:10 AM.

  4. #4
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,451

    Default Re: Supply costs system

    Reserved.

  5. #5
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,451

    Default Re: Supply costs system

    Guys,
    I've just added an optional script to provide for even more immersion. It will be familar for those who follow the SSHIP home-rules.

    No offensive battles for captain-led armies

    Code:
        ;========================================================================================================
        ;------- No offensive battles for captain-led armies
        ;========================================================================================================
        ; only for the player, not related to difficulty level
        ; made by JoC 2023, based on coding from the BC-BS mod
       
        monitor_event FactionTurnStart FactionIsLocal
    
    
            set_event_counter no_offensive_battles_for_captain_led_armies 0
            set_event_counter no_offensive_battles_for_captain_led_armies_on 0
        
            historic_event NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES true
            
            while I_EventCounter NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_accepted == 0
            and I_EventCounter NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_declined == 0
            end_while
       
            if I_EventCounter NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_accepted 1
                set_event_counter no_offensive_battles_for_captain_led_armies_on 1
            end_if
            if I_EventCounter NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_declined 1
                set_event_counter no_offensive_battles_for_captain_led_armies_on 0
            end_if
            
            terminate_monitor
        end_monitor
    
    
        monitor_event ScrollOpened ScrollOpened prebattle_scroll
        and I_AgentSelected general
            if I_EventCounter no_offensive_battles_for_captain_led_armies_on == 1
                campaign_wait 0.1
                disable_cursor
                campaign_wait 0.1
                select_ui_element prebattle_withdraw_button
                simulate_mouse_click lclick_down
                simulate_mouse_click lclick_up
                enable_cursor
                historic_event NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_CHOSEN
            end_if
            if I_EventCounter no_offensive_battles_for_captain_led_armies_on == 0
                terminate_monitor
            end_if
        end_monitor
    
    
        monitor_event ScrollOpened ScrollOpened siege_scroll
        and I_AgentSelected general
            if I_EventCounter no_offensive_battles_for_captain_led_armies_on == 1
                campaign_wait 0.1
                disable_cursor
                campaign_wait 0.1
                select_ui_element siege_end_button
                simulate_mouse_click lclick_down
                simulate_mouse_click lclick_up
                enable_cursor
                historic_event NO_OFFENSIVE_BATTLES_FOR_CAPTAIN_LED_ARMIES_CHOSEN
            end_if
            if I_EventCounter no_offensive_battles_for_captain_led_armies_on == 0
                terminate_monitor
            end_if
        end_monitor
    Last edited by Jurand of Cracow; June 13, 2023 at 06:05 AM.

  6. #6
    Jurand of Cracow's Avatar History and gameplay!
    Join Date
    Oct 2012
    Location
    Cracovia
    Posts
    8,451

    Default Re: Supply costs system

    Guys, I've taken on the script "Camp sacked" and I've fixed it.
    I've re-done it so that:
    1. it actually works (adds money when the player wins the battle, and subtracts when the player looses - until now it didn't until the event transitional armour (slopy coding...).
    2. there's a Yes/No event after a victory: the player must decide if he shares booty with his soldiers. If he chooses to give up a part of the lot, his FL (and maybe other generals in the future, to be modified further) will get some positive traits.
    3. the script counts the number of battles personally fought - there'll be pop-out windows for the player informing on achieving certain values. Maybe it would used also in another script? We'll see.

    Code:
        ;======================================================================================================
        ;------- Spoils of War (3) : size of armies, number of battles, PostBattle money (camp looted)
        ;======================================================================================================
    
    
        ; starting point: G5 Looting Script and similar "Spoils of War" BC-BS scipt, fundamentally redone by JoC in 2023
        ; no need to make similar script for sea battles - they were so insignificant in the Middle Ages that there's no reason to waste time
        
        ; mind that SIEGES ARE NOT INCLUDED in this script
        
        ; TO DO IN THE FUTURE:
        ; - use somehow number of battle of particular size
        ; - more impact on the FL leader traits
        ; - balance the money, if needed
        ; - think what to do with the sieges
    
    
        set_event_counter general_was_generous_to_his_troops_this_turn 0
        set_event_counter general_was_generous_to_his_troops_this_turn_1 0
        set_event_counter general_was_generous_to_his_troops_this_turn_2 0    
        set_event_counter general_was_generous_to_his_troops_this_turn_3 0
        
        declare_counter small_enemy_army_bf                            ; counters used only in this script, zeroed before each battle
        declare_counter medium_enemy_army_bf                        ; to determine the size of the battle and amounts of loot after that battle
        declare_counter large_enemy_army_bf
        declare_counter huge_enemy_army_bf
        
        declare_counter small_own_corps_bf
        declare_counter medium_own_corps_bf
        declare_counter large_own_corps_bf
        declare_counter huge_own_corps_bf
    
    
        declare_counter this_battle_being_fought
        declare_counter size_difference_of_battle_being_fought
        
        declare_counter size_of_battle_being_fought    
        declare_counter size_of_battle_being_fought_2
        declare_counter size_of_battle_being_fought_3
        declare_counter size_of_battle_being_fought_4
        declare_counter size_of_battle_being_fought_5
        declare_counter size_of_battle_being_fought_6
        declare_counter size_of_battle_being_fought_7
        declare_counter size_of_battle_being_fought_8
    
    
        declare_counter number_of_battles_not_autoresolved             ; counting throughout whole campaign - not yet used, but may one be needed...
        declare_counter number_of_battles_not_autoresolved_size_2    ; between 4 and 10 units
        declare_counter number_of_battles_not_autoresolved_size_3    ; between 8 and 15 units
        declare_counter number_of_battles_not_autoresolved_size_4    ; between 13 and 20 units
        declare_counter number_of_battles_not_autoresolved_size_5    ; between 18 and 25 units
        declare_counter number_of_battles_not_autoresolved_size_6    ; between 22 and 30 units
        declare_counter number_of_battles_not_autoresolved_size_7    ; between 27 and 35 units
        declare_counter number_of_battles_not_autoresolved_size_8    ; between 32 and 40 units
        
        declare_counter number_of_battles_won_not_autoresolved 
        declare_counter number_of_battles_won_not_autoresolved_size_2
        declare_counter number_of_battles_won_not_autoresolved_size_3
        declare_counter number_of_battles_won_not_autoresolved_size_4
        declare_counter number_of_battles_won_not_autoresolved_size_5
        declare_counter number_of_battles_won_not_autoresolved_size_6
        declare_counter number_of_battles_won_not_autoresolved_size_7
        declare_counter number_of_battles_won_not_autoresolved_size_8
    
    
        declare_counter number_of_battles_lost_not_autoresolved 
        declare_counter number_of_battles_lost_not_autoresolved_size_2
        declare_counter number_of_battles_lost_not_autoresolved_size_3
        declare_counter number_of_battles_lost_not_autoresolved_size_4
        declare_counter number_of_battles_lost_not_autoresolved_size_5
        declare_counter number_of_battles_lost_not_autoresolved_size_6
        declare_counter number_of_battles_lost_not_autoresolved_size_7
        declare_counter number_of_battles_lost_not_autoresolved_size_8
        
        set_counter small_enemy_army_bf 0
        set_counter medium_enemy_army_bf 0
        set_counter large_enemy_army_bf 0
        set_counter huge_enemy_army_bf 0
        
        set_counter small_own_corps_bf 0
        set_counter medium_own_corps_bf 0
        set_counter large_own_corps_bf 0
        set_counter huge_own_corps_bf 0
        
        set_counter this_battle_being_fought 0
        set_counter size_difference_of_battle_being_fought 0
        
        set_counter size_of_battle_being_fought 0
        set_counter size_of_battle_being_fought_2 0
        set_counter size_of_battle_being_fought_3 0
        set_counter size_of_battle_being_fought_4 0
        set_counter size_of_battle_being_fought_5 0
        set_counter size_of_battle_being_fought_6 0
        set_counter size_of_battle_being_fought_7 0
        set_counter size_of_battle_being_fought_8 0
    
    
        set_counter number_of_battles_not_autoresolved 0
        set_counter number_of_battles_not_autoresolved_size_2 0
        set_counter number_of_battles_not_autoresolved_size_3 0
        set_counter number_of_battles_not_autoresolved_size_4 0
        set_counter number_of_battles_not_autoresolved_size_5 0
        set_counter number_of_battles_not_autoresolved_size_6 0
        set_counter number_of_battles_not_autoresolved_size_7 0
        set_counter number_of_battles_not_autoresolved_size_8 0
        
        set_counter number_of_battles_won_not_autoresolved 0
        set_counter number_of_battles_won_not_autoresolved_size_2 0
        set_counter number_of_battles_won_not_autoresolved_size_3 0
        set_counter number_of_battles_won_not_autoresolved_size_4 0
        set_counter number_of_battles_won_not_autoresolved_size_5 0
        set_counter number_of_battles_won_not_autoresolved_size_6 0
        set_counter number_of_battles_won_not_autoresolved_size_7 0
        set_counter number_of_battles_won_not_autoresolved_size_8 0
    
    
        set_counter number_of_battles_lost_not_autoresolved 0
        set_counter number_of_battles_lost_not_autoresolved_size_2 0
        set_counter number_of_battles_lost_not_autoresolved_size_3 0
        set_counter number_of_battles_lost_not_autoresolved_size_4 0
        set_counter number_of_battles_lost_not_autoresolved_size_5 0
        set_counter number_of_battles_lost_not_autoresolved_size_6 0
        set_counter number_of_battles_lost_not_autoresolved_size_7 0
        set_counter number_of_battles_lost_not_autoresolved_size_8 0
    
    
    
    
        ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    BATTLE COUNTERS
        monitor_event BattleConflictPhaseCommenced not IsFactionAIControlled
    
    
            log --- (1) Script start : Personally fought battle - counters at the beginning of the battle
    
    
            log --- (1a) Zeroing counters before each battle -----------------
            
            set_counter small_enemy_army_bf 0
            set_counter medium_enemy_army_bf 0
            set_counter large_enemy_army_bf 0
            set_counter huge_enemy_army_bf 0
            
            set_counter small_own_corps_bf 0
            set_counter medium_own_corps_bf 0
            set_counter large_own_corps_bf 0
            set_counter huge_own_corps_bf 0
    
    
            set_counter this_battle_being_fought 0
            set_counter size_difference_of_battle_being_fought 0
    
    
            set_counter size_of_battle_being_fought 0
            set_counter size_of_battle_being_fought_2 0
            set_counter size_of_battle_being_fought_3 0
            set_counter size_of_battle_being_fought_4 0
            set_counter size_of_battle_being_fought_5 0
            set_counter size_of_battle_being_fought_6 0
            set_counter size_of_battle_being_fought_7 0
            set_counter size_of_battle_being_fought_8 0
        
            log --- (1b) This battle ------------------------------------------
            
            set_counter this_battle_being_fought 1
            
            log --- (1c) Set size of enemy army -------------------------------
            
            if I_BattleEnemyArmyNumberOfUnits < 6
            and I_BattleEnemyArmyNumberOfUnits > 1
                set_counter small_enemy_army_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattleEnemyArmyNumberOfUnits < 11
            and I_BattleEnemyArmyNumberOfUnits > 5
                set_counter medium_enemy_army_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattleEnemyArmyNumberOfUnits < 16
            and I_BattleEnemyArmyNumberOfUnits > 10
                set_counter large_enemy_army_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattleEnemyArmyNumberOfUnits > 15
                set_counter huge_enemy_army_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
    
    
            log --- (1d) Set size of own army ----------------------------------
            
            if I_BattlePlayerArmyNumberOfUnits < 6
                and I_BattlePlayerArmyNumberOfUnits > 1
                set_counter small_own_corps_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattlePlayerArmyNumberOfUnits < 11
                and I_BattlePlayerArmyNumberOfUnits > 5
                set_counter medium_own_corps_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattlePlayerArmyNumberOfUnits < 16
                and I_BattlePlayerArmyNumberOfUnits > 10
                set_counter large_own_corps_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
            if I_BattlePlayerArmyNumberOfUnits > 15
                set_counter huge_own_corps_bf 1
                inc_counter size_of_battle_being_fought 1
            end_if
    
    
            log --- (1e) Set size of advantage -----------------------------------
            
            if I_CompareCounter small_enemy_army_bf == 1
            and I_CompareCounter small_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 1            ; 1: equal number of units
            end_if
    
    
            if I_CompareCounter medium_enemy_army_bf == 1
            and I_CompareCounter medium_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 1
            end_if
    
    
            if I_CompareCounter large_enemy_army_bf == 1
            and I_CompareCounter large_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 1
            end_if
            
            if I_CompareCounter huge_enemy_army_bf == 1
            and I_CompareCounter huge_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 1
            end_if    
    
    
            if I_CompareCounter medium_enemy_army_bf == 1
            and I_CompareCounter small_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 2            ; 2: player has 1-8 units units fewer than the AI
            end_if
    
    
            if I_CompareCounter large_enemy_army_bf == 1
            and I_CompareCounter medium_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 2
            end_if
            
            if I_CompareCounter huge_enemy_army_bf == 1
            and I_CompareCounter large_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 2
            end_if
    
    
            if I_CompareCounter large_enemy_army_bf == 1
            and I_CompareCounter small_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 3            ; 3: player has 6-13 units units fewer than the AI
            end_if
    
    
            if I_CompareCounter huge_enemy_army_bf == 1
            and I_CompareCounter medium_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 3
            end_if
    
    
            if I_CompareCounter huge_enemy_army_bf == 1
            and I_CompareCounter small_own_corps_bf == 1
                set_counter size_difference_of_battle_being_fought 4            ; 4: player has 11-18 units units fewer than the AI
            end_if
    
    
            log --- (1f) Set overal size of the battle ---------------------------------
    
    
            if I_CompareCounter size_of_battle_being_fought == 2
                set_counter size_of_battle_being_fought_2 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 3
                set_counter size_of_battle_being_fought_3 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 4
                set_counter size_of_battle_being_fought_4 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 5
                set_counter size_of_battle_being_fought_5 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 6
                set_counter size_of_battle_being_fought_6 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 7
                set_counter size_of_battle_being_fought_7 1
            end_if
            if I_CompareCounter size_of_battle_being_fought == 8
                set_counter size_of_battle_being_fought_8 1
            end_if
    
    
            log ------ (1) Script end : Personally fought battle - counters
        end_monitor
    
    
    
    
        ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    PLAYER VICTORIOUS
        monitor_event PostBattle not IsFactionAIControlled
            and WonBattle
            and not I_ConflictType Naval
            and not I_ConflictType Withdraw
            and not I_ConflictType Siege
            and I_CompareCounter this_battle_being_fought = 1
    
    
            log --- (2) Script start : After a personally fought battle WON (money from looting, counters of battle)
    
    
            set_counter this_battle_being_fought 0
    
    
            log --- (2a) Set number of battles fought personally and won of particular size -------
    
    
            if I_CompareCounter size_of_battle_being_fought_2 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_2 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_2 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_3 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_3 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_3 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_4 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_4 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_4 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_5 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_5 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_5 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_6 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_6 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_6 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_7 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_7 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_7 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_8 == 1
                inc_counter number_of_battles_won_not_autoresolved_size_8 1
                inc_counter number_of_battles_won_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_8 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
    
    
            log --- (2b) Historic event and choice for player -------------
    
    
            set_event_counter general_was_generous_to_his_troops 0
    
    
            historic_event BATTLE_CAMP_SACKED_ENEMY true
            
            while I_EventCounter BATTLE_CAMP_SACKED_ENEMY_accepted == 0
            and I_EventCounter BATTLE_CAMP_SACKED_ENEMY_declined == 0
            end_while
            
            if I_EventCounter BATTLE_CAMP_SACKED_ENEMY_accepted 1
                set_event_counter general_was_generous_to_his_troops 1                ; used only below to determine plunder from this battle
                inc_event_counter general_was_generous_to_his_troops_this_turn 1    ; used - and zeroed - in script .... to determine impact on FL trait
            end_if
            if I_EventCounter BATTLE_CAMP_SACKED_ENEMY_declined 1
                set_event_counter general_was_generous_to_his_troops 0
            end_if
    
    
            log --- (2c) Loot from the enemy camp ------------------------------
    
    
            if I_EventCounter early_era == 1
    
    
                if I_CompareCounter small_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 100                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                        console_command add_money 100                                ; armies equal
                    end_if
                    if I_EventCounter faction_size_smallormedium == 1
                        console_command add_money 100                                ; bonus for smaller factions
                    end_if
                end_if
                
                if I_CompareCounter medium_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 200                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 200                                ; armies equal
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 200                            ; our army weaker by 1-8 units
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 200                            ; bonus for smaller factions
                        end_if
                    end_if
                end_if
                
                if I_CompareCounter large_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 300
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 300
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 300
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 300
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 300
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 400
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 400
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 400
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 400
                                if I_CompareCounter size_difference_of_battle_being_fought > 3
                                and RandomPercent < 75                            
                                    console_command add_money 400                            
                                end_if
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 400
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            if I_EventCounter high_era == 1
    
    
                if I_CompareCounter small_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 200                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                        console_command add_money 200                                ; armies equal
                    end_if
                    if I_EventCounter faction_size_smallormedium == 1
                        console_command add_money 200                                ; bonus for smaller factions
                    end_if
                end_if
                
                if I_CompareCounter medium_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 400                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 400                                ; armies equal
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 400                            ; our army weaker by 1-8 units
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 400                            ; bonus for smaller factions
                        end_if
                    end_if
                end_if
                
                if I_CompareCounter large_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 600
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 600
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 600
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 600
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 600
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 800
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 800
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 800
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 800
                                if I_CompareCounter size_difference_of_battle_being_fought > 3
                                and RandomPercent < 75                            
                                    console_command add_money 800                            
                                end_if
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 800
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            if I_EventCounter late_era == 1
    
    
                if I_CompareCounter small_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 400                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                        console_command add_money 400                                ; armies equal
                    end_if
                    if I_EventCounter faction_size_smallormedium == 1
                        console_command add_money 400                                ; bonus for smaller factions
                    end_if
                end_if
                
                if I_CompareCounter medium_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 800                                ; base value
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 800                                ; armies equal
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 800                            ; our army weaker by 1-8 units
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 800                            ; bonus for smaller factions
                        end_if
                    end_if
                end_if
                
                if I_CompareCounter large_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 1200
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 1200
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 1200
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 1200
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 1200
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_enemy_army_bf = 1
                    if I_CompareCounter general_was_generous_to_his_troops == 0
                        console_command add_money 1600
                    end_if
                    if I_CompareCounter size_difference_of_battle_being_fought > 0
                    and RandomPercent < 75
                        console_command add_money 1600
                        if I_CompareCounter size_difference_of_battle_being_fought > 1
                        and RandomPercent < 75
                            console_command add_money 1600
                            if I_CompareCounter size_difference_of_battle_being_fought > 2
                            and RandomPercent < 75
                                console_command add_money 1600
                                if I_CompareCounter size_difference_of_battle_being_fought > 3
                                and RandomPercent < 75                            
                                    console_command add_money 1600                            
                                end_if
                            end_if
                        end_if
                        if I_EventCounter faction_size_smallormedium == 1
                            console_command add_money 1600
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            log ------ (2) Script end : After a personally fought battle WON
            
        end_monitor
    
    
    
    
        ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    PLAYER DEFEATED
        monitor_event PostBattle not IsFactionAIControlled
            and not WonBattle
            and not I_ConflictType Naval
            and not I_ConflictType Withdraw
            and not I_ConflictType Siege
            and I_CompareCounter this_battle_being_fought = 1
    
    
            log --- (3) Script start : After a personally fought battle LOST (money looted, counters of battle)
            
            set_counter this_battle_being_fought 0
    
    
            log --- (3a) Set number of battles fought personally and LOST of particular size -------
    
    
            if I_CompareCounter size_of_battle_being_fought_2 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_2 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_2 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_3 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_3 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_3 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_4 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_4 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_4 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_5 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_5 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_5 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_6 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_6 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_6 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_7 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_7 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_7 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            if I_CompareCounter size_of_battle_being_fought_8 == 1
                inc_counter number_of_battles_lost_not_autoresolved_size_8 1
                inc_counter number_of_battles_lost_not_autoresolved 1
                inc_counter number_of_battles_not_autoresolved_size_8 1
                inc_counter number_of_battles_not_autoresolved 1
            end_if
            
            log --- (3b) Historic event ------------------------------------------
            
            historic_event BATTLE_CAMP_SACKED_OUR
    
    
            log --- (3c) Money looted from our camp ------------------------------
            
            if I_EventCounter early_era == 1
            
                if I_CompareCounter small_own_corps_bf = 1
                    console_command add_money -100
                end_if
                
                if I_CompareCounter medium_own_corps_bf = 1
                    console_command add_money -200
                    if I_CompareCounter size_difference_of_battle_being_fought < 1
                    and RandomPercent < 75
                        console_command add_money -200
                    end_if
                end_if
                
                if I_CompareCounter large_own_corps_bf = 1
                    console_command add_money -300
                    if I_CompareCounter size_difference_of_battle_being_fought < 2
                    and RandomPercent < 75
                        console_command add_money -300
                        if I_CompareCounter size_difference_of_battle_being_fought < 1
                        and RandomPercent < 75
                            console_command add_money -300
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_own_corps_bf = 1
                    console_command add_money -400
                    if I_CompareCounter size_difference_of_battle_being_fought < 3
                    and RandomPercent < 75
                        console_command add_money -400
                        if I_CompareCounter size_difference_of_battle_being_fought < 2
                        and RandomPercent < 75
                            console_command add_money -400
                            if I_CompareCounter size_difference_of_battle_being_fought < 1
                            and RandomPercent < 75
                                console_command add_money -400
                            end_if
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            if I_EventCounter high_era == 1
            
                if I_CompareCounter small_own_corps_bf = 1
                    console_command add_money -200
                end_if
                
                if I_CompareCounter medium_own_corps_bf = 1
                    console_command add_money -400
                    if I_CompareCounter size_difference_of_battle_being_fought < 1
                    and RandomPercent < 75
                        console_command add_money -400
                    end_if
                end_if
                
                if I_CompareCounter large_own_corps_bf = 1
                    console_command add_money -600
                    if I_CompareCounter size_difference_of_battle_being_fought < 2
                    and RandomPercent < 75
                        console_command add_money -600
                        if I_CompareCounter size_difference_of_battle_being_fought < 1
                        and RandomPercent < 75
                            console_command add_money -600
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_own_corps_bf = 1
                    console_command add_money -800
                    if I_CompareCounter size_difference_of_battle_being_fought < 3
                    and RandomPercent < 75
                        console_command add_money -800
                        if I_CompareCounter size_difference_of_battle_being_fought < 2
                        and RandomPercent < 75
                            console_command add_money -800
                            if I_CompareCounter size_difference_of_battle_being_fought < 1
                            and RandomPercent < 75
                                console_command add_money -800
                            end_if
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            if I_EventCounter late_era == 1
            
                if I_CompareCounter small_own_corps_bf = 1
                    console_command add_money -400
                end_if
                
                if I_CompareCounter medium_own_corps_bf = 1
                    console_command add_money -800
                    if I_CompareCounter size_difference_of_battle_being_fought < 1
                    and RandomPercent < 75
                        console_command add_money -800
                    end_if
                end_if
                
                if I_CompareCounter large_own_corps_bf = 1
                    console_command add_money -1200
                    if I_CompareCounter size_difference_of_battle_being_fought < 2
                    and RandomPercent < 75
                        console_command add_money -1200
                        if I_CompareCounter size_difference_of_battle_being_fought < 1
                        and RandomPercent < 75
                            console_command add_money -1200
                        end_if
                    end_if
                end_if
    
    
                if I_CompareCounter huge_own_corps_bf = 1
                    console_command add_money -1600
                    if I_CompareCounter size_difference_of_battle_being_fought < 3
                    and RandomPercent < 75
                        console_command add_money -1600
                        if I_CompareCounter size_difference_of_battle_being_fought < 2
                        and RandomPercent < 75
                            console_command add_money -1600
                            if I_CompareCounter size_difference_of_battle_being_fought < 1
                            and RandomPercent < 75
                                console_command add_money -1600
                            end_if
                        end_if
                    end_if
                end_if
    
    
            end_if
    
    
            log ------ (3) Script end : Personally fought battle LOST
        end_monitor
        ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
    Code:
    ;========================================================
    ;----- FL giving plunder money to soldiers --------------
    ; one may make it more complicated, eg. if the decision is contrary to policies or character (Dread?)
    ; to be analysed how it would impact on the FL policies
    ; perhaps not possible to link to particular general, but maybe it's possible?
    
    
    ;--------------------------------------------------------
    Trigger Generous_FL_giving_plunder_after_battle_1
        WhenToTest CharacterTurnStart
    
    
        Condition IsFactionLeader
            and FactionIsLocal
            and I_EventCounter general_was_generous_to_his_troops_this_turn_1 > 0
    
    
     Affects Generous 1 Chance 5
     Affects NonAuthoritarian 1 Chance 5
     Affects ThinksOfHisPeople 1 Chance 5
     Affects GreedyRuler -1 Chance 5
    
    
    
    
    ;--------------------------------------------------------
    Trigger Generous_FL_giving_plunder_after_battle_2
        WhenToTest CharacterTurnStart
    
    
        Condition IsFactionLeader
            and FactionIsLocal
            and I_EventCounter general_was_generous_to_his_troops_this_turn_2 > 0
    
    
     Affects Generous 1 Chance 10
     Affects NonAuthoritarian 1 Chance 10
     Affects KindRuler 1 Chance 5
     Affects ThinksOfHisPeople 1 Chance 5
     Affects GreedyRuler -1 Chance 5
     
    ;--------------------------------------------------------
    Trigger Generous_FL_giving_plunder_after_battle_3
        WhenToTest CharacterTurnStart
    
    
        Condition IsFactionLeader
            and FactionIsLocal
            and I_EventCounter general_was_generous_to_his_troops_this_turn_3 > 0
    
    
     Affects Generous 1 Chance 10
     Affects NonAuthoritarian 1 Chance 10
     Affects KindRuler 1 Chance 5
     Affects ThinksOfHisPeople 1 Chance 5
     Affects GreedyRuler -1 Chance 5
     Affects StrategyChivalry 1 Chance 5
     Affects KingsAuthority -1 Chance 3
    Last edited by Jurand of Cracow; June 13, 2023 at 09:03 AM.

Posting Permissions

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