Jump to content

CK2 Modding Quick Question Thread


Recommended Posts

1 minute ago, dwjlien said:

I gotchya, I just never seen scripted triggers before, they're like common events in RPGMaker n the like, you can call repeatedly from elsewhere. WIsh id known earlier is what i meant by of fuckity!

scripted_triggers and scripted_effects are pretty vital to copy-pasting long sections of conditions or effects that are used multiple times without shitting up event/decisions

 

To call on them, just use <scripted_trigger/effect name> = yes

Link to comment

Usually when you go berserk you also become wroth, and if you were patient you simply lose that virtue. Would it possible to set it up so that if you were already wroth before becoming a berserker, you gain the patient trait in the aftermath because you've gone full circle and reached tranquil fury?

Link to comment
5 hours ago, AlexWyrmin said:

Usually when you go berserk you also become wroth, and if you were patient you simply lose that virtue. Would it possible to set it up so that if you were already wroth before becoming a berserker, you gain the patient trait in the aftermath because you've gone full circle and reached tranquil fury?

Not without editing the vanilla patient trait or the event that removes patient when you are a berserker.

 

35 minutes ago, rutars said:

I'm starting to suspect that taking concubines is a hardcoded interaction.

Your suspicions are correct.

Link to comment
1 hour ago, dwjlien said:

Very quick question about on actions - Death



on_death = {
	events = {
		IST.0013
	}
}

That runs ONLY when the player character dies, not for every damn character right? (and I guess if not, most lightweight way to make it behave so?)

EVERY character that dies.

Set your event's pre-triggers to reduce the CPU load. In this case, having a pre-trigger of ai = no will prevent the event from even being considered if it's not the player.

Note that pre-triggers are different from triggers. Pre-triggers are viewed only when the events are loaded on a new game or loading up a saved game. If the conditions aren't met, the game will just bypass the event completely. Triggers are viewed whenever the event is called. If a pre-trigger isn't set but a trigger is, then the game will look through that event's code every time it's called. Pre-triggers are extremely vital to reducing CPU usage, but are fairly limiting.

Link to comment

I'm with you (I think lol) cheers, so the above on-action calls IST.0013, so


character_event = {  id = IST.0013	## - CALLED ON DEATH, character stats to Dynasty
	ai = no
	is_triggered_only = yes   portrait = yes
	hide_window = yes
	Immediate = { 
		STUFF
	}
}

If event 13 is set up like so, I am hunky dory?

EDIT - this WAS how I've had event 13 set, -hence me assuming 'on death' only worked on player as I'd been running it 'correctly' like this as a happy accident, but lead me to being misinformed about the on action.

 

Just to go back on scripted effects...  I cant believe I missed them, I have so much copy/paste repeated blocks.  I could have really cleaned up my code If knew, I even asked reddit when i first started if there were "common events" for coding in the clausewitz engine, got told NO and never checked again. Damn. Should have come to you first! ❤️

Link to comment

I am attempting to create an event chain, however I am having issues. I may not be doing this right, but here is how I have linked one event to another through options:

option = {
		name = EVTOPTAtestchain01
		character_event = { #to next event
			id = testchain02
			days = 1
		}
	}

I load the event in-game and there are two thing wrong:

  1. The text for the 1st event uses the text for the 2nd event. Must be something that has to do with either the code or the localisation file, but I am not really sure. 
  2. The event does not fire when it is supposed to.

Here is how I have the next event set up:

character_event = {
	id = testevent02
	desc = EVTDESCtestevent02
	picture = gardens
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAtestevent02
	}
}

I know that I am doing something very wrong, but I'm not sure what...

Link to comment
1 hour ago, manicpixxxie said:

I am attempting to create an event chain, however I am having issues. I may not be doing this right, but here is how I have linked one event to another through options:


option = {
		name = EVTOPTAtestchain01
		character_event = { #to next event
			id = testchain02
			days = 1
		}
	}

I load the event in-game and there are two thing wrong:

  1. The text for the 1st event uses the text for the 2nd event. Must be something that has to do with either the code or the localisation file, but I am not really sure. 
  2. The event does not fire when it is supposed to.

Here is how I have the next event set up:


character_event = {
	id = testevent02
	desc = EVTDESCtestevent02
	picture = gardens
	border = GFX_event_normal_frame_economy
	
	is_triggered_only = yes
	
	option = {
		name = EVTOPTAtestevent02
	}
}

I know that I am doing something very wrong, but I'm not sure what...

 

Event IDs need to be either in a completely numerical form (id = 889983) or in namespace form (id = testevent.02)

Namespaces require the namespace name, then a period, and finally the event id number.

 

Assign namespace = testevent at the top of the event file, then replace id = testevent02 with id = testevent.02 in both the event and the option.

 

 

An example of a proper namespaced event file:

 

namespace = LFCore

character_event = {
	id = LFCore.1
	is_triggered_only = yes
	hide_window = yes
	immediate = {
		# blah blah blah
	}
}

character_event = {
	id = LFCore.2
	is_triggered_only = yes
	hide_window = yes
	immediate = {
		# blah blah blah
	}
}

 

Link to comment

Wow, I... did not know that. Thank you! That explains why half of my events have been not working...

 

Also, I made an event which contains an option that has a small chance for another event to trigger, but I am not sure how to go about it. I tried attatching a modifier to the option with the event, and even a weight multiplier to the event itself but no luck, though.

Link to comment
23 minutes ago, manicpixxxie said:

Wow, I... did not know that. Thank you! That explains why half of my events have been not working...

 

Also, I made an event which contains an option that has a small chance for another event to trigger, but I am not sure how to go about it. I tried attatching a modifier to the option with the event, and even a weight multiplier to the event itself but no luck, though.

You've got three options:

 

 
 
 
 
Spoiler

option = {
	name = blahblahname1
	hidden_tooltip = { # Otherwise it will say "10% chance of Nothing"
		random = { # Single result, 10% chance
			chance = 10
			character_event = { id = blahblahrandom.1 }
		}
	}
}

option = {
	name = blahblahname2
	hidden_tooltip = { # Same as above, to prevent dumb tooltips with commands that have no localisation
		random_list = { # Multiple results
			10 = { # 10% chance
				character_event = { id = blahblahrandom.1 }
			}
			90 = { # 90% chance
				# Something else
			}
		}
	}
}

option = {
	name = blahblahname3
	custom_tooltip = { # If you want to give a custom tooltip instead of hiding it
		text = blahblahnametooltip # Your tooltip localisation
		random_list = { # Multiple results
			10 = { # 10% chance
				modifier = { #  Multiplier
					factor = 2 # Multiplies the 10 by 2 if Lustful, making it an 18.1818~% chance using the formula below
						# x = y / ( z ) with y being the modified number and z being the grand total of all numbers in the random_list after modifiers
					trait = lustful
				}
				character_event = { id = blahblahrandom.1 }
			}
			90 = { # 90% chance
				additive_modifier = { # Addition
					value = 10 # Adds 10 value to the 90 if Chaste, making it a 90.9090~% chance using the formula above
					trait = chaste
				}
				# Something else
			}
		}
	}
}

 

 

Link to comment

I am very confused about this tool tip.

https://imgur.com/a/8jh6O8m

 

Red X's to me indicate FAIL, but they work! The option isn't available unless they're true, yet they're red :S So just to reiterate the option/code works/performs what I want, just the tool-tip says the checks fail. Any ideas?

 

Targeted Decision on the spouse:

 


		allow = { 
			Root = { is_vassal_or_below_of = From
				any_child = {
						is_heir = from }
				}
			FROM = { 
				any_child = { 
						is_heir =  yes
					And = {
						is_alive = yes
						is_adult = yes
						is_female = no
					}
				}
			}
		}

EDIT. I still dont understand how the tooltip shows false and yet works, but I remastered the code to look at it differently and the below does the same job, but the scopes align so that the game is happy and the tooltip looks correct.

Spoiler


		allow = {
			FROM = { 
				And = {
					current_heir = {
						is_child_of =  prev
						is_child_of =  root
						is_alive = yes
						is_adult = yes
						is_female = no
					}
				}
			} 
		}

 

 

Link to comment

Is there any way to get the game to give your starting character the ducats they'd have legitimately earned as taxes before you took control of them or do I just write an "add_cash" in their personal history, followed by the basic amount each of the counties they owned earned them each month multiplied by how many months they've been reigning before you started a new game?

Link to comment

They legitimately  earned them, but they also legitimately  spent them.  ?

 

EDIT: Didn't want to derail this topic with another frivolous reply, so editing this one @AlexWyrmin

 

Quote

That could be true... if your character was anyone but a tribal ruler in 769 CE. Otherwise you'd have either slightly better developed provinces or higher local revolt risk, due to frivolous spending, on startup.

 

If the realm is that under-developed then the gold was miss managed, dropped in a bug, degraded from weather, or spent to pacify and improve revolt risk. Or if the realm is 'bad' you wouldnt have earned much anyhoo above everyday running costs.

Link to comment
39 minutes ago, dwjlien said:

They legitimately  earned them, but they also legitimately  spent them.  ?

 

That could be true... if your character was anyone but a tribal ruler in 769 CE. Otherwise you'd have either slightly better developed provinces or higher local revolt risk, due to frivolous spending, on startup.

Link to comment
22 hours ago, lockeslylcrit said:

You've got three options:

 

Spoiler
 
 
 
 
  Reveal hidden contents


option = {
	name = blahblahname1
	hidden_tooltip = { # Otherwise it will say "10% chance of Nothing"
		random = { # Single result, 10% chance
			chance = 10
			character_event = { id = blahblahrandom.1 }
		}
	}
}

option = {
	name = blahblahname2
	hidden_tooltip = { # Same as above, to prevent dumb tooltips with commands that have no localisation
		random_list = { # Multiple results
			10 = { # 10% chance
				character_event = { id = blahblahrandom.1 }
			}
			90 = { # 90% chance
				# Something else
			}
		}
	}
}

option = {
	name = blahblahname3
	custom_tooltip = { # If you want to give a custom tooltip instead of hiding it
		text = blahblahnametooltip # Your tooltip localisation
		random_list = { # Multiple results
			10 = { # 10% chance
				modifier = { #  Multiplier
					factor = 2 # Multiplies the 10 by 2 if Lustful, making it an 18.1818~% chance using the formula below
						# x = y / ( z ) with y being the modified number and z being the grand total of all numbers in the random_list after modifiers
					trait = lustful
				}
				character_event = { id = blahblahrandom.1 }
			}
			90 = { # 90% chance
				additive_modifier = { # Addition
					value = 10 # Adds 10 value to the 90 if Chaste, making it a 90.9090~% chance using the formula above
					trait = chaste
				}
				# Something else
			}
		}
	}
}

 

 

Thank you so much!

What if I want to get a courtier's portrait to show up in an event? I have been looking around in the game's code but I am not exactly sure what allows it. 

Link to comment
1 hour ago, dwjlien said:

If the realm is that under-developed then the gold was miss managed, dropped in a bug, degraded from weather, or spent to pacify and improve revolt risk. Or if the realm is 'bad' you wouldnt have earned much anyhoo above everyday running costs.

I think you're right about that. I just don't understand how a one province tribal count can get spawned with 40ish ducats in his pockets whereas a duke with the same government type has only 60ish. If one tribal county has a starting value of 40, a ruler owning more should have that much multiplied by the number of counties owned.

Link to comment
21 minutes ago, AlexWyrmin said:

I think you're right about that. I just don't understand how a one province tribal count can get spawned with 40ish ducats in his pockets whereas a duke with the same government type has only 60ish. If one tribal county has a starting value of 40, a ruler owning more should have that much multiplied by the number of counties owned.

 

Not necessarily true. You/Your "tax collector"   can collect 40 gold profit from JUST one county = 40 tax revenue

Now you have  3 counties (120) but still can only mange to collect from 1, so you must pay someone (3 gold) per county to do the job in the other 2 for you plus guards (7 gold) 3+7 =10 x 2 counties = 20. 80 tax -20 = 60. So you only earn 40+60 tax (100) as opposed to 120 (3 x 40).

Additionally when you ruled 1 county it was easy, now with 3 you're spread thin, so have to pay more money out for feasts to keep people happy, or dudes to do something in your absence coz you're currently busy in your other county. Plus in 1 county your infrastructure only needed to be a small "circle" to service your people, but now it needs to be 3 small circles AND cover the ground to connect those circles.

 

Basically what my head cannon is arguing is that costs are not a straight 3:1 ratio, and having it like the game does it keeps things balanced from a gameplay perspective.

Link to comment
3 minutes ago, dwjlien said:

Basically what my head cannon is arguing is that costs are not a straight 3:1 ratio, and having it like the game does it keeps things balanced from a gameplay perspective.

So that's how it is. Then "suiciding", via character history editing, the two vassals of mine who've got no heirs to speak of, and the worse track record at being useful on spawning, is still the way to go to get more cash on the starting date. Bribing people to plot against the vassals I just subjugated, and don't want on the council because they're as useless as the two previous sacrificial lambs, costs more than the actual war of subjugation.

Link to comment
1 hour ago, manicpixxxie said:

Thank you so much!

What if I want to get a courtier's portrait to show up in an event? I have been looking around in the game's code but I am not exactly sure what allows it. 

Use portrait = <character/offmap/title>

If you use offmap (portrait = offmap_irae) then it will show the portrait of the governor.

 

Here's an example of an event with a portrait:

 

letter_event = {
	id = HouseIraeTamsine.1061
    border = GFX_event_letter_frame_diplomacy
	desc = HouseIraeTamsine1061Other
	portrait = event_target:houseirae_kekvit_irae # Gives the portrait of the offmap ruler.
	is_triggered_only = yes
	option = {
		#blahblahblah
	}
}

Standard boolean operators (FROM, ROOT, PREV, etc) also work.

Link to comment
6 hours ago, AlexWyrmin said:

Is there any way to get the game to give your starting character the ducats they'd have legitimately earned as taxes before you took control of them or do I just write an "add_cash" in their personal history, followed by the basic amount each of the counties they owned earned them each month multiplied by how many months they've been reigning before you started a new game?

 

Create the character as a history file (/history/characters/)

 

769.1.1 = {
	effect = {
		weath = 500
	}
}

 

Replace the date with whatever date you want, and the wealth with whatever money you want the character to start with.

Then you need to do some mental math with the year = condition in an on_startup event to determine how much to increase or decrease this amount.

Link to comment
22 minutes ago, AlexWyrmin said:

Thank you again @lockeslylcrit. By the way, that trick with the character stats I tried to leave only my useful vassals alive doesn't work, even after correcting the syntax. so I think either it just plain doesn't or there's something missing.

I looked over the code again and realized death = yes is a history command, not an effect. My bad.

 

769.1.1 = {
	effect = {
		set_character_flag = check_for_stats
	}
}

#
# Put the below in your events file and link from on_startup in your on_actions file
#

namespace = checkfordeath
character_event = {
	id = checkfordeath.1
	hide_window = yes
	is_triggered_only = yes
	trigger = {
		has_character_flag = check_for_stats
		is_save_game = no # Only on new games
	}
	immediate = {
		if = {
			limit = {
				NOR = {
					diplomacy = 15
					martial = 15
					stewardship = 15
					intrigue = 15
					learning = 15
				}
			}
			death = {  # Silent removal, no notifications or sounds
				death_reason = death_missing
			}
			break = yes 
		}
		#
		# If at least one stat is 15 or more, assigns special council/commander flag for each
		#
		if = {
			limit = {
				diplomacy = 15
			}
			clr_character_flag = check_for_stats
			set_character_flag = special_chancellor
		}
		if = {
			limit = {
				martial = 15
			}
			clr_character_flag = check_for_stats
			set_character_flag = special_marshal
		}
		if = {
			limit = {
				intrigue = 15
			}
			clr_character_flag = check_for_stats
			set_character_flag = special_spymaster
		}
		if = {
			limit = {
				stewardship = 15
			}
			clr_character_flag = check_for_stats
			set_character_flag = special_treasurer
		}
		if = {
			limit = {
				learning = 15
			}
			clr_character_flag = check_for_stats
			set_character_flag = special_spiritual
		}
	}
}

 

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