Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

On ‎7‎/‎7‎/‎2019 at 8:07 PM, dwjlien said:

What program are you using to edit the localisation.csv? Often word/office puts a     at the start of lines but dont display them.

Open the .csv in notepad++ and check.

Use any text editor, the same one you use for scripts.

Link to comment

One question on the traits transmission.

 

The context is having 2 opposite traits with a 100% inherit chance and parent having one of each.

 

After some test it seems that the father trait is always inherited first (so the mother is never inherited)

 

Can someone confirm that and, eventually, is there a way to randomize that without removing the inheritance on traits and managing the on_birth() action?

Link to comment

Can someone please tell me why this isn't working? I'm trying to make a interaction with the husband being the decision taker and the wife being the decision receiver, do I have ROOT and FROM backwards? According to the Validator the only issue is "is_male" is apparently a "invalid node".

 

 

 


 

targetted_decisions = {
    
    trophy_wife = {
        filter = spouse
        ai_target_filter = spouse
        ai_check_interval = 24 # Every 2 years
        from_potential = {
            is_male = yes
            is_married = yes
            prisoner = no
        }
        potential = {
            any_spouse = {
                character = FROM
            }
        }
        allow = {
            always = yes
        }
        effect = {
            FROM = {
                narrative_event = { id = SimpleTest.2 }
            }
            ROOT = {
                narrative_event = { id = SimpleTest.3 }
            }
        }
        ai_will_do = {
            factor = 1
        }
    }
}

 
 

 


 

Link to comment

1/ 'is_male = yes' is to replace with 'NOT = { is_female = yes}

2/ The second thing I see is you are launching 2 events at the same time, I don't know if it works, why not to launch the first and chain on the second?

 

Some tips, even if I have a low knowledge of the product :

  • Make the decision name more unique, if another mod use a name as generic as wife_trophy (and it will happen) the game will break

 

Link to comment
59 minutes ago, lockeslylcrit said:

There is no "is_male"

There is only "is_female = yes/no" 

 

Wow, it really was that simple, everything works now. I've been using "is_male" all over the place, now I know why I have so many problems lol. Thanks as always.

 

49 minutes ago, Strec said:

1/ 'is_male = yes' is to replace with 'NOT = { is_female = yes}

2/ The second thing I see is you are launching 2 events at the same time, I don't know if it works, why not to launch the first and chain on the second?

 

Some tips, even if I have a low knowledge of the product :

  • Make the decision name more unique, if another mod use a name as generic as wife_trophy (and it will happen) the game will break

 

I've got a bad habit of starting mods on a spur-of-the-moment idea then getting bored of it 5 minutes later leaving my mod directory littered with super basic framework's ? if anything actually comes of this ill go back and make everything more complex. Appreciate it.

Link to comment

Concerning the NOT = { is_female = yes} replacing the is_female=no it is a general dev tip and Don't know if it is adequate in CK2 but in doubt ...

 

Some langage can support a non-defined status for all types, even boolean so a boolean can sometimes be 'yes', 'no' or 'undefined'.

 

In such a case '[Something tested]=no' will eliminate 'undefined' status and 'NOT = { [Something tested]=yes}' will accept undefined :)

 

edit: replaced 'is_female' by '[Something tested]' to avoid confusion...

 

Link to comment
16 minutes ago, Strec said:

Concerning the NOT = { is_female = yes} replacing the is_female=no it is a general dev tip and Don't know if it is adequate in CK2 but in doubt ...

 

Some langage can support a non-defined status for all types, even boolean so a boolean can sometimes be 'yes', 'no' or 'undefined'.

 

In such a case 'is_female=no' will eliminate 'undefined' status and 'NOT = { is_female=yes}' will accept undefined :)

 

 

That's all well and good, but CK2 is hardcoded to have only male and female. There is no undefined.

 

There is only one difference between is_female = no and NOT = { is_female = yes } and that is in localisation. Using is_female = no in an area of the code where the player can see it (such as the allow block of decisions) will produce "Is male" (or "Is female" is is_female = yes). By similar token, NOT = { is_female = yes } will show the exact same thing.

 

is_female = no and NOT = { is_female = yes } are functionally the exact same thing with the exact same results. The difference being that the former requires less typing and doesn't mess up due to the common problem of a missing brace that all modders are afflicted with at some point in their modding careers.

Link to comment

I just started learning how to create a event and was trying to make a chain event, but I'm failing miserably.

The first works just fine, I use the console to call it and it appears, everything normal, but the second doesn't work, it says that the ID does not exist and I'm goind crazy because of it.

 

Here's the code (sorry for the mess, I'm not used to create mods yet):

 

Spoiler

namespace = NWD
# Start NWD
character_event = {
    id = NWD.0101
    border = GFX_event_normal_frame_diplomacy
    hide_from = yes

    is_triggered_only = yes  # temporary
    
    trigger = { ai = no
                war = no
                capable_only = yes
                prisioner = no
                in_command = no
                NOT = { has_character_flag = flag_NWD_event_fired } 
            }

    desc = { 
        trigger = { trait = brave 
                    NOT = { trait = greedy }
                    }
            text = NWD1desc_b
            }
    
    desc = {
        trigger = { trait = greedy 
                    NOT = { trait = brave } 
                    }
            text = NWD1desc_g 
            }
    
    desc = {
        trigger = { trait = brave
                    trait = greedy
                    NOT = { trait = lunatic } 
                    } 
            text = NWD1desc_a 
            }
    
    desc = {
        trigger = { 
                    NOT = { trait = brave trait = greedy }
                    }
        text = NWD1desc_n
            }
    
    desc = {
        trigger = { trait = lunatic }
        text = NWD1desc_lunatic
            }
    
        
    option = { 
        name = NWD_opt_yes 
        character_event = { id = NWD.0102 }
        custom_tooltip = { text = NWD_opt_yes_t }
        set_character_flag = flag_NWD_event_fired_I
            }
    
    option = { 
        name = NWD_opt_no
        
         custom_tooltip { text = NWD_opt_no_t }
        set_character_flag = flag_NWD_event_fired_II
            }
    
    option = {
        name = NWD_opt_lunatic
        tooltip_info_custom = lun_tooltip
        trigger = { trait = lunatic 
                    trait = greedy 
                    trait = cruel }
        NOT = { trait = patient 
                trait = kind 
                trait = charitable }
        set_character_flag = flag_NWD_event_ter
        add_character_modifier = {
                                    name = kill_merchants_m
                                }
            }
    picture = { GFX_evt_bad_news }    
}
#NWD follow-up..
character_event = {
    id = NWD.0102
    is_triggered_only = yes
    border = GFX_event_normal_frame_diplomacy
    
    desc = NWD2desc
    
    option = {
        name = NWD2_opt1
        custom_tooltip = { text = NWD2_opt1_I }
        character_event = { id = 0103 }
            }
    option = {
        name = NWD2_opt2
        custom_tooltip = { text = NWD2_opt2_I }
        set_character_flag = flag_NWD_event_fired_II
            }
    picture = { GFX_evt_bad_news }    
}
 

 

Doesn't matter what I do, the second event won't work even using the console.

Link to comment

Kekvit is wrong, I use a ton of 000X events in Dark World Tentacles and the engine parses them fine. The problem is with your last option:

 

option = {
    name = NWD_opt_lunatic
    tooltip_info_custom = lun_tooltip

    trigger = {
        trait = lunatic 
        trait = greedy 
        trait = cruel
    }
    NOT = {
        trait = patient 
        trait = kind 
         trait = charitable
    }  

    set_character_flag = flag_NWD_event_ter
    add_character_modifier = {
        name = kill_merchants_m
    }
}

As you can see with this indentation, your NOT is outside the trigger block, which may be screwing up the compiler. Furthermore, the picture property takes a string, not a clause. So picture = { GFX_evt_bad_news } will not work, and may itself cause the compiler to mess up. If you fix these issues, the second event will most likely run properly.

 

You should also know that as worded, the trigger will only return true if all of the conditions are true - that is, the ruler is a greedy cruel lunatic who is not patient. If you want any of the possibilities to allow the option to be taken, you should use OR and NOR. Kind and Charitable are defined as opposites of Greedy and Cruel, so they will never show up on the same character and you can safely remove them as conditions.


I also suggest that you add a duration to the kill_merchants_m character modifier.

Link to comment
9 hours ago, cherisong said:

As you can see with this indentation, your NOT is outside the trigger block, which may be screwing up the compiler. Furthermore, the picture property takes a string, not a clause. So picture = { GFX_evt_bad_news } will not work, and may itself cause the compiler to mess up. If you fix these issues, the second event will most likely run properly.

It's as you said, thank you. It was such a simple problem and I haven't seen it... 

9 hours ago, cherisong said:

I also suggest that you add a duration to the kill_merchants_m character modifier.

Is it necessary to put the duration on the event main code too? because I have added it to the event_modifiers folder, and the duration appears in game just fine.

18 hours ago, lockeslylcrit said:

First, try to avoid putting zeros in your event id. 101 is fine, 0101 tends to make the code bug out.

 

Second,  


character_event = { id = 0103 }

needs the namespace.

 

 

Thanks, I haven't seen that too. And I will try to do as you said, because even if the code doesn't bug out, I will probably forget about the first and freak out again, imagining it's some bug.

Anyway, thanks again guys ?

Link to comment

Hi.

I'm not yet exactly a modder (though I did tinker a bit with the Cheat mod, and I did make a functional AU mod with the Generator, but neither were complicated enough to count).

So, I wish for a mod (or an easy set of tips) on the following topic:

Removing ALL automatic pregnancies.

Like, literally, ALL of them.

I want to make (or find) a mod that makes the "sex-to-child" chain OBLIGATORY on the EVENT level.

Sure, the Cheat mod (forgot the actual name, it's the one that lets see you manually impregnate people and mind control them), well, lets you ADD a manual impregnation on top of the automatic ones, but that's not what I'm looking for.

I want to BAN the behind-the-scene pregnancy mechanics FOR GOOD.

I want to be the one in control of WHEN I get a child (even if a bit controlled by probabilities).

In other words, I want to have a child WHEN I want to have him - and not either wait forever for some OBSCURE event to fire, OR be flooded by UNWANTED heirs all over myself.

I want NEITHER - but to be in control of it MYSELF.

And I repeat - the Cheat mod only solved the GETTING side, but it never solved the NOT GETTING one.

Also, I've been advised to simply give everyone MINUS INFINITE Fertility, but I doubt it would fix it 100%.

Plus, I want the EVENT thing as well - and I myself am kinda way too inexperienced for such a modding endeavour.

Can anyone please help me?

The BEST solution would be finding a mod that already does it (and hopefully isn't annoying in some other way).

Thanks in advance!

Link to comment
12 minutes ago, zigmas said:

Hi.

I'm not yet exactly a modder (though I did tinker a bit with the Cheat mod, and I did make a functional AU mod with the Generator, but neither were complicated enough to count).

So, I wish for a mod (or an easy set of tips) on the following topic:

Removing ALL automatic pregnancies.

Like, literally, ALL of them.

I want to make (or find) a mod that makes the "sex-to-child" chain OBLIGATORY on the EVENT level.

Sure, the Cheat mod (forgot the actual name, it's the one that lets see you manually impregnate people and mind control them), well, lets you ADD a manual impregnation on top of the automatic ones, but that's not what I'm looking for.

I want to BAN the behind-the-scene pregnancy mechanics FOR GOOD.

I want to be the one in control of WHEN I get a child (even if a bit controlled by probabilities).

In other words, I want to have a child WHEN I want to have him - and not either wait forever for some OBSCURE event to fire, OR be flooded by UNWANTED heirs all over myself.

I want NEITHER - but to be in control of it MYSELF.

And I repeat - the Cheat mod only solved the GETTING side, but it never solved the NOT GETTING one.

Also, I've been advised to simply give everyone MINUS INFINITE Fertility, but I doubt it would fix it 100%.

Plus, I want the EVENT thing as well - and I myself am kinda way too inexperienced for such a modding endeavour.

Can anyone please help me?

The BEST solution would be finding a mod that already does it (and hopefully isn't annoying in some other way).

Thanks in advance!

 

GO inside the /common/SCRIPTED_effects/ folder AND open up THE 00_scripted_EFFECTS.txt file.

Run a SEARCH for impregnate_effect_EVENT_target:

 

Spoiler

impregnate_effect_event_target = {
	if = {
		limit = { is_opposite_sex = event_target:sex_partner }

		#If THIS is a female which can get pregnant
		if = {
			limit = {
				is_female = yes
				NOT = { age = 45 }
				is_pregnant = no
				health = 3
				event_target:sex_partner = { NOT = { trait = eunuch } }
			}

			#THIS is not consort/spouse of anyone or is consort/spouse of event_target:sex_partner
			if = {
				limit = {
					OR = {
						AND = {
							is_married = no
							is_consort = no
						}
						AND = {
							is_consort = yes
							consort = { character = event_target:sex_partner }
						}
						AND = {
							is_married = yes
							spouse = { character = event_target:sex_partner }
						}
					}
				}
				event_target:sex_partner = { impregnate = PREV }
			}

			#THIS is consort/spouse of someone else than event_target:sex_partner
			if = {
				limit = { 
					OR = {
					 	AND = {
					 		is_married = yes
					 		NOT = { spouse = { character = event_target:sex_partner } }
					 	}
					 	AND = {
					 		is_consort = yes
					 		NOT = { consort = { character = event_target:sex_partner } }
					 	}
					}
				}
				event_target:sex_partner = { impregnate_cuckoo = PREV }
			}
		}

		#If event_target:sex_partner is a female which can get pregnant
		if = {
			limit = {
				event_target:sex_partner = {
					is_female = yes
					NOT = { age = 45 }
					is_pregnant = no
					health = 3
					PREV = { NOT = { trait = eunuch } }
				}
			}

			#event_target:sex_partner is not consort/spouse of anyone or is consort/spouse of THIS
			if = {
				limit = {
					event_target:sex_partner = {
						OR = {
							AND = {
								is_married = no
								is_consort = no
							}
							AND = {
								is_consort = yes
								consort = { character = PREVPREV }
							}
							AND = {
								is_married = yes
								spouse = { character = PREVPREV }
							}
						}
					}
				}
				impregnate = event_target:sex_partner
			}

			#event_target:sex_partner is consort/spouse of someone else than THIS
			if = {
				limit = {
					event_target:sex_partner = {
						OR = {
						 	AND = {
						 		is_married = yes
						 		NOT = { spouse = { character = PREVPREV } }
						 	}
						 	AND = {
						 		is_consort = yes
						 		NOT = { consort = { character = PREVPREV } }
						 	}
						}
					}
				}

				impregnate_cuckoo = event_target:sex_partner
			}
		}
	}
}

 

 

and REPLACE it with:

 

impregnate_effect_event_target = {
}

 

Do the SAME with IMPREGNATE_effect:

 

Spoiler

impregnate_effect = {
	if = {
		limit = { is_opposite_sex = FROM }

		#If ROOT is a female which can get pregnant
		if = {
			limit = {
				is_female = yes
				NOT = { age = 45 }
				is_pregnant = no
				health = 3
				FROM = { NOT = { trait = eunuch } }
			}

			#ROOT is not consort/spouse of anyone or is consort/spouse of FROM
			if = {
				limit = {
					OR = {
						AND = {
							is_married = no
							is_consort = no
						}
						AND = {
							is_consort = yes
							consort = { character = FROM }
						}
						AND = {
							is_married = yes
							spouse = { character = FROM }
						}
					}
				}
				FROM = { impregnate = ROOT }
			}

			#ROOT is consort/spouse of someone else than FROM
			if = {
				limit = { 
					OR = {
					 	AND = {
					 		is_married = yes
					 		NOT = { spouse = { character = FROM } }
					 	}
					 	AND = {
					 		is_consort = yes
					 		NOT = { consort = { character = FROM } }
					 	}
					}
				}
				FROM = { impregnate_cuckoo = ROOT }
			}
		}

		#If FROM is a female which can get pregnant
		if = {
			limit = {
				FROM = {
					is_female = yes
					NOT = { age = 45 }
					is_pregnant = no
					health = 3
					ROOT = { NOT = { trait = eunuch } }
				}
			}

			#FROM is not consort/spouse of anyone or is consort/spouse of ROOT
			if = {
				limit = {
					FROM = {
						OR = {
							AND = {
								is_married = no
								is_consort = no
							}
							AND = {
								is_consort = yes
								consort = { character = ROOT }
							}
							AND = {
								is_married = yes
								spouse = { character = ROOT }
							}
						}
					}
				}
				impregnate = FROM
			}

			#FROM is consort/spouse of someone else than ROOT
			if = {
				limit = {
					FROM = {
						OR = {
						 	AND = {
						 		is_married = yes
						 		NOT = { spouse = { character = ROOT } }
						 	}
						 	AND = {
						 		is_consort = yes
						 		NOT = { consort = { character = ROOT } }
						 	}
						}
					}
				}

				impregnate_cuckoo = FROM
			}
		}
	}
}

 

 

impregnate_effect = {
}

 

 

YOU will never HAVE any random PREGNANCIES anymore. At ALL. Not SUGGESTED to do this unless YOU have another mod THAT adds in pregnancy MECHANICS.

Link to comment

An alternative to stripping out the pregnancy code entirely is to wrap the entire code block in "ai = yes" conditions, like so:

impregnate_effect_event_target = {
    if = {
        limit = {
            ai = yes
            event_target:sex_partner = { ai = yes }
        }
        <All the original code goes here>
    }
}

impregnate_effect = {
    if = {
        limit = {
            ai = yes
            FROM = { ai = yes }
        }
        <All the original code goes here>
    }
}

This means the random pregnancy effect will still happen, but only if both partners are computer-controlled. This way AI families can still have children and won't die out within one generation.

Link to comment
51 minutes ago, zigmas said:

Thanks a lot, though it WaS nOt necESSarY to moCk mY wRitinG stylE withoUt actUALLY UNDERstading iT.

Full caps are used for emphasis, but only sparingly. Otherwise it makes you look like a crazy conspiracy theorist nutcase :P

Link to comment

So I'm a complete noob at modding and I'm trying to make something where if a religion has male_temple_holders = no then when a temple has a male holder and that holder converts to a religion that has male_temple_holders = no, then he gets replaced with a female automatically. I have no real clue how I'm supposed to this properly and I kinda Frankensteined the following thing together without knowing what I'm actually doing:

 

Spoiler

replace_male_temple_holders = {
    trigger = {
        AND = {
            religion_allows_male_temple_holders = no
            holding_type = temple
            is_female = no
        }
    }
    mean_time_to_happen = {
        days = 1
    }
    immediate = {
        random_independent_ruler = {
            limit = {
                ai = yes
            }
            location = {        
                revoke_capital_holding = yes
                create_character = {
                    random_traits = yes
                    dynasty = none
                    religion = THIS
                    culture = THIS
                    female = yes
                    age = 25
                }
                new_character = {
                    inherit = PREV
                    grant_title = FROM
                }
            }
        }
    }
}

 

Ideally this would behave like when an Orthodox Bishop gets converted to Catholic (or vice-versa) and the title gets usurped by some random other person.

Any help would be greatly appreciated.

Link to comment
    trigger = {
        AND = {
            religion_allows_male_temple_holders = no
            holding_type = temple
            is_female = no
        }
    }

Scripting automatically defaults to AND. You don't need it unless you're nesting it in something like an OR or a NOR.

 

        random_independent_ruler = {
            limit = {
                ai = yes
            }

Using random_independent_ruler will choose an independent ruler at random. Independent meaning the top liege, not a vassal. You don't need this since the event will automatically assign the person getting the event as ROOT.

 

            location = {        
                create_character = {

Creating a character using a location is never wise.

                revoke_capital_holding = yes

You don't need this.

 

                new_character = {
                    inherit = PREV
                    grant_title = FROM
                }

There are better commands for this

 

 

 

Try this instead:

 

replace_male_temple_holders = {
    trigger = {
		religion_allows_male_temple_holders = no
		holding_type = temple
		is_female = no
		ai = yes
    }
	mean_time_to_happen = {
		days = 1
	}
	immediate = {
		location = { # Setting up scope chain
			ROOT = {
				create_character = {
					random_traits = yes
					dynasty = none
					religion = PREV
					culture = PREV
					female = yes
					age = 25 # Remove this line if you want a randomized age
				}
				new_character = {
					ROOT = { # Setting up a scope chain
						capital_holding = {
							ROOT = {
								abdicate_to = PREVPREVPREV # This goes back three scopes, i.e. new_character
								death = { death_reason = death_missing } # To ensure the old bishop disappears without notification
							}
						}
					}
				}
			}
		}
	}
}

 

Link to comment
  • 2 weeks later...
13 minutes ago, Alaratt said:

like a DWF portrait?

What is a 'DWF Portrait'? ?

So I made a dynamic portrait mod (just for fun) for the italiangfx but I want to add some events exclusivly for the italian culture where the ruler meets strange persons. I have made some static portraits for that specific purpose.

 

F. e. I made a Donatella Versace portrait and a Marina Abramovic portrait. And I have planned some more funny easter eggs.

 

a5be50-1565274545.png c81005-1565274589.png

 

I basically I want to spawn them randomly. For Marina Abramovic I plan on making some creepy events. For Donatella Versace I plan on making a event concerning the wife, maybe offering a special dress or an artifact or something.

 

 

But first I need to know if its  possible to spawn static portraits.

These are just some test projects bc Im trying to learn how to mod CKII.

Link to comment
1 minute ago, Angelo_Merkel said:

What is a 'DWF Portrait'? ?

So I made a dynamic portrait mod (just for fun) for the italiangfx but I want to add some events exclusivly for the italian culture where the ruler meets strange persons. I have made some static portraits for that specific purpose.

 

F. e. I made a Donatella Versace portrait and a Marina Abramovic portrait. And I have planned some more funny easter eggs.

 

a5be50-1565274545.png c81005-1565274589.png

 

I basically I want to spawn them randomly. For Marina Abramovic I plan on making some creepy events. For Donatella Versace I plan on making a event concerning the wife, maybe offering a special dress or an artifact or something.

 

 

But first I need to know if its  possible to spawn static portraits.

These are just some test projects bc Im trying to learn how to mod CKII.

DWF = Dark World Fantasy

 

I am not an expert but basically most of the modded portraits here are attached to a trait. When you assign that trait to a character it places the picture over the original portrait. 

So for example if you were using the fairy tales module for DWF and added the trait dwf_npc_belle to a npc it would show a picture of Belle from Beauty and the Beast instead of the normal portrait.

Link to comment
5 minutes ago, Alaratt said:

DWF = Dark World Fantasy

 

I am not an expert but basically most of the modded portraits here are attached to a trait. When you assign that trait to a character it places the picture over the original portrait. 

So for example if you were using the fairy tales module for DWF and added the trait dwf_npc_belle to a npc it would show a picture of Belle from Beauty and the Beast instead of the normal portrait.

Ahh very interesting. I havent looked into the DWF mod yet. Thanks a lot.

So I just need to set up a new trait (that is not applied randomly to other characters) and define this trait in the clause. THANKS ?

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