Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

10 hours ago, Buzhidao said:

I have a weird question actually. Is it possible that sometimes the game does not run all the checks for an event and the event fires for characters it shouldn't fire for?

Something akin to your wife accusing you of having an affair when your only lover is your wife. There are conditions in place to prevent this from happening, but the event still fires because reasons.

I know that runs sometimes when your character or spouse has the paranoid trait

Link to comment
7 hours ago, Buzhidao said:

Nay, I'm not talking specifically about this event, I'm asking in general. Can the game skip some of the conditions because of some glitch in the engine or something?

While it seems like this happens, in most cases I have found that there is either a loophole in the conditions or some other event somewhere forces an event to to kick off that otherwise wouldn't have its criteria met.  But I won't say that the engine is without its bugs either.  

Link to comment
4 hours ago, NoxBestia said:

While it seems like this happens, in most cases I have found that there is either a loophole in the conditions or some other event somewhere forces an event to to kick off that otherwise wouldn't have its criteria met.  But I won't say that the engine is without its bugs either.  

Hmm, okay. Let's take a look at a concrete example of this. Maybe I am missing something, even though I've been working on this for 1.5 years.

I've modified the vanilla "SPOUSE SUSPECTS REAL LOVE AFFAIR" event. I've made it so that the spouse only cares about those lovers that aren't also her/his lovers.

My character had 3 lovers:

1) The spouse;

2) A lover that was also the spouse's lover;

3) A lover that wasn't the spouse's lover.

All things considered the lover №3 should have set off the event.

Script (look at my comments in red):

 

# Hidden start event to set up the scopes
character_event = {
    id = WoL.1000
    hide_window = yes
    
    capable_only = yes
    prisoner = no
    min_age = 16
    is_married = yes
    
    trigger = {
        has_dlc = "Way of Life"
        OR = {
            has_polygamy = no
            is_female = no
        }
        NOT = { trait = infirm }
        NOT = { is_inaccessible_trigger = yes }
        NOT = { trait = on_hajj }
        NOT = { trait = on_pilgrimage }
        NOT = { trait = imbecile }
        NOT = { trait = inbred }
        
        in_command = no
        
        any_spouse = {
            prisoner = no
            NOT = { trait = infirm }
            NOT = { is_inaccessible_trigger = yes }
            NOT = { trait = incapable }
            NOT = { trait = on_pilgrimage }
            any_lover = {
                NOT = { character = ROOT }
                NOT = { has_character_modifier = wol_court_tomcat }
                NOT = { has_character_modifier = wol_court_vixen }
                prisoner = no
                NOT = { is_consort = PREV }
                NOT = { is_lover = ROOT } The first place where I tried to prevent this event from happening, though it is irrelevant to the current example
            }
            NOT = { has_character_modifier = wol_court_tomcat }
            NOT = { has_character_modifier = wol_court_vixen }
        }
    }
    
    mean_time_to_happen = {
        months = 360
        modifier = {
            factor = 0.25
            trait = paranoid
        }
        modifier = {
            factor = 0.25
            trait = genius
        }
        modifier = {
            factor = 0.5
            trait = schemer
        }
        modifier = {
            factor = 0.5
            OR = {
                trait = quick
                trait = shrewd
            }
        }
        modifier = {
            factor = 0.25
            has_focus = focus_intrigue
        }
        modifier = {
            factor = 0.75
            trait = envious
        }
        modifier = {
            factor = 0.75
            trait = ambitious
        }
        modifier = {
            factor = 0.75
            trait = just
        }
        modifier = {
            factor = 2.0
            trait = arbitrary
        }
        modifier = {
            factor = 3.0
            trait = content
        }
        modifier = {
            factor = 3.0
            OR = {
                trait = slow
                trait = dull
            }
        }
        modifier = {
            factor = 5.0
            trait = trusting
        }
    }
    
    immediate = {
        # It is ok for this to be a bit more selective than the 'any_spouse' trigger above, since this event is invisible.
        random_spouse = {
            limit = {
                prisoner = no
                NOT = { trait = infirm }
                NOT = { is_inaccessible_trigger = yes }
                NOT = { trait = incapable }
                NOT = { trait = on_pilgrimage }
                NOT = { has_character_modifier = wol_court_tomcat }
                NOT = { has_character_modifier = wol_court_vixen }
                NOT = {
                    reverse_has_opinion_modifier = {
                        who = ROOT
                        modifier = opinion_cuckolded
                    }
                }
                NOT = {
                    reverse_has_opinion_modifier = {
                        who = ROOT
                        modifier = opinion_cuckolded_private
                    }
                }
                NOT = {
                    reverse_has_opinion_modifier = {
                        who = ROOT
                        modifier = slut_seductress
                    }
                }
                any_lover = {
                    NOT = { is_lover = ROOT } here again I try to remove some lovers
                    NOT = { character = ROOT }
                    NOT = { has_character_modifier = wol_court_tomcat }
                    NOT = { has_character_modifier = wol_court_vixen }
                    prisoner = no
                    NOT = { is_consort = PREV }
                }
            }
            character_event = { id = WoL.1001 }
        }
    }
}

# Ping the spouse
character_event = {
    id = WoL.1001
    hide_window = yes
    
    is_triggered_only = yes
    
    immediate = {
        random_lover = {
            limit = {
                NOT = { is_lover = FROM } Okay, here ROOT is my character, FROM is the spouse, so random_lover should have been lover №3, but instead the game picked lover №2
                NOT = { character = FROM }
                NOT = { has_character_modifier = wol_court_tomcat }
                NOT = { has_character_modifier = wol_court_vixen }
            }
            character_event = { id = WoL.1002 }
        }
    }
}

# Ping the lover
character_event = {
    id = WoL.1002
    hide_window = yes
    
    is_triggered_only = yes
    trigger = { This wasn't here before, I just added it because I was angry at the game
        NOT = { is_lover = FROMFROM }
    }

    
    immediate = {
        FROMFROM = { character_event = { id = WoL.1003 } }
    }
}

# Spouse suspected of affair - Choices
character_event = {
    id = WoL.1003
    desc = {
        text = EVTDESC_WOL_1003
        trigger = {
            NOT = { has_character_flag = tipped_off_about_spouse_affair }
            NOT = { has_character_flag = spy_spouse_affair }
            FROMFROM = {
                ROOT = {
                    FROM = {
                        NOT = { is_close_relative = PREVPREV }
                    }
                }
            }
        }
    }
    desc = {
        text = EVTDESC_WOL_1003_CR
        trigger = {
            NOT = { has_character_flag = tipped_off_about_spouse_affair }
            NOT = { has_character_flag = spy_spouse_affair }
            FROMFROM = {
                ROOT = {
                    FROM = {
                        is_close_relative = PREVPREV
                    }
                }
            }
        }
    }
    
    desc = {
        text = EVTDESC_WOL_1003_TIP
        trigger = {
            has_character_flag = tipped_off_about_spouse_affair
        }
    }
    
    desc = {
        text = EVTDESC_WOL_1003_SPY_RESULT
        trigger = {
            has_character_flag = spy_spouse_affair
        }
    }
    
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_intrigue
    
    is_triggered_only = yes
    
    immediate = {
        character_event = { id = WoL.2000 days = 1 } # Chance of levelling up Intrigue skills
        
        if = {
            limit = { has_character_flag = tipped_off_about_spouse_affair }
            FROMFROMFROM = { character_event = { id = WoL.1025 days = 3 } }
        }
    }
    
    option = {        the spouse picked this option
        name = EVTOPTA_WOL_1003 # Confront Spouse
        ai_chance = {
            factor = 100
            modifier = {
                factor = 2.0
                trait = honest
            }
        }
        
        hidden_tooltip = {
            clr_character_flag = tipped_off_about_spouse_affair
            clr_character_flag = spy_spouse_affair
            FROMFROM = { character_event = { id = WoL.1004 days = 2 } }
        }
    }

    
    option = {
        name = {
            text = EVTOPTB_WOL_1003_F # Confront the Lover
            trigger = { FROM = { is_female = yes } }
        }
        name = {
            text = EVTOPTB_WOL_1003_M # Confront the Lover
            trigger = { FROM = { is_female = no } }
        }
        ai_chance = {
            factor = 100
            modifier = {
                factor = 2.0
                trait = deceitful
            }
            modifier = {
                factor = 2.0
                personal_opinion = {
                    who = FROMFROM
                    value = 50
                }
            }
            modifier = {
                factor = 3.0
                is_lover = FROMFROM
            }
        }
        hidden_tooltip = {
            clr_character_flag = tipped_off_about_spouse_affair
            clr_character_flag = spy_spouse_affair
            FROM = { character_event = { id = WoL.1033 days = 2 } }
        }
    }
    
    option = {
        name = EVTOPTC_WOL_1003_HOMO_F # Two women? Who cares...
        trigger = {
            FROM = { is_female = yes }
            FROMFROM = { is_female = yes }
        }
        ai_chance = {
            factor = 100
        }
        clr_character_flag = tipped_off_about_spouse_affair
        clr_character_flag = spy_spouse_affair
    }
    
    option = {
        name = EVTOPTC_WOL_1003 # Focus on more important matters
        trigger = {
            OR = {
                FROM = { is_female = no }
                FROMFROM = { is_female = no }
            }
        }
        
        ai_chance = {
            factor = 1
            modifier = {
                factor = 500.0
                trait = craven
            }
        }
        
        if = {
            limit = {
                NOT = { trait = arbitrary }
                NOT = { trait = depressed }
            }
            random = {
                chance = 20
                add_trait = depressed
                hidden_tooltip = {
                    character_event = { id = 38288 } # Depressed gained
                }
            }
        }
        
        clr_character_flag = tipped_off_about_spouse_affair
        clr_character_flag = spy_spouse_affair
    }
}

# Spouse is confronted
character_event = { And this was the event my character received, and I was like: "Wait, what?"
    id = WoL.1004
    picture = GFX_evt_quarrel
    border = GFX_event_normal_frame_intrigue
    
    is_triggered_only = yes
    
    desc = EVTDESC_WOL_1004
    
    option = {
        name = EVTOPTA_WOL_1004 # Confess and ask forgiveness (break up with lover)
        ai_chance = {
            factor = 100
            modifier = {
                factor = 3.0
                is_lover = FROM
            }
            modifier = {
                factor = 5.0
                trait = honest
            }
            modifier = {
                factor = 2.0
                trait = craven
            }
            modifier = {
                factor = 2.0
                trait = just
            }
            modifier = {
                factor = 0.5
                NOT = {
                    personal_opinion = {
                        who = FROM
                        value = 0
                    }
                }
            }
            modifier = {
                factor = 0.25
                NOT = {
                    personal_opinion = {
                        who = FROM
                        value = -50
                    }
                }
            }
        }
        
        FROMFROM = { character_event = { id = WoL.1005 tooltip = EVTTOOLTIP_WoL_1005 } } # Lover notified
        remove_lover = FROMFROM
        
        FROM = { character_event = { id = WoL.1006 days = 2 tooltip = EVTTOOLTIP_WoL_1006 } }
    }
    
    option = {
        name = EVTOPTB_WOL_1004 # Cruelly admit
        ai_chance = {
            factor = 100
            modifier = {
                factor = 0
                is_close_relative = FROMFROM
            }
            modifier = {
                factor = 2.0
                trait = arbitrary
            }
            modifier = {
                factor = 5.0
                trait = cruel
            }
        }
        
        FROM = { character_event = { id = WoL.1009 days = 2 tooltip = EVTTOOLTIP_WoL_1009 } }
    }
    
    option = {
        name = EVTOPTC_WOL_1004 # Lie and deny
        ai_chance = {
            factor = 100
            modifier = {
                factor = 5.0
                trait = deceitful
            }
        }
        
        FROM = { character_event = { id = WoL.1022 days = 2 tooltip = EVTTOOLTIP_WoL_1022 } }
    }
    
    option = {
        name = EVTOPTD_WOL_1004 # Skillfully manipulate (high intrigue)
        tooltip_info = intrigue
        trigger = {
            attribute_diff = {
                attribute = intrigue
                character = FROM
                value = 5
            }
            FROM = {
                NOT = { has_focus = focus_intrigue }
            }
        }
        ai_chance = {
            factor = 10000
        }
        
        FROM = { character_event = { id = WoL.1010 days = 2 tooltip = EVTTOOLTIP_WoL_1010 } }
    }
}

 

So above I've posted a LOT of code. TL;DR the spouse confronted my character about lover №2, despite the fact that she should have only cared about lover №3.

Again, this is modified vanilla code, so it's only found in my mod. I've revisited this countless times and for the past few months this event chain seemed to worked as I wanted, until yesterday. I'm inclined to think at this point that this is just the engine glitching out, but I want to be sure.

 

EDIT: I've realized why the event was firing - the spouse had an intrigue focus and decided to spy on me.

Link to comment
2 hours ago, Buzhidao said:

EDIT: I've realized why the event was firing - the spouse had an intrigue focus and decided to spy on me.

Sometimes it is hard to find all the things that trigger something like this.  I had that problem trying to keep some of the bastard events from happening.

Link to comment

Thanks for the comments on the missing capital letter in the event window. In fact it was something really simple (and stupid) I had left a space after the  semicolon  in the localization files ?

 

Another stupid (?) question: In an event which is recursive, I want an option to disappear from the event window  after it has been used once. So the following time the event fires it shows only three options instead of four. Ideally I would like the option to be replaced by a new one but i'll take it step by step. Is this possible? I have tried the following:

 

Spoiler

narrative_event = {
    id = RSLCourt.5320
    desc = RSLCourt5320
    picture = suspended_victim
    title = rsl_up_the_ante
    is_triggered_only = yes # Triggered by .5201
    immediate = {
            limit = {
                event_target:rsl_victim_target = {
                                                NOT = {
                                                  has_character_flag = dislocated_joints
                                                }        
                }
            }
            
            option = {
                    trigger = { has_artifact = rsl_the_rack }
            
            
                    name = EVTOPTA_Court_5320
                    custom_tooltip = { text = EVTOPTA_Court_5320_TT }
                    narrative_event = { id = RSLCourt.5321 }
            }
            
    }
    
    option = {  #etc etc

 

The option should fire if the victim does not have dislocated_joints. I tried it with and without the NOT (just in case)but in both cases the option does not appear in the window.

I know it must be simple but I just can't find it.

Link to comment

@joemann
The immediate section is for executing commands before the rest of the event is shown, it is always executed when the event is fired (Keep in mind that it gets executed after the event's trigger conditions were evaluated) and can't be blocked by a limit / trigger of itself. (if sections in it can be blocked though)

 

Put the option outside the immediate section and add the conditions from the immediate's limit section to the options trigger section.
Also, remove the limit from the immediate section or the immediate altogether if you don't need it.


As for replacing, I'm not sure, but try giving the original option this trigger:

trigger = {
	event_target:rsl_victim_target = {
		NOT = {
			has_character_flag = dislocated_joints
		}        
	}
	has_artifact = rsl_the_rack
}

and have another option with this trigger:

trigger = {
	event_target:rsl_victim_target = {
		has_character_flag = dislocated_joints
	}
	has_artifact = rsl_the_rack
}

 

Link to comment

I just started up a saved game (after a week absence) and suddenly a scripted effect which worked perfectly when I left no longer functions. It is now also recognized by Validator as an invalid node. I did notice that in the start-up screen a new button has appeared "Export Game" Could this be the cause ?

Link to comment
21 hours ago, joemann said:

I just started up a saved game (after a week absence) and suddenly a scripted effect which worked perfectly when I left no longer functions. It is now also recognized by Validator as an invalid node. I did notice that in the start-up screen a new button has appeared "Export Game" Could this be the cause ?

Something vaguely similar has happened to me and the cause was a different mod overwriting my changes.

 

I have a question: how many times should "on_chronicle_start" events fire? I assumed they only fire once, but so far an event I'd made has fired 10 times already. I didn't forget to put "is_triggered_only = yes" into the event, nothing else triggers it, so what gives?

Link to comment
2 hours ago, finkwink said:

Is there any way to create a character as part of a decision and then add that character to my prison? Any help would be appreciated.

Decision like in an event or targeted decision? Well it has to be in an event (fired from targeted decision as well) (look for example at creation of characters in wol seduction folders if you have them) and once you write/code the traits that the character will have upon creation, than write in a hidden modifier or something that will cause another event to fire upon creation that would remove it and throw the character into your prison.

Link to comment
22 hours ago, finkwink said:

Is there any way to create a character as part of a decision and then add that character to my prison? Any help would be appreciated.

create_character = {

# stuff to define the character's attributes

}

new_character = {

imprison = ROOT

}

 

This will only work in normal (not targeted) decisions because of the scope. Read the wiki on how to create a character you need.

Link to comment

Does anybody know the correct syntax for a random repeat_event?

 

The Wiki says; 

 

"repeat_event = { id = WoL.5002 days = 30 }

 

Optional. Number of days to add randomly for the event occurrence date, closed-ended (days to days+random). "

 

Would this be : "repeat_event = { id = WoL.5002 days_random = 30 }" ?

 

 

 

 

Link to comment
35 minutes ago, joemann said:

Thanks. A more general question. Sometimes when I am playing a game, I notice an error, save the game  and  then modify  the code. If I reload the saved game, does it continue with the old code or will it read the new code?

That's a bit of a tricky question.

 

In general, if you quit out of the game, change the code, then reload the game, then the game will use the new code. However, there are times when it will still continue to look for the old code, such as clicking on an option that has

character_event = { id = Blahblahblah.1 days = 40 }

and then saving the game and exiting, modifying the code so that it reads

character_event = { id = Blahblahblah.2 days = 40 }

Because the event has already fired and you locked in the option before saving, the game will still try and look for Blahblahblah.1 instead of .2 after 40 days

Link to comment
On 9/28/2018 at 10:19 AM, Buzhidao said:

create_character = {

# stuff to define the character's attributes

}

new_character = {

imprison = ROOT

}

 

This will only work in normal (not targeted) decisions because of the scope. Read the wiki on how to create a character you need.

Thank you. That was very helpful.

Link to comment

I have a chain of events originating from a third party decision. The parties are the liege (player) his court torturer ( a minor_title ) and a victim. At some stage it is possible that the victim dies before or shortly after  submitting due to its declining health stats . I am trying to create an event that fires when this happens and tried using the on_action trigger on_death.

In the on_action event the dead victim is ROOT. How do I get the court_torturer back in the event?

 

I tried this:


 

Spoiler

 

## death under torture
character_event = {
    id = RSLCourt.5342
    hide_window = yes
    
    is_triggered_only = yes # on_action on_death
    
    immediate = {
                ROOT = { save_event_target_as = rsl_victim_target }
                                        
    }
    trigger = {
            event_target:rsl_victim_target = {
                                            OR = {
                                                has_character_flag = in_torture_chamber
                                                had_character_flag = { flag = in_torture_chamber days = 10 }
                                            }
            }                                
    }                            
                
    any_courtier_or_vassal = {
                            has_minor_title = rsl_court_torturer
                            liege = {character = PREVPREV }
                            
                            narrative_event = { id = RSLCourt.5343 }
    }
}
narrative_event = {
    id = RSLCourt.5343
    desc = RSLCourt5343
    picture = dead_prisoner
    title = rsl_bungeled
    is_triggered_only = yes

    option = {
            name = EVTOPT_Court_5343
                prestige = -15
                change_learning = -1
    }                                
}


 

However, Validator has objections.

 

--- Error 1 of 1 ---
At <mod>\events\RSLCourtandCommerce.txt [character_event\any_courtier_or_vassal] (Line 3190, column 2):
Invalid node "any_courtier_or_vassal" in scope CharEvent (value is: <a complex type>)

 

Is there another way of doing this?

 

Link to comment
3 hours ago, joemann said:

I have a chain of events originating from a third party decision. The parties are the liege (player) his court torturer ( a minor_title ) and a victim. At some stage it is possible that the victim dies before or shortly after  submitting due to its declining health stats . I am trying to create an event that fires when this happens and tried using the on_action trigger on_death.

In the on_action event the dead victim is ROOT. How do I get the court_torturer back in the event?

 

I tried this:


However, Validator has objections.

 

--- Error 1 of 1 ---
At <mod>\events\RSLCourtandCommerce.txt [character_event\any_courtier_or_vassal] (Line 3190, column 2):
Invalid node "any_courtier_or_vassal" in scope CharEvent (value is: <a complex type>)

 

Is there another way of doing this?

 

 The problem I'm seeing is that your trigger is calling for an event_target that hasn't happened yet. Triggers are checked before anything else in the code. The on_action looks at the code and sees trigger before anything else, then moves on to the event proper if the conditions are right. The order of operation is: trigger>immediate>everything else

 

Try swapping the two around.

 

Quote

character_event = {
    id = RSLCourt.5342
    hide_window = yes
    
    is_triggered_only = yes # on_action on_death
    trigger = {
        OR = {
            has_character_flag = in_torture_chamber
            had_character_flag = { flag = in_torture_chamber days = 10 }
        }                                
    }    

    immediate = {
        save_event_target_as = rsl_victim_target 
        any_courtier_or_vassal = {
            has_minor_title = rsl_court_torturer
            liege = {character = PREVPREV }
            narrative_event = { id = RSLCourt.5343 }
        }
    }
}

Try that and see if it works. You also don't need to save an event target unless the RSLCourt.5343 event calls for it, either in the event code or the localisation (ex: [rsl_victim_target.GetDynName] )

Link to comment

Thanks for your help. I followed your advice and have now combined both events, as follows:

 

Spoiler

## death under torture
character_event = {
    id = RSLCourt.5342
    desc = RSLCourt5343
    picture = dead_prisoner
    title = rsl_bungeled
    
    is_triggered_only = yes # on_action on_death  ROOT is the dead character
    trigger = {
            ROOT = {
                    is_alive = no
                OR = {
                    has_character_flag = in_torture_chamber
                    had_character_flag = { flag = in_torture_chamber days = 10 }
                    has_character_flag = resisting_ransomee
                    has_character_flag = resisting_plotter
                    has_character_flag = resisting_heretic
                    has_character_flag = resisting_slave
                }
            }    
    }    
                            
    option = {
            name = EVTOPT_Court_5343
            any_courtier_or_vassal = {
                                    has_minor_title = rsl_court_torturer
                                    liege = {character = PREVPREV }            
            }
    
            
            prestige = -15
            change_learning = -1
    }
}

However, the event does not fire upon the death of ROOT. Do character_flags persist after the death of a character? If not, I don't really know how to identify the character for trigger purposes. Same question for prisoner = yes.

Link to comment
19 minutes ago, joemann said:

Thanks for your help. I followed your advice and have now combined both events, as follows:

 

  Hide contents

## death under torture
character_event = {
    id = RSLCourt.5342
    desc = RSLCourt5343
    picture = dead_prisoner
    title = rsl_bungeled
    
    is_triggered_only = yes # on_action on_death  ROOT is the dead character
    trigger = {
            ROOT = {
                    is_alive = no
                OR = {
                    has_character_flag = in_torture_chamber
                    had_character_flag = { flag = in_torture_chamber days = 10 }
                    has_character_flag = resisting_ransomee
                    has_character_flag = resisting_plotter
                    has_character_flag = resisting_heretic
                    has_character_flag = resisting_slave
                }
            }    
    }    
                            
    option = {
            name = EVTOPT_Court_5343
            any_courtier_or_vassal = {
                                    has_minor_title = rsl_court_torturer
                                    liege = {character = PREVPREV }            
            }
    
            
            prestige = -15
            change_learning = -1
    }
}

However, the event does not fire upon the death of ROOT. Do character_flags persist after the death of a character? If not, I don't really know how to identify the character for trigger purposes. Same question for prisoner = yes.

 

To answer your question, on_death fires before the actual death happens. That means the character is still technically alive for the purposes of scripting. You don't need is_alive = yes. You just need an identifiable trigger that will make the event see only that character. Character flags work perfectly fine.

 

Triggers are filters, essentially. When the event is called, in this case from on_death, it will look through ALL characters that have died that day. The trigger will then filter out any character from that search that doesn't meet the requirements. And because the on_death will scope only to the dying character, you don't need ROOT except when handling other scopes, such as when you want to send a notification to that character's liege for example.

Link to comment

I still have a problem understanding mean_time_to_ happen. According to the wiki, the factors increase or decrease the chance of the (on_action) event happening. The higher the factor the lower the chance (?) What does the operator <days = do>

 

I have an event onset of menopause. It is an on_ yearly_ pulse event. I want the event to fire after the age of 42 with an increasing chance the older the character gets, influenced by other factors. The way I understand it the on_action event fires the first time  on age 42, calculates whether menopause sets in or not and if not fires again at 43 recalculates etc until menopause sets in.

 

I tried to do this as follows but I have the impression the the frequency of early menopause onset is much to high. What I would like to know is if my understanding of the mechanics is correct and I just need to do some tweaking of factors or weather I am on the wrong track.

 

Spoiler

## onset of menopause
character_event = {
id = RSLB.904
hide_window = yes
is_triggered_only = yes  ## by on_action on yearly pulse
only_women = yes
has_character_flag = has_cycle

age = 40

    trigger = {    age = 40
                is_female = yes
    
            NOT = { has_character_flag = menopausal }

    }    
    weight_multiplier = {
                    days = 360
                    
                    modifier = {
                            factor = 4
                            age = 40
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 3
                            age = 40
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    
                    modifier = {
                            factor = 2
                            age = 41
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 1.5
                            age = 41
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 1.25
                            age = 42
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 1.10
                            age = 42
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 0.95
                            age = 43
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 0.85
                            age = 44
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 0.75
                            age = 44
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 0.65
                            age = 44
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 0.45
                            age = 45
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 0.35
                            age = 45
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 0.25
                            age = 46
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 0.15
                            age = 46
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
                    modifier = {
                            factor = 0.10
                            age = 47
                            OR = {
                                num_of_children = 2
                                trait = temperate
                                trait = curvaceous
                                trait = voluptuous
                            }
                                
                    }
                    modifier = {
                            factor = 0.10
                            age = 47
                            OR = {
                                num_of_children == 0
                                trait = gluttonous
                                trait = lithe
                                trait = slender
                            }
                                
                    }
    }


    clr_character_flag = has_cycle
    clr_character_flag = menstruating
    clr_character_flag = ovulating
    set_character_flag = menopausal
    f_shape_grows = yes


    
}
                       

 

Link to comment

Problem 1:

 

5 hours ago, joemann said:

has_character_flag = has_cycle

age = 40

    trigger = {    age = 40
                is_female = yes
    
            NOT = { has_character_flag = menopausal }

    }  

 

Fix:

 

    trigger = {    
        has_character_flag = has_cycle
        age = 40
        is_female = yes
        NOT = { has_character_flag = menopausal }
    } 

 

Problem 2:

 

5 hours ago, joemann said:

    clr_character_flag = has_cycle
    clr_character_flag = menstruating
    clr_character_flag = ovulating
    set_character_flag = menopausal
    f_shape_grows = yes

 

Fix:

 

    immediate = {
        clr_character_flag = has_cycle
        clr_character_flag = menstruating
        clr_character_flag = ovulating
        set_character_flag = menopausal
        f_shape_grows = yes
    }

 

Link to comment
5 hours ago, joemann said:

I still have a problem understanding mean_time_to_ happen. According to the wiki, the factors increase or decrease the chance of the (on_action) event happening. The higher the factor the lower the chance (?) What does the operator <days = do>

 

I have an event onset of menopause. It is an on_ yearly_ pulse event. I want the event to fire after the age of 42 with an increasing chance the older the character gets, influenced by other factors. The way I understand it the on_action event fires the first time  on age 42, calculates whether menopause sets in or not and if not fires again at 43 recalculates etc until menopause sets in.

 

I tried to do this as follows but I have the impression the the frequency of early menopause onset is much to high. What I would like to know is if my understanding of the mechanics is correct and I just need to do some tweaking of factors or weather I am on the wrong track.

 

Now, as for your question, the days = x is (to my meager understanding) how long it has been since the pulse before the random_event factor in the on_action is modified, by the normal modifiers. Every 360 days the event will look at your list of events in random_events and modify the chance based on the modifiers for the next pulse. For example, if you have a random list of 

 

100 = blah.1

75 = blah.2

50 = blah.3

 

and you have
 

id = blah.3

modifier_multiplier = {

   days = 30

   modifier = {

   factor = 4

   trait = wounded

   }

}

 

then after 30 days, if you are wounded, blah.3 will jump up to 200 in the random_event list, making it twice as likely to be picked over blah.1 on the next pulse (but it's still possible to get blah.1 or blah.2)

 

 

Then again, I could be entirely wrong. There's very little information on the wiki and google searches don't help much. Even the vanilla code is pretty sparse on information.

Link to comment

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use