CK2 Modding Quick Question Thread

From Lovers Lab All Activity


The problem with your code is you’re trying to assign a localization key to a variable. Variables can only store floating point numbers (and anyway, I don’t think it’s possible to reference loc keys in code like that).

This should be a simple fix to your problem:

text = {
trigger = {
NOT = { num_of_lovers = 1 }
}
localisation_key = None
}
text = {
localisation_key = [This.Lover.GetFullName]
}

There are a few problems with your event:

There is no trigger defined, which is likely why the event isn’t firing.

The event fires for every province every month. You should add a condition in the trigger that the province is the province you want.

If this is a one-time event for a character to spawn in a specific province, a far less CPU-intensive way to trigger this event is using an on_action such as on_startup:

on_yearly_pulse = {
events = {
# […]
HF.49100 # Check if to start Northern Crusade
# […]
}
# […]
}

If you want it to only trigger a few months/years into the game, you can make a dummy event to trigger it the way Paradox did it, like so:

# Setting up Northern Crusade – 1
province_event = {
id = HF.49102
hide_window = yes
is_triggered_only = yes

immediate = {
if = {
limit = {
has_global_flag = qa_testing
}
333 = {
province_event = { id = HF.49103 days = 1 }
}
}
else = {
333 = {
province_event = { id = HF.49103 days = 1825 random = 1825 }
}
}
}
}

Note that on_yearly_pulse fires from character scope, so your dummy event would have to be a character_event.
EDIT: And yeah, make sure your namespace is properly defined.



Original URL: https://www.loverslab.com/topic/73788-ck2-modding-quick-question-thread/?do=findComment&comment=2663539

Leave a Reply