• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
You're in the wrong scope for the province, yeah. If you wanted to mess with a province you'd need to go back into province scope with "location". However, if it's a province event that's what your ROOT will be so...Try something like this in your option tags:

Code:
option = {
    name = "EVTOPTA10000001"
    add_province_modifier = library
}

I think that'll work.

EDIT: I'm not familiar with using negatives for MTTH. That might be invalid? How is this event supposed to be triggered?

That's what I tried first, simply having an option that adds a province modifier crashes the game. The trigger should target a province and check for libraries in the baronies, correct? Then the option adds a modifier to the province which was checked for libraries. Somehow the trigger isn't targeting the province like it should.

Having a negative (I've only ever tried -1 days or months) causes the event to fire as soon as the triggers are met.
 
Actually, I just remembered that you can't simply add a modifier like that. You need to use:

Code:
add_province_modifier = {
	name = XXXX
	duration = -1    # sets to never expire, otherwise in days
}

Sorry about that. Tell me if that helps out any.
 
Is it possible to change the frequency a trait is gained in a single culture? Or attibutes?

I want to make greeks have smaller chances of either getting good Martial traits or huge base Martial attribute, to nerf Byzantium. Is it possible? What do I have to edit?
 
Is it possible to edit in a new de jure kingdom into an existing save? In the FAQ sticky, it says this:

You can mod in any title you like. But the de jure structure can't change dynamically once the game has started.

But I'm not sure if the "dynamically" in that context means you can't have de jure kingdoms change their borders of their own accord (at various historical checkpoints), or if, in fact, you cannot change de jure borders at all once a game has begun.
 
Is it possible to change the frequency a trait is gained in a single culture? Or attibutes?

I want to make greeks have smaller chances of either getting good Martial traits or huge base Martial attribute, to nerf Byzantium. Is it possible? What do I have to edit?

The distribution of traits, whether via DNA (congenial), education etc is hard-coded so I doubt you can change the rate at which they get them directly. You can however make an event that fires anytime a byzantine character gets a martial trait and has a chance of either removing it or nerfing it to a lower trait level. Like so

Code:
character_event = {
	id = 100000
	desc = "EVTDESC100000"
	picture = GFX_evt_council
	
	min_age = 16

	trigger = {
		top_liege = { primary_title = { title = e_byzantium } }
	        NOT  = { has_character_flag = martial_tested }
		OR = {
			        trait = misguided_warrior
				trait = tough_soldier
				trait = skilled_tactician
				trait = brilliant_strategist
		}
	}
	
	mean_time_to_happen = {
		months = -1
	}
	immediate = {
		set_character_flag = martial_tested
	}

	option = {
		name = "EVTOPTA100000"
	    hidden_tooltip = { 
            		if = {
			      limit = { trait = misguided_warrior }
		              random = {
			                chance = 50
		                         remove_trait = misguided_warrior
                              }
		     }
            		if = {
			      limit = { trait =  tough_soldier }
		              random = {
			                chance = 50
		                         remove_trait = tough_soldier
                                         add_trait = misguided_warrior
                            }
		     }
            		if = {
			      limit = { trait =  skilled_tactician }
		              random = {
			                chance = 50
		                         remove_trait = skilled_tactician
                                         add_trait = tough_soldier
		                }
                       }
            		if = {
			      limit = { trait =  brilliant_strategist }
		              random = {
			                chance = 50
		                         remove_trait = brilliant_strategist
                                         add_trait = skilled_tactician
		              }
		      }
                }
        }
}

Or something like that. Nuke them traits away.

As for attributes, you could do something similar (trigger: high martial, byzantine effect:lower martial).
 
I've been trying to add events to my game, but I cannot figure out how to do it properly. A lot of trial and error has made me see (some of) the light about triggers, but there's still so much that I'd like to know about.

The best ones to learn from I thought were the religious and hedge_knight ones, but the one I created based on them did not work as well as I thought it would.

Namely, here's the code:

Code:
character_event = {
	id = 95000
	desc = "EVTDESC95000"
	picture = GFX_evt_library

	trigger = {
		year = 1067
		NOT = { year = 1068 }
		religion = catholic
		}	
	
	mean_time_to_happen = {
		months = 9
	}

	option = {
		name = "EVTOPTA95000" #Send him a gift
		ai_chance = {
			factor = 10
			modifier = {
				factor = 0.2
				OR = {
					trait = charitable
					}
				}		
			}
		random = {
			chance = 20
			add_trait = charitable
			}
		prestige = 1
		wealth = -2.5		
		}

	option = {
		name = "EVTOPTB95000" #We will leave behind a great cultural heritage!
		ai_chance = {
			factor = 5
			modifier = {
				factor = 0.7
				OR = {
					trait = proud
				}
			}
		random = {
			chance = 15
			add_trait = proud
			}		
		}
	option = {
		name = "EVTOPTC95000" #I wish I took more of an interest in writings
		ai_chance = {
			factor = 5
			}
		}
}

Now, I expected this to be an event that would happen in 1067 no matter what (I guess there's a different king of mean_time to use for that) but in current test runs it has happened certainly only when the culture is Norman/Frankish/English (five of five) while none of the times as Swedish/Basque (zero of three) which might just be a flaw of probability. :p

Anyways, on the more important parts, I don't understand what's missing from the options B because A works, but B is structured in the exact same way, yet in-game it does not work as a chance for the trait.

Likewise, is there a way to not rely on the mean_time_to_happen but make sure it certainly happens *once* in a year (I tried variations of "date = xxxx.x.x" but that made the computer very unhappy).

Also, is there much point in having the "ai_chance" parts in or not?

Thanks for any help (and bless the person who will write a tutorial on event creation unless I've managed to miss one).
 
Code:
ai_chance = {   # Open AI chance
			factor = 5
			modifier = {
				factor = 0.7
				OR = {
					trait = proud
				} # Close OR
			} # Close Modifier
		random = {   # Open Random - [B]STILL IN AI CHANCE[/B]
			chance = 15
			add_trait = proud
			}		
		}# Close AI chance

That's your problem with B. AI Chance is for determining what computer players select. If you want them to select it more often then you need to multiply the factor by a number > 1.0, or if you don't want them to select it at all you need to multiply it by 0.
 
Likewise, is there a way to not rely on the mean_time_to_happen but make sure it certainly happens *once* in a year (I tried variations of "date = xxxx.x.x" but that made the computer very unhappy).

Also, is there much point in having the "ai_chance" parts in or not?

You can make the MTTH = 6 and probability will tell you that the event will happen once a year in the long term.
You want it not to repeat, so you have to add a flag to the character as
set_character_flag = whateveryouwant
and add in the trigger
NOT = { has_character_flag = whateveryouwant }

event scripting is FUN.
 
Likewise, is there a way to not rely on the mean_time_to_happen but make sure it certainly happens *once* in a year (I tried variations of "date = xxxx.x.x" but that made the computer very unhappy).

Also, is there much point in having the "ai_chance" parts in or not?
I'm not sure exactly what you're aiming for, but you could put the event in the on_yearly_pulse section of the on_actions. Then it would happen for everyone once a year exactly.

If you only want it for particular characters, you can use hidden flags/modifiers in the trigger to accomplish the same thing. For example, the startup event would set a flag and a modifier that will last 365 days. The trigger for your main event is having the flag, but not the modifier, so when the modifier wears off it will fire. Have it reapply the modifier each time it fires, and you've got an event that fires annually. To end the event chain, have an option that removes the flag.
 
Ah, I see, thanks for the quick responses.

Can I just confirm as well what the line would be if I wanted to make it conditional that character can only have a chance of getting 'Proud' if he is not already 'Proud' ?

I would imagine it going alike:

random = {
NOT = { character_trait = proud }
chance = 15
add_trait = proud
}

instead of the random clause I have there, or am I missing a bit out again?

Thanks again, and I do agree with it being fun. :) Just difficult to start if trying to copy-understand already existing ones without much of an explanation in the coding parts.
 
Ah, I see, thanks for the quick responses.

Can I just confirm as well what the line would be if I wanted to make it conditional that character can only have a chance of getting 'Proud' if he is not already 'Proud' ?

I would imagine it going alike:

random = {
NOT = { character_trait = proud }
chance = 15
add_trait = proud
}

instead of the random clause I have there, or am I missing a bit out again?

Thanks again, and I do agree with it being fun. :) Just difficult to start if trying to copy-understand already existing ones without much of an explanation in the coding parts.

Here's the trigger for the event that gives children the proud trait:
Code:
	trigger = {
		NOT = { personality_traits = 5 }
		NOT = { trait = proud }
		NOT = { trait = humble }
		has_guardian = yes
	}
I recommend using the "find in files" function (ctrl+shift+F) in notepad++ to search the existing events and find things similar to what you're looking for. It's really helpful.
 
instead of the random clause I have there, or am I missing a bit out again?

As far as I'm aware, the random clause is an effect and thus needs to be contained in an if block.

Thus you'd need to use:

if = {
limit = { <CONDITIONS HERE> } # in your case, use NOT = { trait = proud }, as long as the character being checked is ROOT
<INSERT EFFECT CODE HERE> # the random block.
}

This will only fire if the conditions in limit are met.
 
Okay, a quickie about traits:

I added a trait to the game to be gained through a decision. I added the trait and it's effects in "trait.txt", I added localization, made a *.dds for the trait and made so that the decision adds the trait.

The weird thing is that once I activate the decision, it adds the trait but the icon for the trait is invisible. In other words: effects of the trait are seen (opinion modifier), but the trait is not present on the character screen.

What am I missing?
 
Did you add its listing to the traits.gfx file?

Brilliant! It works.

Cheers!

I knew it was something trivial...
 
Anybody experimented with upping the court-size fertility limit? I'm wondering if it has any discernible effect on performance.

Could you remind me perhaps where that was again? I keep on looking at defines.lua but can't find it. If it was upped, would that in effect be a way to increase fertility across the board, or would it mostly affect the minor families?

Edit: So defines.txt is where it is, not defines.lua. I'm starting to experiment now...
 
Last edited: