• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Hello,

I am struggling with an event on.birth.

Basically, the point of this event is to set a character_flag randomly. If I wanted, let's say, 3 percents of the children to get that flag on birth, how should I proceed ? And I would like to improve the chances (ie. 30%) to get the flag if one or two of the parents own different traits (no need for the moment to differenciate the odds between the required parents' traits), so, once again, what should I do to do that ?

I know there's probably something to do with the "random_list" code but I don't really know how to use it. Any tips ?

Thanks in advance for your help !
 
Basically, the point of this event is to set a character_flag randomly. If I wanted, let's say, 3 percents of the children to get that flag on birth, how should I proceed ? And I would like to improve the chances (ie. 30%) to get the flag if one or two of the parents own different traits (no need for the moment to differenciate the odds between the required parents' traits), so, once again, what should I do to do that ?
Random_list is overkill if you just want to do a single thing, you can can just do random and apply a modifer e.g.

Code:
random = {
    chance = 3
    modifier = {
        factor = 10
        OR = {
            true_father_even_if_dead = { has trait = test }
            mother = { has trait = test }
        }
    }
    set_character_flag = testflag
}
 
Random_list is overkill if you just want to do a single thing, you can can just do random and apply a modifer e.g.

Code:
random = {
    chance = 3
    modifier = {
        factor = 10
        OR = {
            true_father_even_if_dead = { has trait = test }
            mother = { has trait = test }
        }
    }
    set_character_flag = testflag
}

Thank you for your answer. I finally managed to do it using random_list but your way seems easier et clearer. Know the flag randomly generate on newborns.

However, I still do have a question. Regarding the flag, I want another event to fire if a character has this flag. Here's the code so far :
Code:
character_event = {
    id = gold.3
    desc = "EVTDESCgold.3"
    picture = GFX_evt_child_reading

    is_triggered_only = yes   

    min_age = 10
    max_age = 14
    
    trigger = {
        has_character_flag = hidden_gold_potential
    }
    
    option = { (etc, etc)

I have set it on_yearly_childhood pulse in the on_actions file but it doesn't seem to work. The event using console works perfectly, but doesn't fire automatically.
How can I make sure the event fires ? Should I replace the is_triggered_only by a MTTH ? (I want to make sure the event fires between 10 and 14 but I'ld love the event to fire randomly between those min and max.

Thanks in advance for the replies !
 
Really. So intelligent. "Drill" is extactly the word he mendtioned having searched for.
Just saying so you know why i disagreed with your post while you disagreed with mine.
On search time, depends on a lot of things like the program used, the OS and the comps performance.
I wanted to be helpful to someone i had already responded to before.
I'm not sure what impression you wanted to give with your response to me.
No need to get pissy about it.

First, OP never actually mentioned searching for 'drill' in all the text files. Given that they hadn't found it, and it's very easy to find, it's pretty likely they hadn't. Otherwise, of course, *your* advice to use NP++ multifile search would be just as pointless as my advice…

Given how many things are *not* logically arranged in the game files, your advice to start by guessing which subfolder to search will inevitably lead to having to search again. In OP's particular case, finding the bloodline definition that contains the flag bloodline_drill is almost certainly insufficient for their needs. To see what it *does*, and thus where they need to edit, they'd have to search elsewhere. It's not obvious that most of the important items are under the decisions and events folders. It involves multiple tags, all containing the word 'drill'. Better to just search the whole thing from the start.

It's not about "giving an impression", it's about giving the best help we can.
 
Randomly and guaranteed don't play well together - if it's a random event, it may never fire at all, and if it's a guaranteed event, it would always fire on the first year its eligible. I do have a possible solution for that, though. There also doesn't seem to be anything stopping the event from firing multiple times, so I'll adjust for that too.

Try having your event fire every year (in events instead of random_events), then change your trigger to this:
Code:
trigger = {
   has_character_flag = hidden_gold_potential
   NOT = { has_character_flag = had_gold3_event }
   OR = {
      random = 30
      age = 13
   }
}

The event will attempt to fire each year, but if they are under 13, there's only a 30% chance it will actually fire. Once they hit 13, the last age they are eligible for the event, that part of the OR statement will override the random, forcing it to fire anyway. The additional flag should be set in the event and it will make sure that once a character gets the event, they can no longer get it on subsequent years.
I haven't tested this, but it should work.
 
We can right click to our demesne and create vassal. I know how to edit the outcomes of presenting debutante etc. but I don't know how edit random outcomes of randomly created vassals. Can anyone help me with that?
 
That isn't scripted, so you can't directly edit it. However, if you run an event from on_employer_change, with the trigger FROM = { character = no }, this will run on newly created characters (both generated and born), allowing you to modify the new character right after they were created.

Note that the validator will complain about that trigger, but it does work.
 
You wouldn't edit any existing files, instead, you can do this entirely with new files.

First, create a new text file in the events folder with something along these lines:
Code:
namespace = MYEVENTS

character_event = {
   id = MYEVENTS.1
   hide_window = yes
   is_triggered_only = yes

   trigger = { FROM = { character = no } }

   immediate = {
      # Whatever code you want here
   }
}

Then, create a text file in common/on_actions with this:
Code:
on_employer_change = {
   events = {
      MYEVENTS.1
   }
}

The on_action file says that whenever a character changes employers (which for some reason includes new characters being created) fire event MYEVENTS.1. In this, ROOT is the character in question and FROM is the previous employer
The trigger section of this event says to only fire the event if FROM (the previous employer) doesn't exists. This way, existing characters changing courts don't get the event, but newly created characters, who don't have a previous liege, still do, so the effects of the event apply.
 
I'm trying to adjust the Religion Manager mod so I can allow Women to have more than 1 husband when I have Reformed Pagan religions with Equality doctrine.
I know basically nothing about scripting and have been trying to make the adjustments wanted with stuff from Wiki.

Tried copying the max wives allowed decision in Religion Manager and changing it to Max Husbands Allowed. I get the button in game but it doesn't have any effect.
Women can still have Consorts they just can't marry more than 1 man.

Since this is supposed to be equality my female heirs who end up as rulers should have the option to Matrilineality marry more than one spouse same as the male heirs can.

Any ideas on how I can fix this?

Also is there any way around the block on having both wives/husband and Consorts/Concubines adding a set_max_consorts line under set_max_wives has it showing up but it's blocked by the Can have X wives (unless allowed to have Consorts) and the reverse comment if adding set_max_wives line under the set_max_consorts decision.
Also tried using the set_men_can_take_consorts = X/set_women_can_take_consorts = X lines instead of set_max_consorts but got no luck with that either.
 
The documentation on the wiki and in the patch notes seems to suggest that the hide_layers = { { } } scopes in potrait_properties.txt can contain scripted conditions, but I can't seem to get them to work. Is there something special that has to be done, or is that functionality just broken?
 
You can't its hardcoded.


No, trying to get around it by adding them via events crashes the game iirc.
Thanks was afraid they were hard coded that way. The Wife+Concubine thing must be a fairly recent change to the code however as I used to have a mod from the Steam workshop that allowed for both. Anyways no big deal on the later and guess any of my female heirs that end up as rulers will have to settle for taking consorts if I decide they need more breeding stock pumped into family tree.
 
You wouldn't edit any existing files, instead, you can do this entirely with new files.

First, create a new text file in the events folder with something along these lines:
Code:
namespace = MYEVENTS

character_event = {
   id = MYEVENTS.1
   hide_window = yes
   is_triggered_only = yes

   trigger = { FROM = { character = no } }

   immediate = {
      # Whatever code you want here
   }
}

Then, create a text file in common/on_actions with this:
Code:
on_employer_change = {
   events = {
      MYEVENTS.1
   }
}

The on_action file says that whenever a character changes employers (which for some reason includes new characters being created) fire event MYEVENTS.1. In this, ROOT is the character in question and FROM is the previous employer
The trigger section of this event says to only fire the event if FROM (the previous employer) doesn't exists. This way, existing characters changing courts don't get the event, but newly created characters, who don't have a previous liege, still do, so the effects of the event apply.
Thank you for your help.

I have another problem, not sure if it's righ place for it. I have reformed mongol empire title but when I settled down, the title has gone to some random vassal. I took it via cheats, so the problem is the title is locked about succesion laws. I can only pick gavelkind and ultimogeniture, I assume that is something to do with the title as I can change succesion laws of other titles. Any way to modify/fix this?
 
Last edited:
Ok so I am trying to make a mod which adds a new Canaanite pagan religion, which uses the Holy Fury reformation mechanics, here is the religious head title and the religion itself:

Code:
pagan_group = {
    
    canaanite_pagan = { #CARTHAGINIAN
        graphical_culture = hellenicgfx
        alternate_start = {always = no}
        interface_skin = { hellenic_interface }
        
        icon = 60
        heresy_icon = 61
        
        color = { 0.75 0.9 0.73 }
        
        high_god_name = GOD_BAAL_HAMMON
        
        god_names = {
            GOD_BAAL_HAMMON GOD_TANIT GOD_ASTARTE GOD_ESHMUN GOD_MELQART MOLOCH GOD_QADESHTU GOD_BAALAH GOD_KOTHARAT GOD_KOTHAR_WA_KHASIS
        }
        evil_god_names = {
            RESHEPH MOLOCH MOT LOTAN YAM
        }
        
        unit_modifier = {
            levy_size = -0.1
            
            war_elephants_offensive = 0.3
            war_elephants_defensive = 0.3
            
            key = "canaanite_pagan_key"
        }
        

        crusade_name = GREAT_HOLY_WAR
        scripture_name = THE_BAAL_TEXTS
        priest_title = KHUN
        
        priests_can_marry = yes
        allow_looting = yes
        max_consorts = 5
        
        bs_marriage = yes
        pc_marriage = yes
        cousin_marriage = yes
        #rel_head_defense = yes   
    
        aggression = 2.0 # AI aggression factor
        
        short_reign_opinion_year_mult = 1.5
        
        #religious_clothing_head = 12
        #religious_clothing_priest = 11
        
        intermarry = hellenic_pagan
        intermarry = zoroastrian_group
        intermarry = west_african_pagan
        
        reformed = canaanite_pagan_reformed
        
        dislike_tribal_organization = no
        can_demand_religious_conversion = no
    }       
    
    canaanite_pagan_reformed = {
        graphical_culture = hellenicgfx
        alternate_start = {always = no}
        interface_skin = { hellenic_interface }
        allow_in_ruler_designer = no
        
        icon = 62
        heresy_icon = 61
        
        color = { 0.75 0.9 0.73 }
        
        ai_convert_other_group = 2 # always try to convert
        ai_convert_same_group = 2 # always try to convert
        
        high_god_name = GOD_BAAL_HAMMON
        
        god_names = {
            GOD_BAAL_HAMMON GOD_TANIT GOD_ASTARTE GOD_ESHMUN GOD_MELQART GOD_QADESHTU MOLOCH GOD_BAALAH GOD_KOTHARAT GOD_KOTHAR_WA_KHASIS
        }
        evil_god_names = {
            RESHEPH MOLOCH MOT LOTAN YAM
        }
        
        unit_modifier = {
            levy_size = -0.2
            
            war_elephants_offensive = 0.5
            war_elephants_defensive = 0.5
            
            key = "canaanite_pagan_key"
        }
        
        crusade_name = GREAT_HOLY_WAR
        scripture_name = THE_BAAL_TEXTS
        priest_title = KHUN
        
        priests_can_marry = yes
        allow_looting = yes
        can_call_crusade = yes
        join_crusade_if_bordering_hostile = yes
        max_consorts = 5
        
        divine_blood = yes
        
        bs_marriage = yes
        pc_marriage = yes
        cousin_marriage = yes
        rel_head_defense = yes
        
        aggression = 2.0
        
        short_reign_opinion_year_mult = 0.5
        
        religious_clothing_head = 12
        religious_clothing_priest = 11
        
        can_call_crusade = yes
        
        intermarry = hellenic_pagan_reformed
        intermarry = hellenic_pagan
        intermarry = west_african_pagan
        intermarry = zoroastrian_group
        intermarry = west_african_pagan_reformed
        
        dislike_tribal_organization = no
        can_demand_religious_conversion = yes
    }       
}

Code:
d_canaanite_pagan_reformed = {
   color={190 130 185}
   color2={255 255 255}
  
   short_name = yes
   title = ADUNON
   title_female = ADATIW
   foa = "ADANON_FOA"
  
   capital = 817
  
   roman = "Collegium Punicus"
  
   landless = yes
   primary = yes
  
   religion = canaanite_pagan_reformed
   controls_religion = canaanite_pagan_reformed

   dignity = 100
  
   allow = { always = no }
}

Both the reformed and non reformed religions appear in-game, but there is no reformation button. What am I doing wrong?

P.S. I have only made a new religion once and it was already reformed, so I am still trying to figure this out.
 
I also have a second issue, I have created a new religious doctrine and a new wonder. The wonder exists at the start of the game and the doctrine does appear in the reformation tab; however the GFX files don't seem to be working, as the images I set for them do not show up in-game.

upload_2019-5-7_21-58-58.png

upload_2019-5-7_21-59-57.png

upload_2019-5-7_22-1-20.png

Here is the code for the GFX file, the wonder and the doctrine:

Code:
spriteTypes = {

    ##== WONDERS ==##
    spriteType = {
        name = "GFX_wonder_strip_carthage_harbour_large"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_strips\\wonder_stages_carthage_harbour_large.dds"
        noOfFrames = 5
    }
    spriteType = {
        name = "GFX_wonder_strip_carthage_harbour_medium"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_strips\\wonder_stages_carthage_harbour_medium.dds"
        noOfFrames = 5
    }
    spriteType = {
        name = "GFX_wonder_strip_carthage_harbour_small"
        texturefile = "gfx\\interface\\wonder_interface\\wonder_strips\\wonder_stages_carthage_harbour_small.dds"
        noOfFrames = 5
    }
    
    ##== RELIGION THINGS ==##
    spriteType = {
        name = "GFX_religion_feature_molochs_flame"
        texturefile = "gfx\\interface\\religion_feature_molochs_flame.dds"
    }
}

Code:
wonder_carthage_harbour = {
    allow_construction = no
    picture = GFX_wonder_strip_carthage_harbour
    show_model = no
    is_in_water = yes
    potential = {
        FROMFROMFROM = { is_coastal = yes }
        OR = { culture = punic }
    }
    active = {
        ROOT = {
            OR = { culture = punic }
        }
    }
    flags = {
        is_historical
        is_destructible
        defensive
        cost_medium
    }
    available_upgrades = {
        # UNIQUE:
        upgrade_cothon
        upgrade_piers
        upgrade_office_harbor
        upgrade_lighthouse
        upgrade_military_wharf
        upgrade_master_of_tides

        # OTHER:
        upgrade_roads
        upgrade_watchtower_network
        upgrade_spikes
        upgrade_tower
        upgrade_hypocausts
        upgrade_heating_pipes
        upgrade_retinue
        upgrade_road_tolls
        upgrade_tavern
    }
    stage = {
        allow = {
        }
        build_time = 250
        gold_cost_flat = 2450
        gold_cost_ticking = 5
        restore_time = 150
        loot_time = 100
        restore_cost_flat = 400
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.1
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 100
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.1
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25
        }
        owner_modifier = {
            monthly_character_prestige = 0.1
        }
    }
    stage = {
        allow = {
        }
        build_time = 300
        gold_cost_flat = 1000
        gold_cost_ticking = 3
        restore_time = 200
        loot_time = 20
        restore_cost_flat = 500
        restore_cost_ticking = 2
        upgrade_slots = 2
        local_modifier = {
            local_tax_modifier = 0.025
            tradevalue = 25

        }
        owner_modifier = {
            monthly_character_prestige = 0.1
            build_cost_modifier = 0.05
        }
    }
}

Code:
religion_doctrine = {
    buttons = { doctrine1 doctrine2 }
    
    religion_molochs_flame = {
        picture = GFX_religion_feature_molochs_flame
        trigger = {
            NOR = {
                has_selected_religion_feature = religion_peaceful
                has_selected_religion_feature = religion_proselytizing
                has_selected_religion_feature = religion_ritual_sacrifice
            }
            OR = {
                religion = canaanite_pagan
                religion = canaanite_pagan_reformed
            }
        }
        effect = {
            custom_tooltip = { text = tooltip_moloch_doctrine }
            custom_tooltip = { text = tooltip_moloch_doctrine_traits }
        }
        ai_will_do = {
            factor = 1
            modifier = {     
                factor = 0.1
                FROM = {
                    character = yes
                    NOR = {
                        trait = cruel
                        trait = impaler
                    }
                }
            }
        }
    }
}