• 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.
Which one would be more compatable with other mods that also add character modifiers and the like? Or is it like modding EU4 where you just have something like "has_recently_hosted_chariot_race" as a custom character flag/modifier and as long as it doesn't match any other character modifier you're good?
Flags are dynamically made, and you can freely name whatever flags you want. Just be sure to check
Code:
OR = {
     NOT = { has_character_flag = *FLAG* }
     had_character_flag = { flag = *FLAG* days = *TIME* }
}
Modifiers would work better, as they disappear on their own after however many days you set. It would be best to create their own, though.
 
Hello !

I have a quick question that have probably been already asked but I didn't go trhough the 1544 pages... :)

My question is, I have created on_birth event, that seems to trigger correctly. The aim is to set a flag onto the child :
- If the father has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- If the mother has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- (you can have the flag only if one of the parents has a trait, so no trait, no flag for the child)

So here's the code, mainly copied from JonStryker's Witcher Kings Mod (who I thank for) :
Code:
character_event = {
    id = big.1

    hide_window = yes
    is_triggered_only = yes

    option = {
        name = OK
        if = {
            limit = { trait {father = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {father = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }           
        if = {
            limit = { trait {mother = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {mother = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }
    }
}

The problem is that every newborn seems to possess the hidden_big_potential flag. But i want them to get that potential only if one or more of the IF are true.
So does the sum of "chances" has to be below 100 ?

What should i do to make sure only a fraction of the population would get the flag ?

Thanks in advance for your answer !
 
Did you mean for them to be in the option block or immediate block? It sounded like you didn't intend to present the character with options to choose from and click.

Additionaly, it seems more efficient to use modifier = { factor = #.# condition } instead of if blocks depending on the logic you're going for.
 
It's probably a very simple problem, but some superficial searching hasn't lead me to a solution. Currently, my titles have defaulted to Iqta government, and I wish them to be feudal. Where would I go about changing this?
 
two quick questions, trying to add in three societies for the west african religion, assassin, satanic and monastic. how do I go about it from scratch? also for tribal invasion i like trolling as a zoroastrian irish count trying to become the prophet reborn but with the new patch hoping to give him tribal invasion so I dont have to spend ages rebuilding. Thanks ;}~
 
Did you mean for them to be in the option block or immediate block? It sounded like you didn't intend to present the character with options to choose from and click.

Additionaly, it seems more efficient to use modifier = { factor = #.# condition } instead of if blocks depending on the logic you're going for.

I'm not entirely sure your answer was for me but I tried it anyway, it doesn't seem to work...
And replacing OPTION by IMMEDIATE doesn't work as well, nobody's the FLAG...

I've tried many solutions trough the day but it doesn't seem to work.
 
Hello !

I have a quick question that have probably been already asked but I didn't go trhough the 1544 pages... :)

My question is, I have created on_birth event, that seems to trigger correctly. The aim is to set a flag onto the child :
- If the father has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- If the mother has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- (you can have the flag only if one of the parents has a trait, so no trait, no flag for the child)

So here's the code, mainly copied from JonStryker's Witcher Kings Mod (who I thank for) :
Code:
character_event = {
    id = big.1

    hide_window = yes
    is_triggered_only = yes

    option = {
        name = OK
        if = {
            limit = { trait {father = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {father = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }          
        if = {
            limit = { trait {mother = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {mother = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }
    }
}

The problem is that every newborn seems to possess the hidden_big_potential flag. But i want them to get that potential only if one or more of the IF are true.
So does the sum of "chances" has to be below 100 ?

What should i do to make sure only a fraction of the population would get the flag ?

Thanks in advance for your answer !

You mixed up the location of "trait" and "father/mother" on each line, and you are missing an equal sign after each "trait" (where "mother"/"father" should be).
 
So I have a problem where I have more text than will fit in an event box. The event is called by decision. I tried changing the narrative_event to long_character_event, both in the event itself and in the decision that calls it, but it wasn't noticeably any different.

Is it possible to mod in a new type of event? like a "bigger_narrative_event" or something? failing that can I mod the normal narrative_event box to be bigger?
 
I'm not entirely sure your answer was for me but I tried it anyway, it doesn't seem to work...
And replacing OPTION by IMMEDIATE doesn't work as well, nobody's the FLAG...

I've tried many solutions trough the day but it doesn't seem to work.
You mixed up the location of "trait" and "father/mother" on each line, and you are missing an equal sign after each "trait" (where "mother"/"father" should be).

Your syntax structure does seem completely wrong, but I don't think your script should run at all. Are you sure it's your script that's flagging all of the new borns? Is there another script that could be doing it? Did you load a fresh save before any flags were set to test the script each time?


Basically, what you're currently doing is

1. (??? happened)
This event gets called.

2. If (nonsense limit) is true, then 15%~17% chance to set this flag x 4.

I don't know if the limit clause is nonsense results in the if block being treated as always true.

even if you added = after trait, what you'd end up with is

"if this character has a trait named "{father = big1 }", which is obviously not the trait's name, so this would always return fail and there should be zero chance for the flag being set."


I'm not entirely sure what the logic you're going for so I was wondering what you come up with if you revised it to immediate and factors.


I think what you'r trying to do is something like:

Code:
random = {
    chance = 15
    modifier = {
        factor = 0
        NOT = { father = { trait = big1 } }
    }
    set_character_flag = hidden_big_potential
}

You may also want to read the examples on the modding wiki in particular http://www.ckiiwiki.com/Scripting to better understand the syntax.
 
Last edited:
So I have a problem where I have more text than will fit in an event box. The event is called by decision. I tried changing the narrative_event to long_character_event, both in the event itself and in the decision that calls it, but it wasn't noticeably any different.
long_character_event works, and it's very noticeable. You must've used it wrong.

Your syntax structure does seem completely wrong, but I don't think your script should run at all.
If it loads without crashing, it will run... partially. What usually happens with mangled code is that the interpreter ends up skipping some parts, and continues from where the code starts making sense again. Sometimes it ends up skipping to the next event in the file, effectively merging them.

It causes all kinds of weird results, and is a complete pain to debug.
 
Last edited:
Hello !

I have a quick question that have probably been already asked but I didn't go trhough the 1544 pages... :)

My question is, I have created on_birth event, that seems to trigger correctly. The aim is to set a flag onto the child :
- If the father has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- If the mother has a certain trait, then the child as certain chance to get the flag
- If the father has a certain other trait, then the child as a certain another chance to get the flag
- (you can have the flag only if one of the parents has a trait, so no trait, no flag for the child)

So here's the code, mainly copied from JonStryker's Witcher Kings Mod (who I thank for) :
Code:
character_event = {
    id = big.1

    hide_window = yes
    is_triggered_only = yes

    option = {
        name = OK
        if = {
            limit = { trait {father = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {father = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }          
        if = {
            limit = { trait {mother = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit = { trait {mother = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }
    }
}

The problem is that every newborn seems to possess the hidden_big_potential flag. But i want them to get that potential only if one or more of the IF are true.
So does the sum of "chances" has to be below 100 ?

What should i do to make sure only a fraction of the population would get the flag ?

Thanks in advance for your answer !

Your syntax is wrong. Try this:
Code:
character_event = {
    id = big.1

    hide_window = yes
    is_triggered_only = yes

    option = {
        name = OK
        if = {
            limit =  { father = { trait = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit =  { father = { trait = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }           
        if = {
            limit =  { mother = { trait = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit =  { mother = { trait = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }
    }
}
 
By the way, that code doesn't check for cuckolds. So you pretty much need something like this for the father instead, if you want to accurately pass on congenital traits:
Code:
   father_even_if_dead = { save_event_target_as = father }
 
   if = {
       limit = { is_father_real_father = no }
       real_father_even_if_dead = { save_event_target_as = father } # Overwrite the event target if cuckold
   }

   if = {
       limit = { event_target:father = { trait = big1 } }
        random = {chance = 15 set_character_flag = hidden_big_potential }
   }
   if = {
       limit = { event_target:father = { trait = big2 } }
       random = {chance = 17 set_character_flag = hidden_big_potential }
   }

...and yes, you should use *_even_if_dead for such checks. Because father doesn't work if the child is born after his death; father/mother automatically return false for dead characters.
 
Last edited:
Two questions, both hopefully easy -

1) Is it possible to get DNA info from a character to use in an event ? I am writing a flavour event and I want to be able to add text such as "His cold <blue> eyes seemed to gaze right through you . . . " and "Her <blonde> silky hair glistened in the sun . . .".


2) If I create a new decision and put both custom triggers and AI weights (but with no modifiers), what will happen if an AI character does not satisfy a trigger ?

For example, if I have four options all with an ai_chance of 10, then presumably each outcome has an equal 25% chance of occurrence. But what happens if a particular AI character does not satisfy say options 3 and 4 - are his chances now 50/50 on the remaining two options or still 25% each, but with a 50% chance of no outcome at all ?
 
long_character_event works, and it's very noticeable. You must've used it wrong.

how is one supposed to use it then? I changed the "narrative_event" to "long_character_event" in both the events.txt file and in the effects field of the decision that calls it, yet when taking the decision, the event looks exactly like it did as a narrative event
 
Last edited:
Can someone help me with this problem? I want to able to add more building slots to all of my holdings, so I could build more castle, church or cities.

Code:
title_decisions = {

    holding_slots_decisions = {
    filter = owned
 
    from_potential = {
    ai = no
    }
    potential = {
    tier = COUNT
    has_holder = yes
    }
    allow = {
    NOT = {num_of_max_settlements = 7}
    }
    effect = {
    add_holding_slot = FROM
 
    ROOT = {
                holder_scope = {
                any_realm_province
                }
            }
}
    ai_will_do =  {
    factor = 0
  }
}
 
Last edited:
I have been trying to make a province event.
The following code is from /events/
Code:
province_event = {
    id = my_id
    desc = my_desc
    picture = my_picture
    trigger = {
        owner = {
            religion_group = christian
        }
    }
    mean_time_to_happen = {
        years = 3000
    }
    immediate = {
         add_province_modifier = {
             modifier = my_modifier
             duration = -1
         }
    }
    option = {
        name = my_optionname
    }
}
And the following is from /common/event_modifiers/
Code:
my_modifier = {
    local_revolt_risk = 1
    local_tax_modifier = -0.9
    local_build_time_modifier = 9
    local_build_cost_modifier = 9
    levy_size = -0.9
    supply_limit = -0.9
    galleys_perc = -0.5
    icon = 76
}
But when I use a console command to run the event, the game crashes. Does anyone know what I'm doing wrong?
 
But when I use a console command to run the event, the game crashes. Does anyone know what I'm doing wrong?
I presume that you have proper ids and namespace in the actual event, instead of just 'my_id' etc?

add_province_modifier needs name flag, not modifier. Other possible cause is that you're trying to run it from console for an ID that doesn't exist (or is actually a character, not a province).

I recommend making a testing decision instead of using console. To make sure that things get run in the proper scope. Such as:
Code:
targeted_decisions = {
   testing_decision = {
       filter = all
       ai_target_filter = all
 
       from_potential = { ai = no }
       potential = { always = yes }
       allow = { always = yes }
       effect = {
           location = { province_event = { id = <event_id> } } #Run event in the province where the targeted character is located.
       }
       ai_will_do = { factor = 0 }
   }
}
(Also makes them far easier to run, since you don't need to look up the IDs.)
 
Last edited:
Your syntax is wrong. Try this:
Code:
character_event = {
    id = big.1

    hide_window = yes
    is_triggered_only = yes

    option = {
        name = OK
        if = {
            limit =  { father = { trait = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit =  { father = { trait = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }         
        if = {
            limit =  { mother = { trait = big1 } }
            random = {chance = 15 set_character_flag = hidden_big_potential }
        }
        if = {
            limit =  { mother = { trait = big2 } }
            random = {chance = 17 set_character_flag = hidden_big_potential }
        }
    }
}

By the way, that code doesn't check for cuckolds. So you pretty much need something like this for the father instead, if you want to accurately pass on congenital traits:
Code:
   father_even_if_dead = { save_event_target_as = father }
 
   if = {
       limit = { is_father_real_father = no }
       real_father_even_if_dead = { save_event_target_as = father } # Overwrite the event target if cuckold
   }

   if = {
       limit = { event_target:father = { trait = big1 } }
        random = {chance = 15 set_character_flag = hidden_big_potential }
   }
   if = {
       limit = { event_target:father = { trait = big2 } }
       random = {chance = 17 set_character_flag = hidden_big_potential }
   }

...and yes, you should use *_even_if_dead for such checks. Because father doesn't work if the child is born after his death; father/mother automatically return false for dead characters.

I have finally managed to have it work, mixing those two solutions. I have done what Admiral Boysen said, but using the father_even_if_dead to be sure. I will move to Zaltys complete solution when the whole event chain will work correctly. I need to do something else or I will give up :)

Thanks all for your help !

Now, let's go trying to add some trait icons...
 
Last edited:
I managed to upload a mod successfully to the steam workshop, when I was testing it, it worked fine. However when I download the mod I made it'll show up fine but not work.

My .mod file is set up like this
Code:
name="Hold a Chariot Race"
path="mod/chariotrace"
tags={Mods Small}
picture="chariotrace.jpg"

and my descriptor.mod is set up like this

Code:
name="Hold a Chariot Race"
archive="mod/chariotrace.zip"
tags={Mods Small}
picture="chariotrace.jpg"

What am I doing wrong?

Also while I'm asking about it, what is the current way to upload a mod to the steam workshop optimally? Most guides are old/deleted/outdated or only have some of the steps.
 
Last edited: