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

Thread: Solved: Require Governor for specific buildings.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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
    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.

  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

    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.

  10. #10
    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.

  11. #11
    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.

  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: 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

  13. #13
    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.

  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: Solved: Require Governor for specific buildings.

    Ah I see let me try.

  15. #15
    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.

  16. #16
    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.

  17. #17
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Solved: Require Governor for specific buildings.

    I have tried to make this working with recruit lines, but did not succeed:



    The code in the script is unchanged.

    When I start the game I am not able to recruit said knights anywhere, even when a governor is present:



    On the next turn in return the knights are available everywhere even when no governor is present:



    Follows, the game is correctly recognizing the event_counter as a requirement but does not update the recruitment panel during the turn; it does so when the counter is set to 1 at the end of the player's turn.


    I have then tried freez_recruit_pool. It didn't work with "freez true" and "freeze false" on SettlementSelected, but worked somewhat when unfreezing the pool on SettlementTurnEnd:



    When I start the game I can recruit if a governor is present. When I move this governor out of the settlement the pool is frozen. But I when I move him back into town the pool remains frozen (even when using this as condition in script).


    But when using SettlementTurnEnd to unfreeze the pool it works that the pool is unfrozen the next turn:



    This is close to what I wanted, but not realy it. I want to make specific units availbale depending on certain characters being present. And I thought of limiting it to one monitor. Anything else I can try here?

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  18. #18

    Icon1 Re: Solved: Require Governor for specific buildings.

    konny: have you tried using the ‘e_select_settlement’ command with the ‘freeze_recruit_pool’ command.
    Maybe even a ‘this’ will work with the ‘freeze_recruit_pool’ command?
    Code:
    	monitor_event SettlementSelected GovernorInResidence
    		and SettlementIsLocal
    		e_select_settlement
    		freeze_recruit_pool this false
    	end_monitor
    
    	monitor_event SettlementSelected not GovernorInResidence
    		and SettlementIsLocal
    		e_select_settlement
    		freeze_recruit_pool this true
    	end_monitor

  19. #19
    konny's Avatar Artifex
    Join Date
    Jul 2007
    Location
    Germania Inferior
    Posts
    3,631

    Default Re: Solved: Require Governor for specific buildings.

    Code:
        monitor_event SettlementSelected GovernorInResidence
            and SettlementIsLocal
            e_select_settlement
            freeze_recruit_pool this false
        end_monitor
    
        monitor_event SettlementSelected not GovernorInResidence
            and SettlementIsLocal
            e_select_settlement
            freeze_recruit_pool this true
        end_monitor
    I don't think that e_select would help: The settlement already is selected.

    I think the game is not able to update the recruit pool during a turn, it only is able to freeze but not to unfreeze it. But may be I am overlooking something?

    Team member of: Das Heilige Römische Reich, Europa Barbarorum, Europa Barbarorum II, East of Rome
    Modding help by Konny: Excel Traitgenerator, Setting Heirs to your preference
    dHRR 0.8 beta released! get it here
    New: Native America! A mini-mod for Kingdoms America

  20. #20
    /|\/|\/|\/|\/|\/|\/
    Join Date
    Jun 2005
    Posts
    10,770

    Default Re: Solved: Require Governor for specific buildings.

    Quote Originally Posted by konny View Post
    I think the game is not able to update the recruit pool during a turn, it only is able to freeze but not to unfreeze it.
    That is correct AFAIK. I think that if a change to recuitment pools is made then it will not be effected until the next faction's turn. For this reason it makes sense to apply changes like this during the rebel faction's turn so that all proper factions will benefit in that turn. For example; if the event fires during the players turn then it will not affect the player until the next turn, but it will affect every AI faction in that turn since they come after the player. Prefactionturnstart is useful here.
    Last edited by Taiji; March 16, 2010 at 02:41 PM.

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
  •