Results 1 to 10 of 10

Thread: Checking whether a city is the capital or not

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Checking whether a city is the capital or not

    I'm working on an extended settlement upkeep script, and it is supposed to charge different amounts depending on settlement level, whether or not a governor is present, and whether or not the settlement is the capital. Now, the first part works just fine, the different levels of settlement part. Tested it in vanilla. The second part and third part I am testing now, and I am most certainly being overcharged!

    The thing is, do 'and FactionCapital' or 'and not FactionCapital' work in the campaign_script.txt? Below is the script (ignore the 'inflationon' bit, I copied and pasted this from the mod the script is going to be included in, it doesn't matter at the moment).

    HTML Code:
    ;1 - Governor and without inflation, not capital
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_pallisade
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -100
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -200
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -400
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = large_stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -800
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = huge_stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -1600
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = motte_and_bailey
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -100
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = wooden_castle
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -200
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = castle
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -400
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = fortress
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -800
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = citadel
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -1600
    end_monitor 
    
    ;2 - No governor and without inflation, not capital
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_pallisade
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -150
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -300
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -600
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = large_stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -1200
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = huge_stone_wall
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -2400
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = motte_and_bailey
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -150
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = wooden_castle
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -300
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = castle
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -600
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = fortress
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -1200
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = citadel
    	and not FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -2400
    end_monitor 
    
    ;3 - Governor and capital
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_pallisade
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -125
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_wall
    	and I_EventCounter inflationon = 0
    	and FactionCapital
    	and GovernorInResidence
    	console_command add_money -250
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -500
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = large_stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -1000
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = huge_stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -2000
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = motte_and_bailey
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -125
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = wooden_castle
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -250
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = castle
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -500
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = fortress
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -1000
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = citadel
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and GovernorInResidence
    	console_command add_money -2000
    end_monitor 
    
    ;2 - No governor and capital
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_pallisade
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -175
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = wooden_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -350
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -700
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = large_stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -1400
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType city
    	and SettlementBuildingExists = huge_stone_wall
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -2800
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = motte_and_bailey
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -175
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = wooden_castle
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -350
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = castle
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -700
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = fortress
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -1400
    end_monitor
    
    monitor_event SettlementTurnEnd FactionIsLocal
    	and SettlementType castle
    	and SettlementBuildingExists = citadel
    	and FactionCapital
    	and I_EventCounter inflationon = 0
    	and not GovernorInResidence
    	console_command add_money -2800
    end_monitor

  2. #2
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Checking whether a city is the capital or not

    There is no condition called FactionCapital.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  3. #3
    Swagger's Avatar Imperial Coffee-Runner
    Join Date
    Apr 2007
    Location
    Portugal
    Posts
    12,453

    Default Re: Checking whether a city is the capital or not

    and DistanceToCapital = 0
    (out of my head)

    the 0 indicates it's 0 tiles away from the capital, thus being IN the tile the capital is.


    this only works on characters i think.
    Under the Patronage of the Dreadful cedric37!
    Ancs Guide, Emergent Factions , Yes/No Events |L'Outremer for Modders| Swagger's Skymod


  4. #4
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Checking whether a city is the capital or not

    The condition is DistanceCapital according to the docudemons and it requires an event that exports a character record.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  5. #5
    Swagger's Avatar Imperial Coffee-Runner
    Join Date
    Apr 2007
    Location
    Portugal
    Posts
    12,453

    Default Re: Checking whether a city is the capital or not

    Quote Originally Posted by Sqυιd View Post
    The condition is DistanceCapital according to the docudemons and it requires an event that exports a character record.
    i said so.
    Under the Patronage of the Dreadful cedric37!
    Ancs Guide, Emergent Factions , Yes/No Events |L'Outremer for Modders| Swagger's Skymod


  6. #6
    Squid's Avatar Opifex
    Patrician Artifex Technical Staff

    Join Date
    Feb 2007
    Location
    Frozen waste lands of the north
    Posts
    17,751
    Blog Entries
    3

    Default Re: Checking whether a city is the capital or not

    You said you thought it did, I was confirming it and corrected the condition name.
    Under the patronage of Roman_Man#3, Patron of Ishan
    Click for my tools and tutorials
    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe." -----Albert Einstein

  7. #7
    Gorrrrrn's Avatar Citizen
    Join Date
    Jan 2007
    Location
    here
    Posts
    5,546

    Default Re: Checking whether a city is the capital or not

    AI can and does move a faction capital around when it feels its necessary - to place it in the geographical centre to minimise distance to capital penalties I presume.
    you can preselect capital as a hidden_resource for settlements you want to designate as such.
    but the AI won't use that to decide where the actual capital is.
    Is being the faction capital that important to the mod?

  8. #8

    Default Re: Checking whether a city is the capital or not

    Oh well...looks like I can only have a two tier system, settlement upkeep with a governor and without a governor (and with/without inflation effects).

    The whole idea was that the capital would require more in the way of upkeep, as it is the capital afterall. More spent on maintaining it and cleaning up than any other settlement. Since I can't actually tell the script to detect whether a city is the capital or not, then...

    I've considered implementing this in the edb, but I don't want it to hit the AI (yes, it's something to penalise the player - the AI has enough trouble as is). The hidden resource feature might work for capitals, but then it won't address differences in upkeep when a governor is or isn't present, it'd be fixed (as possible extra costs for only the capital).

    EDIT: Wait, it is possible for bonuses/negative effects to only apply to the player or AI through the edb, isn't it? I recall the AI in Deus Lo Vult getting unit recruitment bonuses from walls, but the player certainly doesn't.

  9. #9
    Gigantus's Avatar I am not special - I am a limited edition.
    Moderator Emeritus Administrator Emeritus

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    52,682
    Blog Entries
    35

    Default Re: Checking whether a city is the capital or not

    It would get convoluted but you could use 'CharacterTurnEndInSettlement', then test for distance to capital, test for the settlement name (IsRegionOneOf), test for faction. (I really don't want to think how long that script would be). Two variables with possibly 190 and 30 values = 5700 variants.










  10. #10

    Default Re: Checking whether a city is the capital or not

    Ouch! That really is convoluted! I'd have a nightmare testing that. Yeah...I think with and without governor works just fine. LOL.

Posting Permissions

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