• 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.

Ser Tristesse

Private
16 Badges
Nov 26, 2016
10
0
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
I've been trying create my first event, and it's probably too ambitious or complex for me.

Basically, what I've been trying to do is to have my character and a specific character in my court to have a son that will have the Immortal trait. This character will propose the player such plan and he obviously will be able to refuse, but otherwise the ritual will be made. I've tried modifying the birth_events.txt file as it more or less would begin like that, but I couldn't find a way to target the specific character, and many other problems appeared which made me scrap the whole thing and eventually post here.

If anyone knows how to make such event, I'd be grateful.

EDIT: Progress has been made and it's stated on my answer below. I've managed to target the specific character by adding a character flag.
 
Last edited:

Maal

Society Master
115 Badges
Nov 10, 2013
691
81
  • Rome: Vae Victis
  • Knights of Pen and Paper +1 Edition
  • Magicka
  • Majesty 2 Collection
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Stellaris: Galaxy Edition
  • Stellaris
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • King Arthur II
  • Warlock: Master of the Arcane
  • Warlock 2: The Exiled
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines Deluxe Edition
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Pre-order
  • Knights of Pen and Paper 2
  • Crusader Kings II: Monks and Mystics
  • Magicka 2
  • Crusader Kings II: Reapers Due
  • Cities: Skylines - After Dark
  • Europa Universalis III: Chronicles
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis III
  • Ancient Space
  • Divine Wind
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Heir to the Throne
Make an hidden event that first target your character, in that event IMMEDIATE bracket, add:

random_courtier = {
limit = {
whatever limiting factor you want
}
character_event = { id = YOUR.EVENT }
}


This will pick a random courtier in your court and give him an event. AI don't really need to see events, so you can make it hidden too to avoid picking a picture and writing a description for nothing.
To make this AI target you back while in the event you sent him:

FROM = { character_event = { id = EVENT.HERE } }

FROM mean who the courtier received the current event, which is your character, so "FROM" (you) will get the next character_event. And once your character is in that event, just use FROM again to target who sent it, the courtier.
 

LordPeter

Marjoram
49 Badges
Mar 5, 2012
2.249
382
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Conclave
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Stellaris
  • Europa Universalis IV: Third Rome
  • Cities: Skylines
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Cradle of Civilization
Frankly I think that is still too complicated an explanation Maal ^^
I strongly recommend reading through the event modding wiki page a bit, to understand the basics.
Then make a mod, and then follow the suggestions Maal put above. Do not modify vanilal files directly! It'll only give you lots of problems later on.
It's also usually helpful to search vanilla files, like you already did.
If you then have any specific questions (for example you should probably set a flag on the pregnant character, or keep them as an event target depending on what you want), come back and ask again :)
 

Ser Tristesse

Private
16 Badges
Nov 26, 2016
10
0
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
A
Make an hidden event that first target your character, in that event IMMEDIATE bracket, add:

random_courtier = {
limit = {
whatever limiting factor you want
}
character_event = { id = YOUR.EVENT }
}


This will pick a random courtier in your court and give him an event. AI don't really need to see events, so you can make it hidden too to avoid picking a picture and writing a description for nothing.
To make this AI target you back while in the event you sent him:

FROM = { character_event = { id = EVENT.HERE } }

FROM mean who the courtier received the current event, which is your character, so "FROM" (you) will get the next character_event. And once your character is in that event, just use FROM again to target who sent it, the courtier.
Done. I also added a flag where her character is defined and it shows up in charinfo, so that works at least. However, when I test the event, it seems like the trigger conditions are all omitted now (they don't show up in the debug console) and the event skips the whole chain and triggers the last one.

This is what the first event looks like:
# Hidden start
namespace = IMMORTALCHILD
character_event = {
id = IMMORTALCHILD.0001

hide_window = yes

only_playable = yes
only_capable = yes
min_age = 16
max_age = 65

trigger = {
is_pregnant = no

OR = {
NOT = { age = 65 }
}

NOR = {
trait = infirm
trait = celibate
trait = eunuch
trait = in_hiding
trait = disfigured
}
}

immediate = {

random_courtier = {
limit = {
has_character_flag = immortal_ritual_flag
is_pregnant = no
prisoner = no
NOR = {
trait = incapable
trait = infirm
trait = celibate
trait = eunuch
trait = chaste
trait = in_hiding
trait = disfigured
}
}
character_event = { id = IMMORTALCHILD.0002 }
}
}
}

I can post the whole chain if need be.

Frankly I think that is still too complicated an explanation Maal ^^
I strongly recommend reading through the event modding wiki page a bit, to understand the basics.
Then make a mod, and then follow the suggestions Maal put above. Do not modify vanilal files directly! It'll only give you lots of problems later on.
It's also usually helpful to search vanilla files, like you already did.
If you then have any specific questions (for example you should probably set a flag on the pregnant character, or keep them as an event target depending on what you want), come back and ask again :)
Indeed, I took a look at the event modding wiki page, and don't worry I'm adding these things to my own mod so no vanilla files are being modified. Flags and event targets seem like will become necessary pretty soon, so thank you for your reply.

EDIT: I've added in the namespace and now it detects the trigger parameters again and is able to be fired. Will post further developments.
 
Last edited:

LordPeter

Marjoram
49 Badges
Mar 5, 2012
2.249
382
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Conclave
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Stellaris
  • Europa Universalis IV: Third Rome
  • Cities: Skylines
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Cradle of Civilization
Well good luck then.
Also but this is more of a forum than a modding thing: If your code gets longer, you should use
Code:
code = {
    to post it, because that is more conventient and keeps
    indents
}
:)
 

Ser Tristesse

Private
16 Badges
Nov 26, 2016
10
0
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Holy Fury
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: Charlemagne
Yeah, now I'm not sure how to go on from there. She does get pregnant and eventually the child is born, but I'm not sure on how to give him the immortal trait, and if possible make him always male.
 

LordPeter

Marjoram
49 Badges
Mar 5, 2012
2.249
382
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings II: Conclave
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Prison Architect
  • Stellaris - Path to Destruction bundle
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris: Synthetic Dawn
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Distant Stars
  • Stellaris: Megacorp
  • Crusader Kings II: Holy Fury
  • Imperator: Rome
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: El Dorado
  • 500k Club
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV
  • Crusader Kings II: Sword of Islam
  • Stellaris
  • Europa Universalis IV: Third Rome
  • Cities: Skylines
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Cradle of Civilization
Yeah, now I'm not sure how to go on from there. She does get pregnant and eventually the child is born, but I'm not sure on how to give him the immortal trait, and if possible make him always male.
Oh yep, gender is determined randomly at birth, so I'm not sure how you could circumvent that...
About giving the baby the immortal trait: I would give set a flag on the mother in the beginning (e.g. "mother_of_unborn_immortal"), and then fire an event from the "on_birth" on_action, checking if the newborn child's mother has that flag, and if yes, give the baby the immortal trait.