Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

Posted

I have progressed a little, by un-hiding windows. In fact the first event does fire and triggers event RSLT.2 which in turn triggers event RSLT.3 after I had changed it from a character_event to a province_event. Something that surprised me is that event .2 shows  province 264 as ROOT but also show province 19 as FROM. Now where does that come from?

Events .4 and .5 don't fire. Event .4 is a province_event and event .5 is a narrative_event. I don't know if that is correct, how do you know when to switch?

 

I have included the whole chain.

 

Spoiler

namespace = RSLT

#Slave trade events
# Set up  ROOT is Province Slesvig
province_event = {
    id = RSLT.1
    hide_window = yes
    
    
    
    trigger = {
            264 = {
                OR = {
                    has_building = rsl_slave_market_1
                    has_building = rsl_slave_market_2
                    has_building = rsl_slave_market_3
                    has_building = rsl_slave_dungeon_1
                    has_building = rsl_slave_dungeon_2
                    has_building = rsl_slave_dungeon_3
                    has_building = rsl_slave_wagon_1
                    has_building = rsl_slave_wagon_2
                    has_building = rsl_slave_wagon_3
                    has_building = rsl_slave_wagon_4
                    has_building = rsl_slave_wagon_5
                    has_building = rsl_slave_port_1
                    has_building = rsl_slave_port_2
                    has_building = rsl_slave_port_3
                    has_building = rsl_slave_pen_1
                    has_building = rsl_slave_pen_2
                    has_building = rsl_slave_pen_3
                }
                NOT = { has_province_flag = slave_trade_north }
            }
    }    
                
    mean_time_to_happen = {
            days = 1
            
    }        
        

    immediate = {
            264 = {
                if = {
                    limit = {
                            OR = {
                                has_building = rsl_slave_market_1
                                has_building = rsl_slave_market_2
                                has_building = rsl_slave_market_3
                                has_building = rsl_slave_dungeon_1
                                has_building = rsl_slave_dungeon_2
                                has_building = rsl_slave_dungeon_3
                                has_building = rsl_slave_wagon_1
                                has_building = rsl_slave_wagon_2
                                has_building = rsl_slave_wagon_3
                                has_building = rsl_slave_wagon_4
                                has_building = rsl_slave_wagon_5
                                has_building = rsl_slave_port_1
                                has_building = rsl_slave_port_2
                                has_building = rsl_slave_port_3
                                has_building = rsl_slave_pen_1
                                has_building = rsl_slave_pen_2
                                has_building = rsl_slave_pen_3
                            }
                            NOT = { has_province_flag = slave_trade_north }
                    }
                
                        province_event = { id = RSLT.2 days = 1 }
                        set_province_flag = slave_trade_north
                }
            }                    
            
        
    }
}
# Set up
province_event = {
    id = RSLT.2

    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                has_province_flag = slave_trade_north
            }
            c_hamburg = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }
        }
        else_if = {
            limit = {
                has_province_flag = slave_trade_east
            }
            c_oland = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }
        }
        else = {
            c_holland = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }        
        }

        
    }
    option = {
    name = ok
    }
}
#
province_event = {
    id = RSLT.3

    is_triggered_only = yes

    trigger = {
        any_province = {
            OR = {
                region = world_europe_north
                region = world_europe_east
                
            }
            NOT = { distance = { who = ROOT value = 1000 }}
            religion = ROOT
        }
    }

    immediate = {
        random_province = {
            limit = {
                OR = {
                    region = world_europe_north
                    region = world_europe_east
                    
                }
                NOT = { distance = { who = ROOT value = 1000 }}
                religion = ROOT
            }
            set_province_flag = slave_trader_spawn
            province_event = { id = RSLT.4 }
        }
        any_playable_ruler = {
            limit = {
                religion = ROOT
            }
            narrative_event = { id = RSLT.5 }
        }
    }
    
    option = {
    name = ok
    }
}
# Set Up
province_event = {
    id = RSLT.4
#    hide_window = yes
    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                has_global_flag = qa_testing
            }
            province_event = { id = RSLT.6 days = 1 }
        }
        else = {
            province_event = { id = RSLT.6 days = 1 }
        }
    }
    option = {
    name = ok
    }
}
narrative_event = {
    id = RSLT.5
    desc = EVTDESC_HFP_42305
    title = EVTTITLE_HFP_42305
    picture = GFX_evt_beatification
    border = GFX_event_narrative_frame_religion
    portrait = FROM
    is_triggered_only = yes

    option = {
        name = EVTOPTA_HFP_42305
    }
}
# Final set Up
province_event = {
    id = RSLT.6
#    hide_window = yes
    is_triggered_only = yes

    trigger = {
        any_landed_title = {
            tier = COUNT
            OR = {
                kingdom = {
                    title = d_moravia
                }
                kingdom = {
                    title = d_pommerania
                }
            }
            
        }
    }

    immediate = {
        random_province = {
            limit = {
                has_province_flag = slave_trader_spawn
            }
            clr_province_flag = slave_trader_spawn
            save_event_target_as = slave_trade_province
            owner = {
                create_random_soldier = {
                    random_traits = yes
                    dynasty = none
                    religion = THIS
                    culture = THIS
                    age = 25
                }
                new_character = {
                    save_event_target_as = rsl_slave_trader
                    create_title = {
                        tier = COUNT
                        culture = danish
                        landless = yes
                        adventurer = yes
                        temporary = no
                        name = "SLAVE_TRADER"
                        holder = THIS
                    }
                    add_trait = brave
                    add_trait = ambitious
                    add_trait = greedy
                    add_trait = cruel
                    set_focus = focus_business
                    add_ambition = obj_amass_wealth
                    set_character_flag = slave_trader
                    spawn_unit = {
                        province = ROOT
                        home = ROOT
                        owner = THIS
                        can_toggle_looting = yes
                        troops = {
                            light_infantry = { 4000 4000 }
                        }
                        attrition = 0
                    }
                    random_landed_title = {
                        limit = {
                            tier = COUNT
                            OR = {
                                kingdom = {
                                    title = d_pommerania
                                }
                                kingdom = {
                                    title = d_moravia
                                }
                            }
                            
                        }
                        preferred_limit = {
                            owner = {
                                OR = {
                                    AND = {
                                        independent = yes
                                        tier = KING
                                    }
                                    top_liege = {
                                        tier = KING
                                    }
                                }
                            }
                        }
                        preferred_limit = {
                            owner = {
                                OR = {
                                    AND = {
                                        independent = yes
                                        tier = DUKE
                                    }
                                    top_liege = {
                                        tier = DUKE
                                    }
                                }
                            }
                        }
                        kingdom = {
                            save_event_target_as = kingdom_target
                        }
                        owner = {
                            if = {
                                limit = {
                                    independent = yes
                                }
                                event_target:rsl_slave_trader = {
                                    unsafe_war = {
                                        target = PREV
                                        casus_belli = pagan_subjugation
                                        thirdparty_title = event_target:kingdom_target
                                        tier = KING
                                    }
                                }
                            }
                            else = {
                                top_liege = {
                                    event_target:slave_trader = {
                                        unsafe_war = {
                                            target = PREV
                                            casus_belli = pagan_subjugation
                                            thirdparty_title = event_target:kingdom_target
                                            tier = KING
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                save_event_target_as = slavers_owner
            }
        }
        any_playable_ruler = {
            narrative_event = { id = RSLT.7 }
        }
    }
    option = {
    name = ok
    }
}

 

Posted
1 hour ago, joemann said:

There are seven event in all, copied from vanilla with some modifications. Validator has no issues and each event tested in the console seems to work, but running it in a new game doesn't fire the visible events.

I don't think you understand how the trigger block works -- or how scopes work in general. You have very messy code and you're duplicating the trigger conditions in your immediate block, as well as messing scopes up all over the place.

 

Province 19 is FROM because RSLT.1 is triggering in every province at the same time, then scoping to province 264.

 

I looked over your code and cleaned it up like crazy, here is some code that should work:

Spoiler

namespace = RSLT

#Slave trade events

# This event triggers in Slesvig when a slave building is built there

province_event = {
    id = RSLT.1
    hide_window = yes
    
    trigger = {
            province = 264 # This only triggers if this province is 264 (Slesvig)
            
            OR = { # Must have a slave building
                has_building = rsl_slave_market_1
                has_building = rsl_slave_market_2
                has_building = rsl_slave_market_3
                has_building = rsl_slave_dungeon_1
                has_building = rsl_slave_dungeon_2
                has_building = rsl_slave_dungeon_3
                has_building = rsl_slave_wagon_1
                has_building = rsl_slave_wagon_2
                has_building = rsl_slave_wagon_3
                has_building = rsl_slave_wagon_4
                has_building = rsl_slave_wagon_5
                has_building = rsl_slave_port_1
                has_building = rsl_slave_port_2
                has_building = rsl_slave_port_3
                has_building = rsl_slave_pen_1
                has_building = rsl_slave_pen_2
                has_building = rsl_slave_pen_3
            }
            
            # Must not have slave trade flag
            NOT = { has_province_flag = slave_trade_north }
    }    
                
    mean_time_to_happen = {
            days = 1
    }        
        
    immediate = { 
    
        # Slave trade has begun
        set_province_flag = slave_trade_north
        
        # Choose a random province in North or East Europe, not more than 1000 distance away from Slesvig (this province), with the same religion as Slesvig, and fire the event that spawns the slave trader
        random_province = { 
            limit = {
                OR = {
                    region = world_europe_north
                    region = world_europe_east
                    
                }
                NOT = { distance = { who = ROOT value = 1000 }}
                religion = ROOT
            }
            province_event = { id = RSLT.6 }
        }
        
        # Tell all rulers of the same religion that the slave trade has spawned
        any_playable_ruler = {
            limit = {
                religion = ROOT
            }
            narrative_event = { id = RSLT.5 }
        }
    }
}

narrative_event = {
    id = RSLT.5
    title = "The Slave Trade"
    picture = GFX_evt_market
    desc = "The slave trade has appeared in Slesvig"
    is_triggered_only = yes
    
    option = {
        name = OK
    }
}

province_event = {
    id = RSLT.6
    hide_window = yes
    is_triggered_only = yes

 # There must be a Count in the Duchy of Moravia or the Duchy of Pommerania for this to trigger.
    trigger = {
        any_landed_title = {
            tier = COUNT
            OR = {
                kingdom = {
                    title = d_moravia
                }
                kingdom = {
                    title = d_pommerania
                }
            }
            
        }
    }

    immediate = {
    
        random_landed_title = { # Get a random character in the Ducky of Pomerania or Moravia, preferably an independent king or duke. Save them as slaver_target and their primary title as title_target
            limit = {
                tier = COUNT
                OR = {
                    kingdom = {
                        title = d_pommerania
                    }
                    kingdom = {
                        title = d_moravia
                    }
                }

            }
            preferred_limit = {
                owner = {
                    OR = {
                        AND = {
                            independent = yes
                            tier = KING
                        }
                        top_liege = {
                            tier = KING
                        }
                    }
                }
            }
            preferred_limit = {
                owner = {
                    OR = {
                        AND = {
                            independent = yes
                            tier = DUKE
                        }
                        top_liege = {
                            tier = DUKE
                        }
                    }
                }
            }
            kingdom = {
                save_event_target_as = title_target
            }
        }
    
        owner = { # In the court of ROOT (the province near Slesvig)...
            
            # Save this guy as the slaver's owner
            
            save_event_target_as = slavers_owner
            
            # Create a soldier
            create_random_soldier = { 
                random_traits = yes
                dynasty = none
                religion = THIS
                culture = THIS
                age = 25
            }
            
            # Give him all the slave trader traits, a landless Count-tier title, and an army
            new_character = {
            
                save_event_target_as = rsl_slave_trader
                create_title = {
                    tier = COUNT
                    culture = danish
                    landless = yes
                    adventurer = yes
                    temporary = no
                    name = "SLAVE_TRADER"
                    holder = THIS
                }
                add_trait = brave
                add_trait = ambitious
                add_trait = greedy
                add_trait = cruel
                set_focus = focus_business
                add_ambition = obj_amass_wealth
                set_character_flag = slave_trader
                spawn_unit = {
                    province = ROOT
                    home = ROOT
                    owner = THIS
                    can_toggle_looting = yes
                    troops = {
                        light_infantry = { 4000 4000 }
                    }
                    attrition = 0
                }
                
                # This character declares war on slaver_target with the Pagan Subjugation CB, with the objective of taking the title_target kingdom
                unsafe_war = {
                    target = event_target:slaver_target
                    casus_belli = pagan_subjugation
                    thirdparty_title = event_target:title_target
                    tier = KING
                }
            }
        }
    }
}

 

 

Posted

Thank you. I have corrected my event. By using province = 264 in the trigger, the event is only triggered in this province and that is why the console no longer shows FROM?

 

The notification message is nice but if I understand you correctly it is also mandatory if you want to see the rest of the event chain?

 

With these changes the events 1, 2 and 10 fire but I don't get event 3 and further to fire (I did get 3 before the changes though). What else is wrong?

Spoiler

# Set up
province_event = {
    id = RSLT.2
    hide_window = yes

    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                has_province_flag = slave_trade_north
            }
            c_hamburg = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }
        }
        else_if = {
            limit = {
                has_province_flag = slave_trade_east
            }
            c_oland = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }
        }
        else = {
            c_holland = {
                owner = {
                    province_event = { id = RSLT.3 }
                }
            }        
        }
    }
}
#
province_event = {
    id = RSLT.3

    is_triggered_only = yes

    trigger = {
        any_province = {
            OR = {
                region = world_europe_north
                region = world_europe_east
                
            }
            NOT = { distance = { who = ROOT value = 1000 }}
            religion = ROOT
        }
    }

    immediate = {
        random_province = {
            limit = {
                OR = {
                    region = world_europe_north
                    region = world_europe_east
                    
                }
                NOT = { distance = { who = ROOT value = 1000 }}
                religion = ROOT
            }
            set_province_flag = slave_trader_spawn
            province_event = { id = RSLT.4 }
        }
        
    }
    
    option = {
    name = ok
    }
}
# Set Up
province_event = {
    id = RSLT.4
#    hide_window = yes
    is_triggered_only = yes

    immediate = {
        if = {
            limit = {
                has_global_flag = qa_testing
            }
            province_event = { id = RSLT.6 days = 1 }
        }
        else = {
            province_event = { id = RSLT.6 days = 1 }
        }
    }
    option = {
    name = ok
    }
}

 

 

Posted

You seem to have updated the code after I wrote the above (or otherwise I only partly saw it ). Many thanks for your help especially the comments you added which really help me understand what you did. I'll play around with it and maybe come back with an additional question if you don't mind.

Posted

Tested your code in-game. However it doesn't work. Validator does not like  the <new_character> command ( I noticed vanilla doesn't use it in combination with <create_title>)

taking it out does not help though.

In unsafe war you use

 target = event_target:slaver_target

 

However this event target has not been previously defined. I don't suppose this would stop the whole event from working?

 

I am a bit lost now ?

 

 

Posted
5 hours ago, joemann said:

Tested your code in-game. However it doesn't work. Validator does not like  the <new_character> command ( I noticed vanilla doesn't use it in combination with <create_title>)

taking it out does not help though.

In unsafe war you use


 target = event_target:slaver_target

 

However this event target has not been previously defined. I don't suppose this would stop the whole event from working?

 

I am a bit lost now

 

 

It will need an event target assigned on the target province.

 

Try adding in an owner block in the immediate/random_landed_title block:

 

			owner = {
				save_event_target_as = slaver_target
			}
			kingdom = {
				save_event_target_as = title_target
			}

 

Posted

I added it but in it self it doesn't change the fact that event .2 doesn't fire.

 

Validator flags one issue which could be relevant because it concerns the block which fires the event/

Spoiler

--- Error 1 of 1 ---
At <mod>\events\RSLTrade.txt [province_event\immediate\random_province\limit\NOT\distance\who] (Line 53, column 38):
"ROOT" is not a valid ThisChar.
ROOT points to <ProvCommand>, not Char.
Additional information: ROOT points to <ProvCommand>, not Char.

 

How should I interpret this? Should event .2 be a character_event rather than a province event?

 

When I trigger the event in the console, it appears to run to the end but since it immediately triggers the (game over) chronicle screen it is difficult to verify. I can see an army of 4000 men spawning in Slsvejk though. Why do I get the chronicle screen?

Posted

I have another question which is I would like to work on after I get the above event working ( I am an optimist ?)

 

In the event on the drawing board, the slave_trader gets an army and a CB. However, what I would like him to do is not start a war but rather a series of raids/sieges where he can capture prisoners to enslave, thereby acquiring slaves to sell. The next step would be a decision to buy slaves from and sell slaves to the trader (I already have the selling part) . If then the ai could also start participating we would have a real market!

 

So the army would be set to looting. Does this require a CB (I don't think so) but if not, which commands would set the NPC slave trader on a looting spree?

Posted

I am slowly getting there. The event chain is as follows:

Spoiler

namespace = RSLT

#Slave trade events
# Set up  ROOT is Province Slesvig
province_event = {
    id = RSLT.1
    hide_window = yes
    
    
    
    trigger = {
            province = 264 # This only triggers if this province is 264 (Slesvig)
            
            OR = {
                has_building = rsl_slave_market_1
                has_building = rsl_slave_market_2
                has_building = rsl_slave_market_3
                has_building = rsl_slave_dungeon_1
                has_building = rsl_slave_dungeon_2
                has_building = rsl_slave_dungeon_3
                has_building = rsl_slave_wagon_1
                has_building = rsl_slave_wagon_2
                has_building = rsl_slave_wagon_3
                has_building = rsl_slave_wagon_4
                has_building = rsl_slave_wagon_5
                has_building = rsl_slave_port_1
                has_building = rsl_slave_port_2
                has_building = rsl_slave_port_3
                has_building = rsl_slave_pen_1
                has_building = rsl_slave_pen_2
                has_building = rsl_slave_pen_3
            }
            NOT = { has_province_flag = slave_trade_north }
            
    }    
                
    mean_time_to_happen = {
            days = 1
            
    }        
        

    immediate = {
            set_province_flag = slave_trade_north
            # Choose a random province in North or East Europe, not more than 1000 distance away from Slesvig (this province), with the same religion as Slesvig, and fire the event that spawns the slave trader
        random_province = {
            limit = {
                OR = {
                    region = world_europe_north
                    region = world_europe_east
                    
                }
                NOT = { distance = { who = ROOT value = 1200 }}
                religion = ROOT
            }
            province_event = { id = RSLT.2 }
        }
        # Tell all rulers of the same religion that the slave trade has spawned    
            any_player = {  
                        narrative_event = { id = RSLT.3 }        
            }    
    }
}
# Slave trade has appeared
narrative_event = {
    id = RSLT.3
    title = "The Slave Trade"
    picture = GFX_evt_market
    desc = "The slave trade has appeared in Slesvig"
    is_triggered_only = yes
    
    option = {
        name = OK
    }
}

 

# Final set Up
province_event = {
    id = RSLT.2
#    hide_window = yes
    is_triggered_only = yes        
# There must be a Count in the Duchy of Moravia or the Duchy of Pomerania for this to trigger.
    trigger = {
        any_landed_title = {
            tier = COUNT
            OR = {
                kingdom = {
                    title = k_moravia
                }
                kingdom = {
                    title = d_pommerania
                }
            }
            
        }
    }
    immediate = {
            random_landed_title = {            # Get a random character in the Ducky of Pomerania or Moravia, preferably an independent king or duke. Save them as slaver_target and their primary title as title_target
                        limit = {
                            tier = COUNT
                            OR = {
                                kingdom = {
                                title = k_moravia
                                }
                                kingdom = {
                                title = d_pommerania
                                }
                            }
                        }            
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = KING
                                                }
                                                    top_liege = {
                                                            tier = KING
                                                    }
                                            }
                                        }
                        }
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = DUKE
                                                }
                                                    top_liege = {
                                                            tier = DUKE
                                                    }
                                            }
                                        }
                        }
                        owner = {
                                save_event_target_as = rsl_slaver_target
                        }        
                        kingdom = {
                                save_event_target_as = rsl_title_target
                        }
                        
                        owner = {
                           # In the court of ROOT (the province near Sl esvig )...
                                                    
                                        create_random_soldier = {
                                                            random_traits = yes
                                                            dynasty = none
                                                            religion = THIS
                                                            culture = THIS
                                                            age = 25
                                                            
                                        }
                                        save_event_target_as = rsl_slave_trader

                                        # Give him all the slave trader traits, a landless Count-tier title, and an army
                                                                                
                                                        
                                                        create_title = {
                                                                    tier = COUNT
                                                                    culture = danish
                                                                    landless = yes
                                                                    adventurer = yes
                                                                    temporary = no
                                                                    name = "SLAVE_TRADER"
                                                                    holder = THIS
                                                        }
                                                                    add_trait = brave
                                                                    add_trait = ambitious
                                                                    add_trait = greedy
                                                                    add_trait = cruel
                                                                    set_focus = focus_business
                                                                    add_ambition = obj_amass_wealth
                                                                    set_character_flag = slave_trader
                                                        spawn_unit = {
                                                                province = ROOT
                                                                home = ROOT
                                                                owner = THIS
                                                                can_toggle_looting = yes
                                                                troops = {
                                                                        light_infantry = { 4000 4000 }
                                                                }
                                                                attrition = 0
                                                        }
                                                                                            
                                                        # This character declares war on rsl_slaver_target with the Pagan Subjugation CB, with the objective of taking the title_target kingdom
                                                        unsafe_war = {
                                                                target = event_target:rsl_slaver_target
                                                                casus_belli = pagan_subjugation
                                                                thirdparty_title = event_target:rsl_title_target
                                                                tier = KING
                                                        }
                                        
                        }
                    }
                }    
                
    
    option = {
        name = ok
    }
}                               

The first two events fire (.1 and .3). Event RSLT.2 still does not fire. Two possibilities: the trigger conditions are not met ( I checked in game and they seem to be fulfilled but when checking the event in the console it indicates that the Count tier is absent although in Moravia there are both counts and dukes present) or the issue raised by validator for RSLT.1 blocks it

Spoiler

Error 1 of 1 ---
At <mod>\events\RSLTrade.txt [province_event\immediate\random_province\limit\NOT\distance\who] (Line 53, column 38):
"ROOT" is not a valid ThisChar.
ROOT points to <ProvCommand>, not Char.
Additional information: ROOT points to <ProvCommand>, not Char.

 

 

Then there is a second issue. When I run event RSLT.2 in the console it now runs to the end but slave trader and slave target are one and the same character ( owner ) and the slave trader has a CB on himself. I suppose that the created soldier, title and army need to be created in a scope different from owner but what scope do I use and do I set it in the owner block or the random_landed_title block?

 

 

Posted
2 hours ago, joemann said:

                                kingdom = {
                                title = d_pommerania
                                }

That needs to be duchy = {

 

Change everything in the second owner block of the immediate to this:

 

Spoiler

			owner = {
				capital_scope = {
					PREV = {
						create_random_soldier = {
							random_traits = yes
							dynasty = none
							religion = THIS
							culture = THIS
							age = 25
											
						}
						new_character = {
							save_event_target_as = rsl_slave_trader
							add_trait = brave
							add_trait = ambitious
							add_trait = greedy
							add_trait = cruel
							set_focus = focus_business
							add_ambition = obj_amass_wealth
							set_character_flag = slave_trader
							# Give him all the slave trader traits, a landless Count-tier title, and an army
							create_title = {
								tier = COUNT
								culture = danish
								landless = yes
								adventurer = yes
								temporary = no
								name = "SLAVE_TRADER"
								holder = THIS
							}
							spawn_unit = {
								province = PREVPREV # Goes to owner's capital_scope
								home = PREVPREV # Goes to owner's capital_scope
								owner = THIS
								can_toggle_looting = yes
								troops = {
										light_infantry = { 4000 4000 }
								}
								attrition = 0
							}
																
							# This character declares war on rsl_slaver_target with the Pagan Subjugation CB, with the objective of taking the title_target kingdom
							unsafe_war = {
								target = event_target:rsl_slaver_target
								casus_belli = pagan_subjugation
								thirdparty_title = event_target:rsl_title_target
								tier = KING
							}
						}
					}
				}
			}

 

 

 

Posted

Many thanks! It worked. The event seems to trigger in game (although I don't get to see the event screen even though I unhid the window and inserted an opinion block)  because  the slave_trader was created with an army and a war which he won, thereby becoming king of Greater Moravia.

The latter is not my intention, I want him to wander around looting so I set the unit to is_looter and deleted the unsafe_war block.

 

When I do this, the slave trader is still created (I can find him with some difficulty in the character finder) but I can't locate him on the map and don't know if he has an army and what he is doing. Is there a trick to locate a character if right clicking on his portrait doesn't work?  (why doesn't it work)?

 

 

Posted
1 hour ago, joemann said:

The latter is not my intention, I want him to wander around looting so I set the unit to is_looter and deleted the unsafe_war block.

							spawn_unit = {
								province = PREVPREV # Goes to owner's capital_scope
								home = PREVPREV # Goes to owner's capital_scope
								owner = THIS
								can_toggle_looting = yes
								is_looter = yes
								troops = {
									light_infantry = { 4000 4000 }
								}
								attrition = 0
							}
																
							# This character declares war on rsl_slaver_target with the Pagan Subjugation CB, with the objective of taking the title_target kingdom
							any_army = {
								set_looting = yes
							}

 

1 hour ago, joemann said:

Is there a trick to locate a character if right clicking on his portrait doesn't work?  (why doesn't it work)?

You should be able to right click him if he's on the Find Character screen. Above the decisions, there's a Go to Location button.

Posted

Although the character has spawned I don't think he is physically on the map, nor is the army. I can find the character in the Find Character screen, the go to location button is active but when I click the button it "feels" dead. I would expect the army to be somewhere near the capital of Greater Moravia but there is no trace of it. Maybe a CB is a requirement?

 

Posted

Tried it but it does not change anything. I don't think all of the code of the event is executed. You would expect to get the event screen with the option< ok> but in game I do not get it.

If I fire the event in the console I do ( but even then I still can't find the army and the character on the map).

 

Spoiler

province_event = {
    id = RSLT.2
#    hide_window = yes
    is_triggered_only = yes        
# There must be a Count in the Duchy of Moravia or the Duchy of Pomerania for this to trigger.
    trigger = {
        any_landed_title = {
            tier = COUNT
            OR = {
                kingdom = {
                    title = k_moravia
                }
                duchy = {
                    title = d_pommerania
                }
            }
            
        }
    }
    immediate = {
            random_landed_title = {            # Get a random character in the Ducky of Pomerania or Moravia, preferably an independent king or duke. Save them as slaver_target and their primary title as title_target
                        limit = {
                            tier = COUNT
                            OR = {
                                kingdom = {
                                title = k_moravia
                                }
                                duchy = {
                                title = d_pommerania
                                }
                            }
                        }            
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = COUNT
                                                }
                                                    top_liege = {
                                                            tier = COUNT
                                                    }
                                            }
                                        }
                        }
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = DUKE
                                                }
                                                    top_liege = {
                                                            tier = DUKE
                                                    }
                                            }
                                        }
                        }
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = KING
                                                }
                                                    top_liege = {
                                                            tier = KING
                                                    }
                                            }
                                        }
                        }
                        owner = {
                                save_event_target_as = rsl_slaver_target
                        }        
                        kingdom = {
                                save_event_target_as = rsl_title_target
                        }
                        
                        owner = {
                                capital_scope = {
                                                PREV = {    
                                                    create_random_soldier = {
                                                                    random_traits = yes
                                                                    dynasty = none
                                                                    religion = THIS
                                                                    culture = THIS
                                                                    age = 25
                                                                    
                                                    }
                                                    # Give him all the slave trader traits, a landless Count-tier title, and an army
                                                    new_character = {                                
                                                        save_event_target_as = rsl_slave_trader
                                                        add_trait = brave
                                                        add_trait = ambitious
                                                        add_trait = greedy
                                                        add_trait = cruel
                                                        set_focus = focus_business
                                                        add_ambition = obj_amass_wealth
                                                        wealth = 200                      # give him some starting capital
                                                        set_character_flag = slave_trader
                                                        set_defacto_liege = THIS
                                                        create_title = {
                                                                    tier = COUNT
                                                                    culture = danish
                                                                    landless = yes
                                                                    adventurer = yes
                                                                    temporary = no
                                                                    name = "SLAVE_TRADER"
                                                                    holder = THIS
                                                        }
                                                                    
                                                        spawn_unit = {
                                                                province = PREVPREV #goes to owners capital scope
                                                                home = PREVPREV        #goes to owners capital scope
                                                                owner = THIS
                                                                can_toggle_looting = yes
                                                                is_looter = yes
                                                                troops = {
                                                                        light_infantry = { 4000 4000 }
                                                                }
                                                                attrition = 0
                                                        }
                                                        any_army = {
                                                                set_looting = yes
                                                        }
                                                        
                                                                                    
                                                        
                                                        
                                                    
                                                                                    
                                                        # This character declares war on rsl_slaver_target with the Pagan Subjugation CB, with the objective of taking the title_target kingdom
#                                                        unsafe_war = {
#                                                                target = event_target:rsl_slaver_target
#                                                                casus_belli = pagan_subjugation
#                                                                thirdparty_title = event_target:rsl_title_target
#                                                                tier = KING
#                                                        }
                                                    }
                                                }
                                }
                        }    
                
            }
                                    
    }                            
    option = {
            name = ok
    }
}

 

The random soldier has the slovenian culture (THIS) the title culture is defined as danish could this be an issue?

 

Posted

I have the event working now, but not yet to my satisfaction. For it to work it requires that you give the new character a war. I could only find the character and his army on the map after having reactivated the unsafe_war block. Because I don't want him to claim any titles, I made a slave_hunt CB. This works, the character and his army fight and win a war. So far so good.

 

However, during this war, with many sieges, not one character was captured and following the victory not one enemy courtier was captured, which I thought I had specified in the victory conditions. Not only that but my character becomes a courtier in the court of the vanquished. So there must be something seriously wrong with my CB

 

How do you increase the number of prisoners captured during sieges?

Since 3.1 do prisoners still show up in the courtier tab ? I seem to remember having read that they don't count towards the court size limit but are still shown.

Below is the event. I have left the any_army = { set_looting = yes } in. I don't know if that makes sense with the CB.

 

Spoiler

province_event = {
    id = RSLT.2
#    hide_window = yes
    is_triggered_only = yes        
# There must be a Count in the Duchy of Moravia or the Duchy of Pomerania for this to trigger.
    trigger = {
        any_landed_title = {
            tier = COUNT
            OR = {
                kingdom = {
                    title = k_moravia
                }
                duchy = {
                    title = d_pommerania
                }
            }
            
        }
    }
    immediate = {
            random_landed_title = {            # Get a random character in the Ducky of Pomerania or Moravia, preferably an independent king or duke. Save them as slaver_target and their primary title as title_target
                        limit = {
                            tier = COUNT
                            OR = {
                                kingdom = {
                                title = k_moravia
                                }
                                duchy = {
                                title = d_pommerania
                                }
                            }
                        }            
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = COUNT
                                                }
                                                    top_liege = {
                                                            tier = COUNT
                                                    }
                                            }
                                        }
                        }
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = DUKE
                                                }
                                                    top_liege = {
                                                            tier = DUKE
                                                    }
                                            }
                                        }
                        }
                        preferred_limit = {
                                        owner = {
                                            OR = {
                                                AND = {
                                                    independent = yes
                                                    tier = KING
                                                }
                                                    top_liege = {
                                                            tier = KING
                                                    }
                                            }
                                        }
                        }
                        owner = {
                                save_event_target_as = rsl_slaver_target
                        }        
                        kingdom = {
                                save_event_target_as = rsl_title_target
                        }
                        
                        owner = {
                                capital_scope = {
                                                PREV = {    
                                                    create_random_soldier = {
                                                                    random_traits = yes
                                                                    dynasty = none
                                                                    religion = THIS
                                                                    culture = THIS
                                                                    age = 25
                                                                    
                                                    }
                                                    # Give him all the slave trader traits, a landless Count-tier title, and an army
                                                    new_character = {                                
                                                        save_event_target_as = rsl_slave_trader
                                                        add_trait = brave
                                                        add_trait = ambitious
                                                        add_trait = greedy
                                                        add_trait = cruel
                                                        set_focus = focus_business
                                                        add_ambition = obj_amass_wealth
                                                        wealth = 200                      # give him some starting capital
                                                        set_character_flag = slave_trader
                                                        set_defacto_liege = THIS
                                                        create_title = {
                                                                    tier = COUNT
                                                                    culture = THIS
                                                                    landless = yes
                                                                    adventurer = yes
                                                                    temporary = no
                                                                    name = "SLAVE_TRADER"
                                                                    holder = THIS
                                                        }
                                                                    
                                                        spawn_unit = {
                                                                province = PREVPREV #goes to owners capital scope
                                                                home = PREVPREV        #goes to owners capital scope
                                                                owner = THIS
                                                                can_toggle_looting = yes
                                                                is_looter = yes
                                                                troops = {
                                                                        light_infantry = { 4000 4000 }
                                                                }
                                                                attrition = 0
                                                        }
                                                        any_army = {
                                                                set_looting = yes
                                                        }
                                                        
                                                                                    
                                                        
                                                        
                                                    
                                                                                    
                                                        # This character declares war on rsl_slaver_target with the slave_hunt cb
                                                        unsafe_war = {
                                                                target = event_target:rsl_slaver_target
                                                                casus_belli = rsl_slave_hunt_cb
                                                                thirdparty_title = event_target:rsl_title_target
                                                                tier = KING
                                                        }
                                                    }
                                                }
                                }
                        }    
                
            }
                                    
    }                            
    option = {
            name = ok
    }
}

The CB is as follows:

Spoiler

#Casus Belli  ROOT is the character who has a case for war: i.e., the Slaver
#            FROM is the character who is being declared war on. (for both titles and character scopes)

rsl_slave_hunt_cb = {
    name = CB_NAME_SLAVEHUNT
    war_name = WAR_NAME_SLAVEHUNT
    sprite = 25
    truce_days = 1825
    is_permanent = yes
    can_ask_to_join_war = no
    allowed_to_target_tributaries = no
    
    defender_unoccupied_warscore = yes
    
    hostages_block_cb = no
    
    sort_priority = 100000 # When there are hostages you can usually not declare any other war, so we want this first
    
    can_use_gui = {
        check_if_crusader_trigger = yes
    }

    can_use = {
        ROOT = {
            independent = yes
            has_character_flag = slave_trader
            primary_title = {
                        is_landless_type_title = yes
            }
            
        }
        FROM = {
            independent = yes
                         
        }
    }
    
    is_valid = {
        always = yes
    }
    
    on_add = {
#        FROM = { character_event = { id = JD.2000 days = 5 } } # Chance to kill spouse and children to save them for a fate worth than death
        hidden_tooltip = { fire_haruspicy_event_effect = yes }
        if = {
            limit = { defender = { is_offmap_governor = offmap_china } }
            attacker = {  
                sound_effect = china_angered_emperor
                detract_grace_super_huge_effect = yes
            }
        }
    }
    
    on_success = {
        ROOT = {
            show_scope_change = no
            prestige = 150
        }
        FROM = {
            show_scope_change = no
            prestige = -250
        }
        FROM = {
            show_scope_change = no
            save_event_target_as = rsl_slave_source
            transfer_scaled_wealth = {
                to = ROOT
                value = 3.0
            }
            any_courtier = {
                limit = {
                    is_female = yes
                    age = 14
                    NOT = { age = 30 }
                    
                    
                }
                imprison = yes
                move_character = ROOT
                
                opinion = {
                    who = ROOT
                    modifier = rsl_opinion_asshole
                    years = 30
                }
            }
            custom_tooltip = {
                text = hostages_random_imprisonment_tt
                hidden_effect = {
                    random_realm_character = {
                        limit = {
                            NOT = {
                                character = PREV
                            }
                            prisoner = no
                            ai = yes
                            is_close_relative = PREV
                        }
                        imprison = ROOT
                    }
                }
            }
        }
    }

    on_fail = {
        ROOT = {
            show_scope_change = no
            prestige = -250
        }
        FROM = {
            show_scope_change = no
            prestige = 250
        }
    }

    on_reverse_demand = {
        ROOT = {
            show_scope_change = no
            transfer_scaled_wealth = {
                to = FROM
                value = 3.0
            }
            prestige = -250
        }
        FROM = {
            show_scope_change = no
            prestige = 250
        }
    }

    attacker_ai_victory_worth = {
        factor = -1 # always accept
    }
    
    attacker_ai_defeat_worth = {
        factor = 100
    }

    defender_ai_victory_worth = {
        factor = -1 # always accept
    }
    
    defender_ai_defeat_worth = {
        factor = 100
        
        modifier = {
            factor = 2
            FROM = {
                trait = proud
            }
        }
        
        modifier = {
            factor = 3
            FROM = {
                tier = KING
            }
        }

        modifier = {
            factor = 0.85
            ROOT = {
                relative_power = { who = FROM power = 1.2 }
            }
        }

        modifier = {
            factor = 0.85
            ROOT = {
                relative_power = { who = FROM power = 1.5 }
            }
        }

        modifier = {
            factor = 0.8
            ROOT = {
                relative_power = { who = FROM power = 2.0 }
            }
        }

        modifier = {
            factor = 0.8
            ROOT = {
                relative_power = { who = FROM power = 2.5 }
            }
        }

        modifier = {
            factor = 0.8
            ROOT = {
                relative_power = { who = FROM power = 3 }
            }
        }

        modifier = {
            factor = 0.75
            ROOT = {
                relative_power = { who = FROM power = 4 }
            }
        }

        modifier = {
            factor = 0.75
            ROOT = {
                relative_power = { who = FROM power = 5 }
            }
        }

        modifier = {
            factor = 0.75
            ROOT = {
                relative_power = { who = FROM power = 6 }
            }
        }

        modifier = {
            factor = 0.5
            ROOT = {
                relative_power = { who = FROM power = 8 }
            }
        }

        modifier = {
            factor = 0.25
            ROOT = {
                relative_power = { who = FROM power = 10 }
            }
        }

        modifier = {
            factor = 2
            ROOT = {
                distance_from_realm = { who = FROM value = 20 }
            }
        }

        modifier = {
            factor = 2
            ROOT = {
                distance_from_realm = { who = FROM value = 40 }
            }
        }
        
        modifier = {
            factor = 3
            ROOT = {
                distance_from_realm = { who = FROM value = 80 }
            }
        }
        
        modifier = {
            factor = 4
            ROOT = {
                distance_from_realm = { who = FROM value = 120 }
            }
        }
    }
    
    ai_will_do = {
        factor = 1
    }
}

 

Can someone tell me why I don't make prisoners and why after having won the war I become a courtier?

Posted

It seems a Catch22. Without a war no army but when the war ends the new_title disappears and the character becomes a lowborn courtier. I need him to go on looting indefinitely.

Posted

I need to correct the above. Without the unsafe_war block I do get the slave_trader with his army. However even though he has the any_army = { set_looting = yes } command he stays immobile where he spawned.

Spoiler

new_character = {                                
                                                        save_event_target_as = rsl_slave_trader
                                                        add_trait = brave
                                                        add_trait = ambitious
                                                        add_trait = greedy
                                                        add_trait = cruel
                                                        set_focus = focus_business
                                                        add_ambition = obj_amass_wealth
                                                        wealth = 200                      # give him some starting capital
                                                        set_character_flag = slave_trader
                                                        set_defacto_liege = THIS
                                                        create_title = {
                                                                    tier = COUNT
                                                                    culture = THIS
                                                                    landless = yes
                                                                    adventurer = yes
                                                                    name = "SLAVE_TRADER"
                                                                    holder = THIS
                                                                    ruler = "CAPTAIN"
                                                        }
                                                                    
                                                        spawn_unit = {
                                                                province = PREVPREV #goes to owners capital scope
                                                                home = PREVPREV        #goes to owners capital scope
                                                                owner = THIS
                                                                can_toggle_looting = yes
                                                                troops = {
                                                                        light_infantry = { 4000 4000 }
                                                                }
                                                                attrition = 0
                                                        }
                                                        any_army = {
                                                                set_looting = yes
                                                        }
                                                        
                                                                                    
                                                        
                                                        
                                                    
                                                                                    
                                                        # This character declares war on rsl_slaver_target with the slave_hunt cb
#                                                        unsafe_war = {
#                                                                target = event_target:rsl_slaver_target
#                                                                casus_belli = rsl_slave_hunt_cb
#                                                                thirdparty_title = event_target:rsl_title_target
#                                                                tier = KING
#                                                        }
                                                    }

Is there a fix to this?

Posted

Could it be that the conditions for looting are not met? I have already changed the religion and culture of the slaver to pagan and norse. Doesn't make a difference.

 

 However, I don't know how to meet these conditions listed in the wiki:

"The provinces that may be raided are:

  • Neighbouring provinces. You get the gold and prestige immediately.
  • Provinces where you have ships in adjacent waters. The loot will be transferred to the fleet, and will be added to your treasury when the fleet docks.

For an army to raid, it must be set to a "raiding" stance before it leaves your territory. Armies can only enter this stance while you are at peace."

 

I hope they are overruled by the event.

Posted

Thanks for the tip. I don't think I want exactly the same thing as HL but it did give me the code to get my slaver plundering. Apparently you need to set_can_toggle_looting in the no position and set_looting to yes and not both on yes. I did this and now my slaver is raiding all over the place (all the way to Tunisia) and getting rich.

However, what I want is for him to stay within a certain perimeter ( eastern europe ) and more important taking prisoners. The latter he is not doing at all.

So that is my next challenge. One he has prisoners I will try to have the player character buy them from him.

Posted

  In weight_multiplier, increasing the factor increases the chance of the event occurring ?

 

My raider i still not capturing prisoners (or they don't show up in his court). I have tried increasing the chance of this happening by modifying vanilla siege event 62000, but with little success.

 

Spoiler

character_event = {
    id = RSLT.5
    picture = GFX_evt_siege
    
    desc = EVTDESC62100
    
    is_triggered_only = yes
    
    trigger = {
        event_target:rsl_slave_trader = {
            has_character_flag = slave_trader
            NOT = { has_landed_title = e_rebels }
            rebel = no
            NOT = { # Handled by SSI.61
                OR = {
                    has_landed_title = e_mexikha
                    any_liege = {
                        has_landed_title = e_mexikha
                    }
                }
            }
        }
        
        OR = {
            is_ruler = yes
            AND = {
                is_female = yes
                NOT = { age = 40 }
            }
            
            host = {
                OR = {
                    is_close_relative = ROOT
                    any_spouse = {
                        character = ROOT
                    }
                    any_consort = {
                        character = ROOT
                    }
                }
            }
            event_target:rsl_slave_trader = {
                ROOT = {
                    prisoner = yes
                    employer = {
                        character = PREVPREV
                    }
                }
            }
            
            AND = {
                event_target:rsl_slave_trader = {
                    ROOT = {
                        host = {
                            top_liege = {
                                war_with = PREVPREVPREV
                            }
                        }
                    }
                }
                
                host = {
                    top_liege = {
                        is_close_relative = ROOT
                    }
                }
            }
        }
    }
    
    weight_multiplier = {
        days = 1
        modifier = {
            factor = 4
            is_female = yes
            event_target:rsl_slave_trader = {
                OR = {
                    religion_group = pagan_group
                    religion_group = zoroastrian_group
                }
            }
        }
        modifier = {
            factor = 6 # Free prisoner
            event_target:rsl_slave_trader = {
                ROOT = {
                    prisoner = yes
                    employer = {
                        character = PREVPREV
                    }
                }
            }
        }
        modifier = {
            factor = 10 # if new_char (the sieger) was a warrior lodge member
            event_target:rsl_slave_trader = {
                is_member_of_any_warrior_lodge_trigger = yes
                society_rank > 1 #Must be rank 2 or higher
            }
        }
        modifier = {
            factor = 10 # if new_char (the sieger) has a particular Legendary bloodline
            event_target:rsl_slave_trader = {
                any_owned_bloodline = {
                    has_bloodline_flag = bloodline_reaver
                }
            }
        }
    }
    
    option = {
        name = EVTOPTA62100
        trigger = {
            center_flank_leader = {
                mercenary = no
            }
        }
        event_target:rsl_slave_trader = {
            ROOT = {
                imprison = PREV
            }
        }
        hidden_tooltip = {
            event_target:rsl_slave_trader = {
                character_event = { id = RSLT.6 }
            }
        }
    }

    option = {
        name = EVTOPTA62100
        trigger = {
            center_flank_leader = {
                mercenary = yes
            }
        }
        center_flank_leader = {
            ROOT = {
                imprison = PREV
            }
        }
    }
}

# Jailor informed
character_event = {
    id = RSLT.6
    picture = GFX_evt_siege
    desc = EVTDESC62101
    border = GFX_event_normal_frame_war
    
    is_triggered_only = yes
    
    notification = yes
    
    ai = no
    
    option = {
        name = EVTOPTA62101
        tooltip = {
            FROM = {
                imprison = yes
            }
        }
    }
}

 

Posted

I realize I am posting a lot of messages. I don't necessarily expect an answer. The reason I do this is:

 

  • writing it down helps me focus on the problem
  • maybe it will help others or give them ideas
  • now and then I get really useful help for which I am grateful.

Regarding my raider, I noticed when raiding as a player that prisoners only appear in your court upon return in the home province. My NPC raider dus not have a home province and even if he did I'can't order him there. So maybe he captures a lot of prisoners but I will never know. Other than conquering a province  through a war, I don't suppose there is another way around  this?

 

Posted

Is this the correct way to give the unsafe_war  command to the NPC .

 

Spoiler

narrative_event = {
    id = RSLT.7
    title = "The Slave Trade"
    hide_window = yes
    
 
    
    trigger = {
            prisoner = no
            is_female = no
            is_looting = yes
            has_character_flag = slave_trader
    }

        
    mean_time_to_happen = {
                    months = 12
                    modifier = {
                            factor = 0.80
                            wealth = 300
                    }
                    modifier = {
                            factor = 0.60
                            wealth = 300
                    }
                    modifier = {
                            factor = 0.50
                            wealth = 400
                    }
                    modifier = {
                            factor = 0.40
                            wealth = 500
                    }
                    modifier = {
                            factor = 0.25
                            num_of_prisoners = 5
                    }
    }

    immediate = {
                event_target:rsl_slave_trader = {
                                                set_character_flag = duchy_adventurer
                                            
                                                unsafe_war = {
                                                        target = event_target:rsl_slaver_target
                                                        casus_belli = duchy_adventure
                                                        thirdparty_title = event_target:rsl_title_target
                                                        tier = KING
                                                }
                }
                any_player = {  
                    narrative_event = { id = RSLT.8 }        
            }
    }                                    
    
}
# Title war has started
narrative_event = {
    id = RSLT.8
    title = "The Slave Trade"
    picture = GFX_evt_market
    desc = "A title war has started"
    is_triggered_only = yes
    
    option = {
        name = OK
    }
}

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...