Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

14 minutes ago, Darsel said:

Hmm.. that seems a bit more messy than I was hoping for.

Yes, it is. Vanilla CK2 just doesn't handle same-sex marriage very well.

It's assumed that whoever gets the impregnate effect is the "female" of the union, but I've seen some wonky things happen.

Link to comment
53 minutes ago, lockeslylcrit said:

Yes, it is. Vanilla CK2 just doesn't handle same-sex marriage very well.

It's assumed that whoever gets the impregnate effect is the "female" of the union, but I've seen some wonky things happen.

Indeed. I want to avoid bloating character data with flags as much as possible because I'm working on a submod, but this might be a situation where it is required.

 

As a somewhat specific side-inquiry: I've noticed that you and Dew script trait/racial assignments through an on_birth/adult triggered event using flags instead of using inheritance/potential within the traits themselves. I'm curious if there is an undocumented reason to avoid using the latter method. I'm messing around with some content game rules and trying to figure out how I should set up the logic for traits involving said content.

 

Edit: Bluntly, I'm implementing a Futa trait and wondering if its inadvisable to set up inheritance and game rule conditions within the trait itself.

Link to comment

I imagine this has been answered ad nauseum but if I have LF, DWR, and ToNT for example, how do I make LF take priority? If I disable DWR then ToNT's portraits seem to take priority even though it has LF listed as a dependency. Tried skimming through the recent support threads but cant seem to find anything other than 9 million compatibility questions.

 

Also, the vanilla opinion modifier cuckold:

 

opinion_cuckolded = {
    opinion = -100
    months = 120
    prison_reason = yes
    revoke_reason = yes
    execute_reason = yes
    divorce_reason = yes
    crime = yes
}

 

Do the ai ever actually use these on players? As in to point click execute/imprison? I dont think I've ever been imprisoned outside of dinner and battle events and I've never been executed by the ai. Can someone point me to the decisions txt that handles the imprison and execute targeted decisions?

 

Link to comment
5 hours ago, rookie189 said:

I imagine this has been answered ad nauseum but if I have LF, DWR, and ToNT for example, how do I make LF take priority? If I disable DWR then ToNT's portraits seem to take priority even though it has LF listed as a dependency. Tried skimming through the recent support threads but cant seem to find anything other than 9 million compatibility questions.

Edit the .mod file for dependencies. The order of mod loading goes:

Vanilla -> Mods by alphabetical order -> Mods with a dependency set

Think of it like Skyrim or Fallout modding; any mods with dependencies will be loaded after their dependencies in the load order, thus overwriting whatever conflicting code is in the previous mod.

 

6 hours ago, rookie189 said:

Do the ai ever actually use these on players? As in to point click execute/imprison? I dont think I've ever been imprisoned outside of dinner and battle events and I've never been executed by the ai. Can someone point me to the decisions txt that handles the imprison and execute targeted decisions?

Presumably yes, if you are a direct vassal of the liege.

Link to comment
7 hours ago, Darsel said:

I've noticed that you and Dew script trait/racial assignments through an on_birth/adult triggered event using flags instead of using inheritance/potential within the traits themselves.

Better half-breed (Demon/Half-demon) or mixed race (Demon/Divine) assignment.

Link to comment

That makes sense. And, in hindsight, I imagine routing through on_birth is probably better for performance instead of checking through each trait every time.

 

 

Edit:

For some reason:

third_party_potential = {						# Third Party Conditions
	any_spouse = { character = ROOT }					# Third Party is married to the Target
}

Isn't scoping the target's spouse. I've tried multiple variations, and I'm just not having luck with it. I've narrowed it down to this one line though trial and error, but don't understand why it's not working.

Link to comment
4 hours ago, Darsel said:

That makes sense. And, in hindsight, I imagine routing through on_birth is probably better for performance instead of checking through each trait every time.

 

 

Edit:

For some reason:


third_party_potential = {						# Third Party Conditions
	any_spouse = { character = ROOT }					# Third Party is married to the Target
}

Isn't scoping the target's spouse. I've tried multiple variations, and I'm just not having luck with it. I've narrowed it down to this one line though trial and error, but don't understand why it's not working.

Literally just spitballing, have you tried  PREV instead of ROOT? spend no more than 60 seconds testing that, im just guessing.

Link to comment
19 hours ago, Darsel said:

filter = vassals
potential = {
	#check for landed title and other conditions
}
third_party_filter = all
third_party_potential = {
	any_spouse = { character = ROOT }			# Select Character who is married to the Target
	#additional conditions
}
allow {
	#blah blah
}
effect = {
	#ignoring gender/trait logic for the sake of simplicity
	ROOT = { save_event_target_as = ModVarDad }		# Target is the potential Father
	FROMFROM = { save_event_target_as = ModVarMom }		# Third Party is the potential Mother

	narrative_event { id = ModEventNameForSale.0 }		# Trigger Event
}

 

 

Add in

 

third_party = ROOT

This will force the third_party_filter to be based off of ROOT (your vassal) instead of FROM (you). Then change

third_party_filter = spouse

This will reduce the CPU load by only filtering the vassal's spouse. Then change your third_party_potential

		third_party_potential = {
			FROMFROM = {
				# Conditions go here. Since you've already defined the spouse, that part isn't needed
			}
		}

FROMFROM (the vassal's spouse) needs to be used. Same with third_party_allow, if you need to use that.

Link to comment
31 minutes ago, dwjlien said:

Literally just spitballing, have you tried  PREV instead of ROOT? spend no more than 60 seconds testing that, im just guessing.

No dice. I've even tried with assigning third_party to both ROOT and PREV as well, just to be thorough.

 

I do have an alternative approach in mind I could try, but it might let undesirable outcomes slip through(like letting the vassal attempt to impregnate a dragon/undead/etc. if they happen to be married to one somehow). The primary thing I need is to be able to evaluate the eligibility of a vassal's spouse before determining whether the decision is available to the player or not.

 

 

12 minutes ago, lockeslylcrit said:

third_party_filter = spouse

This will reduce the CPU load by only filtering the vassal's spouse. Then change your third_party_potential


		third_party_potential = {
			FROMFROM = {
				# Conditions go here. Since you've already defined the spouse, that part isn't needed
			}
		}

FROMFROM (the vassal's spouse) needs to be used. Same with third_party_allow, if you need to use that.

 

Jackpot! Turning it around did the trick. Thank you; my sanity appreciates the help!

Link to comment
21 minutes ago, kioo said:

Can I somehow made character portrait change when he is over midage?

 

I tried putting this in allow_propery_values but it doesn't seem to work:


5 = {
           0 = { always = no }
           1 = { portrait_has_trait = my_custom_portrait_trait }
           2 = { portrait_age > midage }
}

In my *.dds file I have a blank 0 slot, a young portrait on the next one, and old portrait after it.

Those are standard conditions. The only difference is that they are scoped to the portrait, not the character.

 

Try this:

 

5 = {
	0 = { always = no }
	1 = { 
		portrait_has_trait = my_custom_portrait_trait 
		portrait_age < midage
	}
	2 = { 
		portrait_has_trait = my_custom_portrait_trait
		portrait_age > midage 
	}
}

 

Link to comment
7 hours ago, lockeslylcrit said:

Try this:

Thank you! This worked like a charm. Really appreciate it you helping here!

8 hours ago, kioo said:

I have the following hidden trait but there is still a spacing (where the hidden trait should be) in the character traits row.

Hmm, it seems this only happens with create_character = { trait = my_hidden_trait } but everything is fine when used with new_character = { add_trait = my_hidden_trait }

Link to comment
1 hour ago, kioo said:

Hmm, it seems this only happens with create_character = { trait = my_hidden_trait } but everything is fine when used with new_character = { add_trait = my_hidden_trait }

Check to see you're not in observe mode. When in doubt, define the trait's image in the interface file. It will still be hidden unless you're in observe mode.

Link to comment

First up, I just have to say it's a truly magically experience to build a (futa) trait; set up all the nuanced logic; set yourself to observe; then bring up the people list and watch as it slowly populates and spreads as the world flashes by at max speed. I was not expecting an emotional reaction at seeing it.. come to life.. like that.

 

 

Ahem, anyways, I have a potentially not-quick question regarding the handling and syntax of Functions/Macros/Matrices:

 I'm looking to build a 'function' that returns a parameter value. Specifically, I want to build a library of image references, and return an image based on the race and gender of the target during an event. (Ultimately, the goal is to expand the system to provide random variety for both images and localisation keys.)

 

pseudo-code example:

event = {
	#id, text, etc.
	picture = GetPicProfile
}


#####################


GetPicProfile = {
	Case1 = { 
		#conditions
		Return = GFXProfileHumanMale001
	}
	Case23 = {
		#conditions
		Return = GFXProfileOrcFemale003
	}
	#etc.
}

Is something like that possible?

 

Link to comment
1 hour ago, Darsel said:

 I'm looking to build a 'function' that returns a parameter value. Specifically, I want to build a library of image references, and return an image based on the race and gender of the target during an event. (Ultimately, the goal is to expand the system to provide random variety for both images and localisation keys.)

picture = {
	trigger = {
		trait = lf_elf
		is_female = no
	}
	picture = elf_male_picture
}
picture = {
	trigger = {
		trait = lf_elf
		is_female = yes
	}
	picture = elf_female_picture
}
#continue as many times as you need

desc = {
	trigger = {
		trait = lf_elf
		is_female = no
	}
	text = elf_male_text
}
desc = {
	trigger = {
		trait = lf_elf
		is_female = yes
	}
	text = elf_female_text
}
#continue as many times as you need

When there are multiple picture or desc blocks, the game will pick one at random if more than one meet the conditions. You can use multiple picture/desc blocks to have exactly the picture/desc you want using tight conditions, or have a random selection with very loose conditions.

Link to comment

Okay, good tips there. From what I've been able to research, I presume the syntax for calling/defining a 'function' like this is a "Scripted Effect"? (Called by assigning it a value of "yes")

 

Thank you for taking the time to assist me with all this.. teething.

Link to comment
4 hours ago, Darsel said:

Okay, good tips there. From what I've been able to research, I presume the syntax for calling/defining a 'function' like this is a "Scripted Effect"? (Called by assigning it a value of "yes")

 

Thank you for taking the time to assist me with all this.. teething.

You cant turn base event code into a scripted effect. You can use scripted triggers in the conditions, but picture/desc is required for events.

Link to comment

Can the ai target a specifically non ai sibling like this? If so would this monstrosity of a decision work as is?

 

 

 


 

    dragon_ravish_2 = {
        is_high_prio = yes
        potential = {
            trait = dwse_dragon_adult
            is_adult = yes
            is_female = no
            prisoner = no
            mother = {
                is_alive = no
            }
        }
        allow = {
            NOT = {
                has_character_modifier = dragon_satisfied
            }
            any_sibling = {
                ai = no
                is_female = yes
                is_alive = yes
                prisoner = no
                is_pregnant = no
            }
        }
        effect = {
            any_sibling = {
                limit = {
                    ai = no
                    is_female = yes
                    is_alive = yes
                    prisoner = no
                    is_pregnant = no
                }
                set_character_flag = dragon_sexy_times
                narrative_event = { id = dwseom.1000 }
            }
        }
        ai_will_do = {
            factor = 1 
        }
    }

 
 

 

 

Link to comment
8 minutes ago, rookie189 said:

Can the ai target a specifically non ai sibling like this? If so would this monstrosity of a decision work as is?

Yes, it will.

 

Caveat: There's a hardcoded restriction in CK2 that unlanded/untitled/unimportant courtiers will never do decisions. They are essentially set pieces. If you want them to do decisions, land them, or make the decision into an on_action event.

Link to comment
7 hours ago, lockeslylcrit said:

You cant turn base event code into a scripted effect. You can use scripted triggers in the conditions, but picture/desc is required for events.

Drat. I guess I'm back to the drawing board. Do you know of any other ways to create a reusable index of images that can be referenced by multiple events? Having to build up the same logic path inside each event just seems terribly cumbersome and an excessive workload for future expansion and maintenance.

 

Is there really no way to return an explicit value from a function/macro? (I don't know the proper syntax, but maybe storing an image name/id as a string variable somehow?)

 

Link to comment
3 hours ago, Darsel said:

Drat. I guess I'm back to the drawing board. Do you know of any other ways to create a reusable index of images that can be referenced by multiple events? Having to build up the same logic path inside each event just seems terribly cumbersome and an excessive workload for future expansion and maintenance.

 

Is there really no way to return an explicit value from a function/macro? (I don't know the proper syntax, but maybe storing an image name/id as a string variable somehow?)

 

Nope. That's just the way CK2 is. The scripting language isn't very powerful.

Link to comment

Might already be answered but is there anyway to keep track of a floating value linked to a character? And if yes, how would one do this?

 

I saw dark world use stage 1, stage 2-...stage 6 for werewolves as a character modifier .. but this isn't ideal

 

I was hoping to have at least a value that can range from 0 to 20, preferably without a cap even.

 

 

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