Page 2 of 5 FirstFirst 12345 LastLast
Results 21 to 40 of 84

Thread: Script for selecting the heir - (Update 24.07.2015)

  1. #21

    Default Re: Script for select the heir

    In the BareGeomod does work the script, because the Grand Campaign runs through the Kingdoms.

    .BAT file:
    cd ..\..
    start kingdoms.exe @mods\Bare_Geomod\Configuration.cfg
    Last edited by Miguel_80; April 27, 2015 at 06:48 PM.

  2. #22
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Setting Heirs to your preference

    I noticed that there is no provision for a new selection when the successor dies before becoming heir - which will terminate the script. This is little script should take of that. It is advisable to remove the 'BattleGeneralKilled' monitor as that might trigger in tandem.

    Code:
    declare_counter checking
        
        ; --- resetting the counter for 'Is the successor alive?'
        monitor_event FactionTurnEnd FactionType slave
            set_counter checking 1
        end_monitor
    
        ; --- Is the successor alive?
        monitor_event CharacterTurnEnd CharacterIsLocal
            and I_TurnNumber > 0
            and Trait HeirCandidate > 0
            set_counter checking 2
        end_monitor
    
        ; --- The successor is dead, trigger new selection in next round
        monitor_event FactionTurnEnd FactionIsLocal
            and I_CompareCounter checking = 1
            and I_CompareCounter candidate = 0
            historic_event select_candidate true
            set_counter first_candidate 1
        end_monitor










  3. #23

    Default Re: Script for selecting the heir

    Excellent idea Gigantus! But I have a little problem. The event will be triggered without having a "adopted" General. I should add a counter that indicates that there is already a family member available.




    But if I add the counter, there may be factions with large families that don't adopt anyone. I think that this could be a possible solution (balance the turns):

    Code:
    declare_counter checking
        
        ; --- resetting the counter for 'Is the successor alive?'
        monitor_event FactionTurnEnd FactionType slave
            set_counter checking 1
        end_monitor
    
        ; --- Is the successor alive?
        monitor_event CharacterTurnEnd CharacterIsLocal
            and I_TurnNumber > 5
            and Trait HeirCandidate > 0
            set_counter checking 2
        end_monitor
    
        ; --- The successor is dead, trigger new selection in next round
        monitor_event FactionTurnEnd FactionIsLocal
            and I_CompareCounter checking = 1
            and I_CompareCounter candidate = 0
            historic_event select_candidate true
            set_counter first_candidate 1
        end_monitor
    Last edited by Miguel_80; July 21, 2015 at 01:58 PM.

  4. #24
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir

    That sounds sensible - I have now altered the monitor to use an increasing counter ('repeat') to delay the selection process by five rounds.
    Also added is a 'declined' monitor that sets the counter to zero and with a message that explains to the player that the selection process will be repeated in 5 rounds.
    Another addition is the exclusion of factions with teutonic family tree as you will not be able to select a successor there (no family tree scroll).

    No change in EDCT

    historic_events - did some proof reading and updating of instructions
    Code:
    {SELECT_CANDIDATE_BODY}By following the instructions below you may select a character who will have an excellent chance to become the next faction heir when the current heir or leader dies.\n\n Instructions:\n After accepting, the "Family Tree" window will appear. Select (left click) the portrait of the family member you would like to designate as the potential successor. Only a live, male adult that is not already leader or heir will qualify. To confirm your selection left click the high lighted locator button at the bottom left of the "Family Tree" window.\n Should you decide not to choose any eligible family member or there is none available then simply close the "Family Tree" window, you will be reminded in a few rounds again. You may also open the "Family Tree" window in any other round and still choose a successor.
    {SELECT_CANDIDATE_TITLE}Select the next Heir
    {SELECTED_BODY}The selected general will have rights of inheritance to the throne, following by the current heir.
    {SELECTED_TITLE}Inheritance privileges granted
    {DECLINED_BODY}You have declined to make use of the option to select a successor. Should no successor be selected otherwise then you will be presented with the opportunity again in 5 rounds
    {DECLINED_TITLE}Select option declined
    campaign script
    Code:
        declare_counter candidate
        declare_counter first_candidate
        declare_counter checking
        declare_counter repeat
    
        ; --- allow selection of successor in first round - OPTIONAL!!!! - requires extended family tree for all non-teutonic factions
        monitor_event FactionTurnStart FactionIsLocal
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
            terminate_monitor
        end_monitor
    
        ; --- regular trigger events
        monitor_event CeasedFactionLeader CharacterIsLocal
            and I_CompareCounter candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
        end_monitor
        monitor_event CeasedFactionHeir CharacterIsLocal
            and I_CompareCounter candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
        end_monitor
        monitor_event BrotherAdopted CharacterIsLocal
            and I_TurnNumber >= 0
            and I_CompareCounter candidate = 0
            and I_CompareCounter first_candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
            terminate_monitor
        end_monitor
    
        ; --- resetting the counter for 'Is there a successor?'
        monitor_event FactionTurnEnd FactionType slave
            set_counter checking 1
        end_monitor
    
        ; --- Is there a successor?
        monitor_event CharacterTurnEnd CharacterIsLocal
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            and Trait HeirCandidate > 0
            set_counter checking 2
        end_monitor
    
        ; --- There is no successor, trigger selection in five rounds
        monitor_event FactionTurnEnd FactionIsLocal
            and I_CompareCounter checking = 1
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            inc_counter repeat 1
            if I_CompareCounter repeat > 5
                historic_event SELECT_CANDIDATE true
                set_counter first_candidate 1
            end_if
        end_monitor
    
        ; --- regular selection, acceptance
        monitor_event EventCounter EventCounterType SELECT_CANDIDATE_accepted
            and I_EventCounter SELECT_CANDIDATE_accepted = 1
            select_ui_element faction_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            select_ui_element family_tree_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            select_ui_element faction_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            ui_flash_start family_tree_zoom_to_button
            set_event_counter SELECT_CANDIDATE_accepted 0
            set_counter candidate 1
            set_counter repeat 0
        end_monitor
        
        ; --- regular selection, declined
        monitor_event EventCounter EventCounterType SELECT_CANDIDATE_declined
            and I_EventCounter SELECT_CANDIDATE_declined = 1
            historic_event DECLINED
            set_event_counter SELECT_CANDIDATE_declined 0
            set_counter repeat 0
        end_monitor
    
        ; --- selection process
        monitor_event CharacterSelected CharacterIsLocal
            and I_CompareCounter candidate = 1
            and I_ScrollOpen family_tree_scroll
            and IsGeneral
            and not IsFactionLeader
            and not IsFactionHeir
            ui_flash_stop
            console_command give_trait this HeirCandidate 1
            set_counter candidate 0
            historic_event SELECTED
        end_monitor
    Last edited by Gigantus; July 22, 2015 at 03:54 AM.










  5. #25

    Default Re: Script for selecting the heir

    Good thinking Gigantus. But wouldn't it be simpler as well? Until no there has been an "adoption", the script will not act.

    Code:
    	declare_counter candidate
    	declare_counter first_candidate
    	declare_counter checking
    	declare_counter general_adopted
    
    	monitor_event CeasedFactionHeir CharacterIsLocal
    		and I_CompareCounter candidate = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    	end_monitor
    
    	monitor_event BrotherAdopted CharacterIsLocal
    		and I_TurnNumber >= 0
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter general_adopted 1
    
    		terminate_monitor		
    	end_monitor
    
        	monitor_event FactionTurnEnd FactionType slave
            	set_counter checking 1
       	end_monitor
    
        	monitor_event CharacterTurnEnd CharacterIsLocal
            	and I_TurnNumber > 0
            	and Trait HeirCandidate > 0
    
            	set_counter checking 2
        	end_monitor
    
       	monitor_event FactionTurnEnd FactionIsLocal
            	and I_CompareCounter checking = 1
            	and I_CompareCounter general_adopted = 1
            	and I_CompareCounter candidate = 0
    
            	historic_event select_candidate true
            	set_counter first_candidate 1
        	end_monitor
    
    	monitor_event EventCounter EventCounterType select_candidate_accepted
    		and I_EventCounter select_candidate_accepted = 1
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element family_tree_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		ui_flash_start family_tree_zoom_to_button
    		set_event_counter select_candidate_accepted 0
    		set_counter candidate 1
    		
    	end_monitor
    
    	monitor_event CharacterSelected CharacterIsLocal
    		and I_CompareCounter candidate = 1
    		and I_ScrollOpen family_tree_scroll
    		and IsGeneral
              	and not IsFactionLeader
              	and not IsFactionHeir
    
    		ui_flash_stop
    		console_command give_trait this HeirCandidate 1
    		set_counter candidate 0
    		historic_event selected
    
    	end_monitor

    Regarding the "decline" option. I'm in favour of that if the user doesn't want to choose heir, not appear never more the option. Giving by understanding that he is not interested choose heir.

    Code:
    	declare_counter candidate
    	declare_counter first_candidate
    	declare_counter checking
    	declare_counter general_adopted
    	declare_counter decline_sh
    ......
    
       	monitor_event FactionTurnEnd FactionIsLocal
            	and I_CompareCounter checking = 1
            	and I_CompareCounter general_adopted = 1
            	and I_CompareCounter decline_sh = 0
            	and I_CompareCounter candidate = 0
    
            	historic_event select_candidate true
            	set_counter first_candidate 1
        	end_monitor
    ......
    
    	monitor_event EventCounter EventCounterType select_candidate_declined
    		and I_EventCounter select_candidate_declined = 1
    
    		set_counter decline_sh 1
    	end_monitor

    On the option "teutonic family tree", would be significant to add it. Initially, I designed the script to the vanilla campaign and the four expansions. Obviously, if one adds the script in another mod, the user should customize it.

    Code:
    not FactionType teutonic_order

    P.S: And yes, the first option I had in mind. I warned in the Post #5 and it is updated at the end of the first post.

  6. #26
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir

    Going the adopted route is a way (quite elegant if I may say so) - but it doesn't cover coming of age and marriage. I think I would rather delay the initial testing for a successor instead, I_TurnNumber > 10
    As to the declining - you got a point there, there should be enough curiosity for any user to check it out at least once. Which means 'decline' should terminate the script. I think I will go the middle line - I'll use an incremental counter that will allow one repeat.

    Code:
        declare_counter stop_select
        
        ; add a terminating "if" loop to all monitors
            if I_CompareCounter stop_select > 1
                terminate_monitor
            end_if
    
        ; --- selection offer declined
        monitor_event EventCounter EventCounterType SELECT_CANDIDATE_declined
            and I_EventCounter SELECT_CANDIDATE_declined = 1
            inc_counter stop_select 1
            if I_CompareCounter stop_select > 1
                set_event_counter SELECT_CANDIDATE_declined 0
                terminate_monitor
            end_if
            if I_CompareCounter stop_select < 2
                historic_event HE_SELECT_DECLINED
                set_event_counter SELECT_CANDIDATE_declined 0
                set_counter repeat 0
            end_if
        end_monitor
    Last edited by Gigantus; July 22, 2015 at 07:08 AM.










  7. #27

    Default Re: Script for selecting the heir

    It's a good option.

    Quote Originally Posted by Gigantus View Post
    but it doesn't cover coming of age and marriage. I think I would rather delay the initial testing for a successor instead, I_TurnNumber > 10
    Then it can add both options, "BrotherAdopted" or 10th turn. For example:

    Code:
    	declare_counter candidate
    	declare_counter first_candidate
    	declare_counter checking
    	declare_counter active_heir_bucle
    
        	monitor_event FactionTurnStart I_TurnNumber > 9
            	set_counter active_heir_bucle 1
       	end_monitor
    
    	monitor_event CeasedFactionHeir CharacterIsLocal
    		and I_CompareCounter candidate = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		
    	end_monitor
    
    	monitor_event BrotherAdopted CharacterIsLocal
    		and I_TurnNumber >= 0
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter active_heir_bucle 1
    
    		terminate_monitor		
    	end_monitor
    
        	monitor_event FactionTurnEnd FactionType slave
            	set_counter checking 1
       	end_monitor
    
        	monitor_event CharacterTurnEnd CharacterIsLocal
            	and I_TurnNumber > 0
            	and Trait HeirCandidate > 0
    
            	set_counter checking 2
        	end_monitor
    
       	monitor_event FactionTurnEnd FactionIsLocal
            	and I_CompareCounter checking = 1
            	and I_CompareCounter active_heir_bucle = 1
            	and I_CompareCounter candidate = 0
    
            	historic_event select_candidate true
            	set_counter first_candidate 1
        	end_monitor
    
    	monitor_event EventCounter EventCounterType select_candidate_accepted
    		and I_EventCounter select_candidate_accepted = 1
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element family_tree_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		ui_flash_start family_tree_zoom_to_button
    		set_event_counter select_candidate_accepted 0
    		set_counter candidate 1
    		
    	end_monitor
    
    	monitor_event CharacterSelected CharacterIsLocal
    		and I_CompareCounter candidate = 1
    		and I_ScrollOpen family_tree_scroll
    		and IsGeneral
              	and not IsFactionLeader
              	and not IsFactionHeir
    
    		ui_flash_stop
    		console_command give_trait this HeirCandidate 1
    		set_counter candidate 0
    		historic_event selected
    
    	end_monitor

  8. #28

    Default Re: Script for selecting the heir

    looks like a very interesting script

  9. #29

    Default Re: Script for selecting the heir

    Yes Stevietheconquer, thanks to Gigantus, this script already close to perfection.

    By the way, I've been doing testing, and the marriage of the Princess with a general, triggers the event "BrotherAdopted". With adding this event, the needs would be covered.

    Code:
    	monitor_event CharacterComesOfAge FactionIsLocal
    		and IsGeneral
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
            	and I_CompareCounter active_heir_bucle = 0
    		
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter active_heir_bucle 1
    
    		terminate_monitor		
    	end_monitor
    
    	monitor_event BrotherAdopted CharacterIsLocal
    		and I_TurnNumber >= 0
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
            	and I_CompareCounter active_heir_bucle = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter active_heir_bucle 1
    
    		terminate_monitor		
    	end_monitor
    Obviously, if in a Mod it starts with extensive family trees, the script must trigger at the beginning of the game.

  10. #30
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir

    Will you be updating the opening post with the complete script?

    You will be pleased to know that I have used your (older version) script in Rise of three Kingdoms and have incorporated the newer version into Europa Barbaorum II (ver 2.03).










  11. #31

    Default Re: Script for selecting the heir

    Quote Originally Posted by Gigantus View Post
    Will you be updating the opening post with the complete script?
    Yes, in principle I've updated it with this. I think it more practical. It covers all deaths of the candidate heir and always have an available character at the first selecting.

    Code:
    	declare_counter candidate
    	declare_counter first_candidate
    	declare_counter checking
    	declare_counter active_heir_bucle
    	declare_counter decline_sh
    
    
    	monitor_event CeasedFactionHeir CharacterIsLocal
    		and I_CompareCounter candidate = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		
    	end_monitor
    
    	monitor_event BrotherAdopted CharacterIsLocal
    		and I_TurnNumber >= 0
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
            	and I_CompareCounter active_heir_bucle = 0
    
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter active_heir_bucle 1
    
    		terminate_monitor		
    	end_monitor
    
    	monitor_event CharacterComesOfAge FactionIsLocal
    		and IsGeneral
    		and I_CompareCounter candidate = 0
    		and I_CompareCounter first_candidate = 0
            	and I_CompareCounter active_heir_bucle = 0
    		
    		historic_event select_candidate true
    		set_counter first_candidate 1
    		set_counter active_heir_bucle 1
    
    		terminate_monitor		
    	end_monitor
    
        	monitor_event FactionTurnEnd FactionType slave
            	set_counter checking 1
       	end_monitor
    
        	monitor_event CharacterTurnEnd CharacterIsLocal
            	and I_TurnNumber > 0
            	and Trait HeirCandidate > 0
    
            	set_counter checking 2
        	end_monitor
    
       	monitor_event FactionTurnEnd FactionIsLocal
            	and I_CompareCounter checking = 1
            	and I_CompareCounter active_heir_bucle = 1
            	and I_CompareCounter decline_sh = 0
            	and I_CompareCounter candidate = 0
    
            	historic_event select_candidate true
            	set_counter first_candidate 1
        	end_monitor
    
    	monitor_event EventCounter EventCounterType select_candidate_accepted
    		and I_EventCounter select_candidate_accepted = 1
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element family_tree_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		select_ui_element faction_button
    		simulate_mouse_click lclick_down
    		simulate_mouse_click lclick_up
    
    		ui_flash_start family_tree_zoom_to_button
    		set_event_counter select_candidate_accepted 0
    		set_counter candidate 1
    		
    	end_monitor
    
    	monitor_event CharacterSelected CharacterIsLocal
    		and I_CompareCounter candidate = 1
    		and I_ScrollOpen family_tree_scroll
    		and IsGeneral
              	and not IsFactionLeader
              	and not IsFactionHeir
    
    		ui_flash_stop
    		console_command give_trait this HeirCandidate 1
    		set_counter candidate 0
    		historic_event selected
    
    	end_monitor
    
    	monitor_event EventCounter EventCounterType select_candidate_declined
    		and I_EventCounter select_candidate_declined = 1
    
    		set_counter decline_sh 1
    	end_monitor

    Quote Originally Posted by Gigantus View Post
    You will be pleased to know that I have used your (older version) script in Rise of three Kingdoms and have incorporated the newer version into Europa Barbaorum II (ver 2.03).
    Of course, it's a pleasure for me to do something that may be useful for other modders, and furthermore to include it in their projects. Also taking into account the high level of knowledge you have.

  12. #32

    Default Re: Script for selecting the heir (Update 24.07.2015)

    do you have too put in some historic eventpics too every culture?


    edit;downloaded the file and saw there the eventpics,thanks very much all modders!
    Last edited by stevietheconquer; July 24, 2015 at 05:05 PM.

  13. #33
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir (Update 24.07.2015)

    One more suggestion - upload the compressed file here at TWC, that way you can easily update it without having to bother about links and it will not get lost (like so many other good tutorials). The best section would be Minor Mods and Tweaks in the Medieval II Total War section.










  14. #34

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    Many thanks for the advice Gigantus. Actually I didn't know that an normal user could upload files, I thought it was for "Artifex", "Citizen" or other ranges. Now it's much more practical and elegant.

    http://www.twcenter.net/forums/downl...o=file&id=4212

  15. #35
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    I have been making use of this for a while now - came very handy every time I updated one of my tutorials. No need to update links. Plus it's always a nice and cozy feeling when you look in your profile page, the 'download' section and see how many times it has been downloaded.










  16. #36

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    Yes, it's true. In the case of this thread in particular is very useful, because whenever it is modified, the tabulations of the lines of code are unbalance.

    By the way, If you have included the "CeasedFactionLeader" monitor, you need to delete it. It was an initial mistake in the script. It causes the appearance of two messages in the event of the death of the leader. With the death of the leader, also ceases the heir ("CeasedFactionHeir"), to become the new leader.

  17. #37
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,125
    Blog Entries
    35

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    Did you update the download from the first post accordingly?










  18. #38

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    I commented simply as a precaution, just in case. For this reason:

    Quote Originally Posted by Gigantus View Post
    campaign script
    Code:
        declare_counter candidate
        declare_counter first_candidate
        declare_counter checking
        declare_counter repeat
    
        ; --- allow selection of successor in first round - OPTIONAL!!!! - requires extended family tree for all non-teutonic factions
        monitor_event FactionTurnStart FactionIsLocal
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
            terminate_monitor
        end_monitor
    
        ; --- regular trigger events
        monitor_event CeasedFactionLeader CharacterIsLocal
            and I_CompareCounter candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
        end_monitor
        monitor_event CeasedFactionHeir CharacterIsLocal
            and I_CompareCounter candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
        end_monitor
        monitor_event BrotherAdopted CharacterIsLocal
            and I_TurnNumber >= 0
            and I_CompareCounter candidate = 0
            and I_CompareCounter first_candidate = 0
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            historic_event SELECT_CANDIDATE true
            set_counter first_candidate 1
            terminate_monitor
        end_monitor
    
        ; --- resetting the counter for 'Is there a successor?'
        monitor_event FactionTurnEnd FactionType slave
            set_counter checking 1
        end_monitor
    
        ; --- Is there a successor?
        monitor_event CharacterTurnEnd CharacterIsLocal
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            and Trait HeirCandidate > 0
            set_counter checking 2
        end_monitor
    
        ; --- There is no successor, trigger selection in five rounds
        monitor_event FactionTurnEnd FactionIsLocal
            and I_CompareCounter checking = 1
            and not FactionType [faction name]        ; exclude factions with teutonic family tree
            inc_counter repeat 1
            if I_CompareCounter repeat > 5
                historic_event SELECT_CANDIDATE true
                set_counter first_candidate 1
            end_if
        end_monitor
    
        ; --- regular selection, acceptance
        monitor_event EventCounter EventCounterType SELECT_CANDIDATE_accepted
            and I_EventCounter SELECT_CANDIDATE_accepted = 1
            select_ui_element faction_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            select_ui_element family_tree_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            select_ui_element faction_button
            simulate_mouse_click lclick_down
            simulate_mouse_click lclick_up
            ui_flash_start family_tree_zoom_to_button
            set_event_counter SELECT_CANDIDATE_accepted 0
            set_counter candidate 1
            set_counter repeat 0
        end_monitor
        
        ; --- regular selection, declined
        monitor_event EventCounter EventCounterType SELECT_CANDIDATE_declined
            and I_EventCounter SELECT_CANDIDATE_declined = 1
            historic_event DECLINED
            set_event_counter SELECT_CANDIDATE_declined 0
            set_counter repeat 0
        end_monitor
    
        ; --- selection process
        monitor_event CharacterSelected CharacterIsLocal
            and I_CompareCounter candidate = 1
            and I_ScrollOpen family_tree_scroll
            and IsGeneral
            and not IsFactionLeader
            and not IsFactionHeir
            ui_flash_stop
            console_command give_trait this HeirCandidate 1
            set_counter candidate 0
            historic_event SELECTED
        end_monitor
    This monitor ("CeasedFactionLeader"), I deleted it time ago.
    Last edited by Miguel_80; July 26, 2015 at 04:52 AM.

  19. #39
    Flinn's Avatar His Dudeness of TWC
    Patrician Citizen Consul Content Emeritus spy of the council

    Join Date
    Dec 2012
    Location
    Italy
    Posts
    20,366
    Blog Entries
    46

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    It's with great pleasure that the Modding Awards Committee informs you that this tool/resource has been awarded in the recent 2016 Modding Awards, as seen here! Please feel free to stop by and check the list of all the winners.

    Also, don't forget to check
    here for more details about how to promote the victory of your tool/resource.

    If any question about please feel free to use the
    Discussion thread.

    Flinn,
    On behalf of the Modding Awards Committee
    Under the patronage of Finlander, patron of Lugotorix & Lifthrasir & joerock22 & Socrates1984 & Kilo11 & Vladyvid & Dick Cheney & phazer & Jake Armitage & webba 84 of the Imperial House of Hader

  20. #40

    Default Re: Script for selecting the heir - (Update 24.07.2015)

    I wanted to ask you can your mod make a script for the annexation of the faction by making marriages for the fashion of DLV? And the script of the heir for DLV?

Page 2 of 5 FirstFirst 12345 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
  •