Page 1 of 2 12 LastLast
Results 1 to 20 of 31

Thread: Solved: Require Governor for specific buildings.

  1. #1
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Solved: Require Governor for specific buildings.

    Heres a different thought. Anyone know of a way to make creation of a building dependant upon a governor without doing it with the auto manage?

    What I mean is this, I want the player to be able to control everything as normal with the Manage All Settlements checked, except for one or two buildings I only want to be able to create with a governor in the city.

    I know I can, and indeed have, created buildings through scripts and triggers with all kinds of requirements. I am looking for something I can add to the EDB file.

    Solution

    Ever wanted to make it impossible for only certain kinds of buildings to be built when no governor is present? Even when Manage All Settlements is selected? Do this:

    In the EDB file:
    Code:
    and event_counter governor_present 1
    This sets a requirement on the building for an event to be present.

    In campaign_script.txt
    Code:
    monitor_event FactionTurnEnd FactionIsLocal
         set_event_counter governor_present 1
    end_monitor
    
    monitor_event SettlementSelected GovernorInResidence
         set_event_counter governor_present 1
    end_monitor
    
    monitor_event SettlementSelected not GovernorInResidence
         and FactionIsLocal
         set_event_counter governor_present 0
    end_monitor
    alpaca figured out how to shorten it up so you dont have to script it for each settlement.

    You can move a character back and forth all day as long as you have movement points, and the building will come and go every time. THis only effects the player, the AI can still build everything, the player can build everything except the buildings with this line in the requrements section:

    and event_counter governor_present 1
    Last edited by GrnEyedDvl; July 06, 2008 at 12:22 AM. Reason: Moved solution to first post in thread.

  2. #2

    Default Re: Governors

    It's currently impossible. Kingdoms will add this feature, however.

  3. #3
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Aw that sucks lol thanks

  4. #4
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Governors

    Yeah it's possible with a script. It's part of the Restricted City Access feature I am developing for Italia Invicta:
    Code:
    monitor_event SettlementSelected SettlementName Florence
    	if I_EventCounter local_faction == 6
    		if I_CharacterTypeNearTile tuscany named_character, 0 109, 128
    			set_event_counter character_present 1
    			campaign_wait 0.01
    		end_if
    		if not I_CharacterTypeNearTile tuscany named_character, 0 109, 128
    			set_event_counter character_present 0
    		end_if
    	end_if
    end_monitor
    Then set your buildings to:
    Code:
    roads requires factions { all, } and event_counter character_present 1
    The only caveat is that you have to do this for each settlement with the appropriate coordinates and for each faction (the factions copying the ifs and the settlements copying the whole trigger).

    No thing is everything. Every thing is nothing.

  5. #5
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Thanks alpaca, thats better than nothing. I actually had another idea to try this morning while I was at work but not sure if it will work or not. I will try them both and let you know.

  6. #6
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Governors

    Quote Originally Posted by GrnEyedDvl View Post
    Thanks alpaca, thats better than nothing. I actually had another idea to try this morning while I was at work but not sure if it will work or not. I will try them both and let you know.
    Well if you can find a better way I'd love to hear it. I can guarantee you my script works because I actually tested it

    No thing is everything. Every thing is nothing.

  7. #7
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Better? LOL I dunno about that but theres always more than one way to skin a cat.

    What are you using this line for?
    I_EventCounter local_faction == 6

    The rest is pretty straightforward but since I dont know what sets that counter I have no idea what its purpose is. Something unrelated but specific to your mod?

  8. #8
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Governors

    Right, I forgot to explain. This script is only for the player because I figured the AI couldn't handle it anyways.
    The counter holds the faction the player controls, and 6 stands for tuscany.

    No thing is everything. Every thing is nothing.

  9. #9
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Wouldnt it be easier to use FactionIsLocal and have the character_present have a default value of 1? Set it to 0 when FactionIsLocal and not CharacterTypeNearTile?

    This is how I was considering doing it except I thought there was a GovernorPresent condition, it turns out that condition is GovernorInResidence.

    I am going to try using that as a condition instead of character near tile.

  10. #10
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Governors

    Quote Originally Posted by GrnEyedDvl View Post
    Wouldnt it be easier to use FactionIsLocal and have the character_present have a default value of 1? Set it to 0 when FactionIsLocal and not CharacterTypeNearTile?

    This is how I was considering doing it except I thought there was a GovernorPresent condition, it turns out that condition is GovernorInResidence.

    I am going to try using that as a condition instead of character near tile.
    Yeah that's probably a better idea. Trying to remember why I didn't use GovernorInResidence...

    Small reminder: You have to set the counter to the default again at FactionTurnEnd or else the AI will sometimes not be able to do anything

    No thing is everything. Every thing is nothing.

  11. #11
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Quote Originally Posted by alpaca View Post
    Small reminder: You have to set the counter to the default again at FactionTurnEnd or else the AI will sometimes not be able to do anything
    Yes the default always needs to be set a 1 or the AI wont be able to build some stuff.

    Something like:
    monitor_event SettlementSelected SettlementName Florence
    if not GovernorInResidence
    and FactionIsLocal
    set_event_counter character_present 0
    end_if
    end_monitor

    monitor_event FactionTurnEnd FactionIsLocal
    set_event_counter character_present 1
    end_monitor

    I will test that one in a few.
    Last edited by GrnEyedDvl; July 05, 2007 at 07:34 PM. Reason: forgot the "not"

  12. #12
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Ok I am having some issues with it. I am trying all kinds of possibilities.

  13. #13
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    I am testing with London and the counter requirement is on the entire Church tree, small_church through cathedral.

    In the EDB file:
    milan, } and event_counter governor_present 1

    Run the game, church not available, just as it should be.

    Put this in the script:
    monitor_event FactionTurnEnd FactionIsLocal
    set_event_counter governor_present 1
    end_monitor

    Run the game, church not available, click TurnEnd, Church is available just as it should be.

    Put this in the script:
    monitor_event SettlementSelected SettlementName London
    set_event_counter governor_present 1
    end_monitor

    Church is available before TurnEnd, as it should be.



    Put this in the script:
    monitor_event SettlementSelected SettlementName London
    if GovernorInResidence
    set_event_counter governor_present 1
    end_if
    end_monitor

    Script fails church not available.



    Put this in the script:
    monitor_event SettlementSelected SettlementName London
    if GovernorInResidence London
    set_event_counter governor_present 1
    end_if
    end_monitor

    Script fails church not available.


    monitor_event SettlementSelected SettlementName London
    if GovernorInResidence London TrueCondition
    set_event_counter governor_present 1
    end_if
    end_monitor

    Script fails church not available


    Put this in the script:
    monitor_event SettlementSelected SettlementName London
    if FactionIsLocal
    set_event_counter governor_present 1
    end_if
    end_monitor

    Script fails church not available.




    monitor_event SettlementSelected SettlementName London GovernorInResidence
    set_event_counter governor_present 1
    end_monitor

    Script runs Church available. Move character out of settlement, select some other stuff, select London church still available. There was nothing to set value to 0. Changed FactionTurnEnd to set governor_present 0, start game, move character, turn end church still abailable. Script fails.

  14. #14
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Governors

    Ok I got it, its so damn simple I couldnt figure it out.


    In the EDB file:
    milan, } and event_counter governor_present 1


    In campaign_script.txt
    monitor_event FactionTurnEnd FactionIsLocal
    set_event_counter governor_present 1
    end_monitor

    monitor_event SettlementSelected SettlementName London
    and not GovernorInResidence
    and FactionIsLocal
    set_event_counter governor_present 0

    end_monitor

    monitor_event SettlementSelected SettlementName London
    and GovernorInResidence
    set_event_counter governor_present 1
    end_monitor



    You can move a character back and forth all day as long as you have movement points, and the building will come and go every time.

  15. #15
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Solved: Require Governor for specific buildings.

    I don't think you even need the SettlementName anymore, the GovernorInResidence should return the right state for the selected settlement.

    No thing is everything. Every thing is nothing.

  16. #16
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Solved: Require Governor for specific buildings.

    You are right this works:


    monitor_event SettlementSelected London
    and not GovernorInResidence
    and FactionIsLocal
    set_event_counter governor_present 0
    end_monitor

    monitor_event SettlementSelected London
    and GovernorInResidence
    set_event_counter governor_present 1
    end_monitor

  17. #17
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Solved: Require Governor for specific buildings.

    Actually what I meant is using

    monitor_event SettlementSelected GovernorInResidence

    ...

    end_monitor


    monitor_event SettlementSelected not GovernorInResidence

    ...

    end_monitor

    No thing is everything. Every thing is nothing.

  18. #18
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Solved: Require Governor for specific buildings.

    Ah I see let me try.

  19. #19
    GrnEyedDvl's Avatar Liberalism is a Socially Transmitted Disease
    Artifex Technical Staff

    Join Date
    Jan 2007
    Location
    Denver CO
    Posts
    23,851
    Blog Entries
    10

    Default Re: Solved: Require Governor for specific buildings.

    This works:

    monitor_event SettlementSelected GovernorInResidence
    set_event_counter governor_present 1
    end_monitor

    monitor_event SettlementSelected not GovernorInResidence
    and FactionIsLocal
    set_event_counter governor_present 0
    end_monitor

    I didnt think it would. Now you dont have to script the possibility for each settlement. Thanks for shortening that up aplaca.

  20. #20
    alpaca's Avatar Harbinger of saliva
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    4,811

    Default Re: Solved: Require Governor for specific buildings.

    Quote Originally Posted by GrnEyedDvl View Post
    This works:

    monitor_event SettlementSelected GovernorInResidence
    set_event_counter governor_present 1
    end_monitor

    monitor_event SettlementSelected not GovernorInResidence
    and FactionIsLocal
    set_event_counter governor_present 0
    end_monitor

    I didnt think it would. Now you dont have to script the possibility for each settlement. Thanks for shortening that up aplaca.
    Actually the version you did before was exactly the same because you used an invalid condition which the game treats as being true (which is quite often a pain in the butt)

    No thing is everything. Every thing is nothing.

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

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