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

Anyasia

Lightbringer
72 Badges
Aug 5, 2015
428
265
  • Europa Universalis IV: Rights of Man
  • Crusader Kings Complete
  • Crusader Kings II
  • Crusader Kings III
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Conclave
A simple question hopefully. When creating a character during an event, I can specify a name for the new person simply by using a line name = "xxxx" however I believe I shall not be able to do this if I want to use special characters like in Sæbjörn. What do I put in my create character block to make it look at a localisation line?
Technically you shouldn't just put a name there if the name itself isn't localized—it doesn't take a string, it takes a localization key, so doing so without the localization will cause it to throw an unlocalized string error. If your name is already in the game, you can reference its localization key in localization/english/names/character_names_l_english.yml; otherwise, you can add your own, and I'd just follow the standard established practices for special character replacement. Based on the existing name 'Snæbjörn,' whose localization key is SnE_bjO_rn, I'd just drop the 'n' and then add your own name in localization:—

Code:
# in create_character
name = SE_bjO_rn

# in localization/english/names/custom_names_l_english.yml
l_english:
SE_bjO_rn:0 "Sæbjörn"

Keep in mind as always that localizations done for English won't carry over to other languages, so if anyone's playing your mod in another language, they'll still see SE_bjO_rn unless you add a localization for their language as well, which will be expected to be in local scripts—'Snæbjörn' in Chinese is rendered as '斯奈比约恩,' for instance; you could probably use something like '赛比约恩' for a variant without the 'n.'
 
Last edited:

Thomas_Oak

Major
8 Badges
May 11, 2018
643
758
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Warlock: Master of the Arcane
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
Many thanks Anyasia. That was very much what I had hoped, but I had been confused by seeing a character called Shlomo Yitzchaki being created and named in the same block in the vanilla files ( learning_theology_events.txt ) and also by the history/characters files where they have the quotation marks around names like:
name = "E_thelrE_d"
 

unmerged(476547)

The Artist Formerly Known As Bobsy
2 Badges
Apr 15, 2012
196
24
  • Crusader Kings II
  • Europa Universalis IV
This script identifies a courtier or guest with a certain trait, and then scopes that same character (it's unlikely there'd be more than one with the same trait). It works fine, but only for the root character's court.

Hooow would I alter it to look in all the courts of characters above the root in the realm hierarchy? Not just their liege, but their liege's liege etc.

Code:
            if = {
                limit = {
                    any_courtier_or_guest = {
                        has_trait = rbancient_oracle_trait
                    }
                }
                random_courtier_or_guest = {
                    limit = {
                        has_trait = rbancient_oracle_trait
                    }
                    save_scope_as = rboracle_char
                }
            }
 

YTnuBF

Captain
65 Badges
Apr 5, 2014
354
181
  • Victoria 2: A House Divided
  • Heir to the Throne
  • Magicka
  • Majesty 2
  • March of the Eagles
  • Cities in Motion 2
  • Victoria: Revolutions
  • Semper Fi
  • Sengoku
  • Sword of the Stars II
  • Europa Universalis IV: Res Publica
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Knights of Honor
  • Crusader Kings II: Sunset Invasion
  • 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
  • Hearts of Iron III: Their Finest Hour
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis IV: Art of War
  • Hearts of Iron III
  • For the Motherland
  • For The Glory
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Divine Wind
  • Europa Universalis III
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings III
  • Victoria 2
  • Europa Universalis IV
  • Crusader Kings II: Conclave
  • Europa Universalis III: Collection
  • Cities: Skylines
  • Crusader Kings II: Reapers Due
  • Stellaris: Digital Anniversary Edition
This script identifies a courtier or guest with a certain trait, and then scopes that same character (it's unlikely there'd be more than one with the same trait). It works fine, but only for the root character's court.

Hooow would I alter it to look in all the courts of characters above the root in the realm hierarchy? Not just their liege, but their liege's liege etc.


Maybe like this ?
Code:
    if = {
        limit = {
            any_liege_or_above = {
                any_courtier_or_guest = {
                    has_trait = rbancient_oracle_trait
                }
            }
        }
        random_liege_or_above = {
            limit = {
                any_courtier_or_guest = {
                    has_trait = rbancient_oracle_trait
                }
            }
            random_courtier_or_guest = {
                limit = {
                    has_trait = rbancient_oracle_trait
                }
                save_scope_as = rboracle_char
            }
        }
    }
 
  • 1
Reactions:

unmerged(476547)

The Artist Formerly Known As Bobsy
2 Badges
Apr 15, 2012
196
24
  • Crusader Kings II
  • Europa Universalis IV
Maybe like this ?
Code:
    if = {
        limit = {
            any_liege_or_above = {
                any_courtier_or_guest = {
                    has_trait = rbancient_oracle_trait
                }
            }
        }
        random_liege_or_above = {
            limit = {
                any_courtier_or_guest = {
                    has_trait = rbancient_oracle_trait
                }
            }
            random_courtier_or_guest = {
                limit = {
                    has_trait = rbancient_oracle_trait
                }
                save_scope_as = rboracle_char
            }
        }
    }
I could have sworn I checked over and over for something approaching any_liege_or_above, and somehow missed it. Thanks for pointing it out! In the end I've gone for this:
Code:
            if = {
                limit = {
                    any_courtier_or_guest = {
                        has_trait = rbancient_oracle_trait
                    }
                }
                random_courtier_or_guest = {
                    limit = {
                        has_trait = rbancient_oracle_trait
                    }
                    save_scope_as = rboracle_char
                }
            }
            else_if = {
                limit = {
                    any_liege_or_above = {
                        any_courtier_or_guest = {
                            has_trait = rbancient_oracle_trait
                        }
                    }
                }
                every_liege_or_above = {
                    random_courtier_or_guest = {
                        limit = {
                            has_trait = rbancient_oracle_trait
                        }
                        save_scope_as = rboracle_char
                    }
                }
            }
            else = {
                create_character = {
                    age = { 25 50 }
                    gender_female_chance = 100
                    dynasty = none
                    trait = education_learning_3
                    trait = zealous
                    trait = rbancient_oracle_trait
                    diplomacy = { 10 14 }
                    martial = 5
                    stewardship = 6
                    intrigue = { 6 8 }
                    learning = { 8 10 }
                    random_traits_list = {
                        count = 2
                        gregarious = {}
                        deceitful = {}
                        humble = {}
                        arrogant = {}
                        temperate = {}
                        gluttonous = {}
                    }
                    random_traits = yes
                    employer = root
                    faith = root.faith
                    culture = root.culture
                    save_scope_as = rboracle_char
                }
            }
        }

So the script first checks if an oracle exists at the root's court, then if not there checks any lieges, and finally if none are anywhere in that range it makes a new one.

Of course my mod has THREE types of diviners, so that entire script lies within ANOTHER if ={ function so it can check through oracles, augurs and haruspices. This, incidentally, was supposed to be a side project, and it's fast turned into the most complex (and fun) part of the whole mod.

I didn't even NEED to do this! The process was working just fine without actors, and this is just so that there are characters to look at in the event window! It's just to look better! Is this what coding is ALWAYS like? Pure masochism?
 

HyperTwerp

Sergeant
55 Badges
May 21, 2019
88
50
  • Crusader Kings II
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mandate of Heaven
  • PDXCon 2019 "Baron"
  • Crusader Kings II: Conclave
  • Cities: Skylines - Snowfall
  • Hearts of Iron IV: Expansion Pass
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Imperator: Rome
  • Cities: Skylines - After Dark
  • Hearts of Iron IV: Death or Dishonor
  • Age of Wonders III
  • Europa Universalis IV: Cradle of Civilization
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV
  • Crusader Kings III
  • Hearts of Iron IV: La Resistance
  • Victoria: Revolutions
  • Victoria 2
  • Europa Universalis 4: Emperor
  • Cities: Skylines
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Battle for Bosporus
  • Warlock: Master of the Arcane
  • 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
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
Alright, so, as I expected, these titles don't just take of their own accord just because they're in the localization file; they need to be implemented in game/common/flavorization, following the same format presented in 00_title_holders.txt. I won't attempt to do this in full, since your precise demands might differ somewhat from my interpretation, but this would be a potential way to deal with the feudal empire level, just to get you started:—

Did this work for you? Because it isn't for me :confused: try as I might, I can't seem to get it to.

1608597250649.png

Side note: Thanks for the help with the random titles delocalizing, that worked.
 

Aregodas

Second Lieutenant
30 Badges
Jun 14, 2017
198
561
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Imperator: Rome
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Way of Life
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders III
  • Crusader Kings II: Holy Fury
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
Is it possible to create a special building that gives certain modifiers to whoever controls the province, but that gives additional buffs to that person if he is of a specific faith?
As in, I create a special building for the province of Athens with a temple that gives to its owner +2 learning, would I be able to edit it so that, if the owner is hellenic, he gets the +2 learning bonus and +1 monthly piety?
It should be possible. There are buildings like Hagia Sophia in Constantinople that are active (bonuses applying that is) only if your faith considers the province a Holy site. From there we can conclude that the faith of the holder is checked by certain buildings. I reckon it should be doable.

I have yet another question. I'm trying to branch out from one original event to several others, but even though the event is functional I have yet to see it trigger naturally, without manually doing it from the console. I went so far as to check other existing events and include a scripted_effect, to no avail.
It's not a chain of events per se, the second should appear randomly after a while.
Code:
scripted_trigger tyrannical_greed.0002_trigger = {
    is_adult = yes
    is_imprisoned = no
    has_character_modifier = tyrannical_greed_modifier1
}
tyrannical_greed.0002 = {
    type = character_event
    title = tyrannical_greed.0002.t
    desc = tyrannical_greed.0002.desc
    theme = stewardship_wealth_focus
    right_portrait = {
        character = root
        animation = personality_callous
    }
    override_background = { event_background = council_chamber }
    trigger = {
        tyrannical_greed.0002_trigger = true
    }
    weight_multiplier = {
        base = 100
        modifier = {
            add = 0.5
            has_trait = greedy
        }
    }  
    immediate = {
        add_focus_progress = 10
        add_character_flag = {
            flag = had_tyrannical_greed.0002_event
            years = 3
        }  
    }
    option = {
        trigger = {
            has_trait = greedy
        }
        name = tyrannical_greed.0002.a
        custom_tooltip = tyrannical_greed.0002.a.tt
        add_gold = 100
    }
    option = {
        name = tyrannical_greed.0002.b
        custom_tooltip = tyrannical_greed.0002.b.tt
        add_prestige = 50
    }
}
Can you guys offer me any clues as to how to make this work?
 

Aregodas

Second Lieutenant
30 Badges
Jun 14, 2017
198
561
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Imperator: Rome
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Way of Life
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders III
  • Crusader Kings II: Holy Fury
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
You don't need the "scripted_trigger" in the first line of your scripted_trigger file, or did you just write that to let us know what it was?
Rather to remind me what it was, but also because in the base game folder there are several files for events that include scripted triggers just like that. Not knowing I prefered to err on the side of caution and add it, just in case. For instance:
Code:
scripted_trigger vassal_1101_religious_vassal_trigger = {
    faith = root.faith
    is_available_ai_adult = yes
    NOT = { root = { has_hook = prev } }
    OR = {
        has_trait = zealous
        piety_level >= high_piety_level
    }    
}
This appears as such in vassal_events.txt > relations_events > events > game
 

Aregodas

Second Lieutenant
30 Badges
Jun 14, 2017
198
561
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Imperator: Rome
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Way of Life
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders III
  • Crusader Kings II: Holy Fury
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
I'm stuck. I cannot, for the love of me, make the secondary event to run naturally.
This part is at the very end of the father event, the first one.
Code:
after = {
        trigger_event = {
            on_action = tyrannical_greed_events
            months = 2
        }
    }
And this is the second event and all the rest that I believe it's necessary for it run.
Code:
tyrannical_greed_events = {
    random_events = {
        1000 = tyrannical_greed.0002
    }
}
scripted_trigger tyrannical_greed.0002_trigger = {
    is_adult = yes
    is_imprisoned = no
    has_character_modifier = tyrannical_greed_modifier1
}
tyrannical_greed.0002 = {
    type = character_event
    title = tyrannical_greed.0002.t
    desc = tyrannical_greed.0002.desc
    theme = stewardship_wealth_focus
    right_portrait = {
        character = root
        animation = personality_callous
    }
    override_background = { event_background = council_chamber }
    trigger = {
        tyrannical_greed.0002_trigger = yes
    }

    weight_multiplier = {
        base = 1000
        modifier = {
            add = 0.5
            has_trait = greedy
        }
    } 
    immediate = {
        add_focus_progress = 10
        add_character_flag = {
            flag = had_tyrannical_greed.0002_event
            years = 3
        } 
    }
    option = {
        trigger = {
            has_trait = greedy
        }
        name = tyrannical_greed.0002.a
        custom_tooltip = tyrannical_greed.0002.a.tt
        add_gold = 100
    }
    option = {
        name = tyrannical_greed.0002.b
        custom_tooltip = tyrannical_greed.0002.b.tt
        add_prestige = 50
    }
}
I actually followed the explanation here given in a Dev Diary: https://www.crusaderkings.com/en/news/dev-diary-30-event-scripting

I don't know what I'm missing :(

EDIT: I've kinda figure it out. Not exactly as I wanted, an definitely a bit more messier than I'd like, but it works.
 
Last edited:

Anyasia

Lightbringer
72 Badges
Aug 5, 2015
428
265
  • Europa Universalis IV: Rights of Man
  • Crusader Kings Complete
  • Crusader Kings II
  • Crusader Kings III
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Conclave
I'm stuck. I cannot, for the love of me, make the secondary event to run naturally.
This part is at the very end of the father event, the first one.
Code:
after = {
        trigger_event = {
            on_action = tyrannical_greed_events
            months = 2
        }
    }
And this is the second event and all the rest that I believe it's necessary for it run.
Code:
tyrannical_greed_events = {
    random_events = {
        1000 = tyrannical_greed.0002
    }
}
scripted_trigger tyrannical_greed.0002_trigger = {
    is_adult = yes
    is_imprisoned = no
    has_character_modifier = tyrannical_greed_modifier1
}
tyrannical_greed.0002 = {
    type = character_event
    title = tyrannical_greed.0002.t
    desc = tyrannical_greed.0002.desc
    theme = stewardship_wealth_focus
    right_portrait = {
        character = root
        animation = personality_callous
    }
    override_background = { event_background = council_chamber }
    trigger = {
        tyrannical_greed.0002_trigger = yes
    }

    weight_multiplier = {
        base = 1000
        modifier = {
            add = 0.5
            has_trait = greedy
        }
    }
    immediate = {
        add_focus_progress = 10
        add_character_flag = {
            flag = had_tyrannical_greed.0002_event
            years = 3
        }
    }
    option = {
        trigger = {
            has_trait = greedy
        }
        name = tyrannical_greed.0002.a
        custom_tooltip = tyrannical_greed.0002.a.tt
        add_gold = 100
    }
    option = {
        name = tyrannical_greed.0002.b
        custom_tooltip = tyrannical_greed.0002.b.tt
        add_prestige = 50
    }
}
I actually followed the explanation here given in a Dev Diary: https://www.crusaderkings.com/en/news/dev-diary-30-event-scripting

I don't know what I'm missing :(

EDIT: I've kinda figure it out. Not exactly as I wanted, an definitely a bit more messier than I'd like, but it works.

Assuming this is all as it's written in one file, you've specified tyrannical_greed_events as an on action, but put it in an event file. It either needs to be moved to common/on_action, or, if its only purpose is to trigger the next event (as presented), and you're not using it to run other effects or potentially load other random events, just replace your event trigger with this:—

Code:
after = {
        trigger_event = {
            id = tyrannical_greed.0002
            months = 2
        }
    }
 
Last edited:

Thomas_Oak

Major
8 Badges
May 11, 2018
643
758
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Warlock: Master of the Arcane
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
While we are looking at problem event triggers, I have one written a while ago which I keep tinkering with every now and then but have never got to fire. I am trying to get an event to trigger after a combat victory only when I am not leading the army as commander. My on action file is:
Code:
on_battle_owner_battle_end = {
    on_actions = {
        delay = { days = 1 }
        TOMS_combat_end_winner
    }
}

TOMS_combat_end_winner = {
    random_events = {
        24000 = 0
       
        1000 = TOMScombat.0100
    }
}
And the event begins so:
Code:
TOMScombat.0100 = {
    hidden = yes
   
    trigger = {
        is_ai = no
        NOT = { has_variable = TOMS_combat_01 }
        is_female = no
        exists = scope:victory
        NOT = {
            is_at_location = scope:province
        }
    }
It is all fairly straight forward except maybe the final lines. Scopes province and victory are supposed to be generated by the on_action. Any suggestions?
 

Anyasia

Lightbringer
72 Badges
Aug 5, 2015
428
265
  • Europa Universalis IV: Rights of Man
  • Crusader Kings Complete
  • Crusader Kings II
  • Crusader Kings III
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Conclave
While we are looking at problem event triggers, I have one written a while ago which I keep tinkering with every now and then but have never got to fire. I am trying to get an event to trigger after a combat victory only when I am not leading the army as commander. My on action file is:
Code:
on_battle_owner_battle_end = {
    on_actions = {
        delay = { days = 1 }
        TOMS_combat_end_winner
    }
}

TOMS_combat_end_winner = {
    random_events = {
        24000 = 0
    
        1000 = TOMScombat.0100
    }
}
And the event begins so:
Code:
TOMScombat.0100 = {
    hidden = yes

    trigger = {
        is_ai = no
        NOT = { has_variable = TOMS_combat_01 }
        is_female = no
        exists = scope:victory
        NOT = {
            is_at_location = scope:province
        }
    }
It is all fairly straight forward except maybe the final lines. Scopes province and victory are supposed to be generated by the on_action. Any suggestions?
A potential problem I'm seeing is that the event is called for root, and on_battle_owner_battle_end doesn't look like it has a root scope. Perhaps wrapping the content of your trigger in scope:friendly_battle_owner = { … } (and likewise applying its effects to that scope) would do the trick?

You might also be able to simply compare scope:friendly_battle_owner to scope:friendly_commander to check if they're the same, rather than checking location, though I'm not intimately familiar with how the combat system works, so if like CK2 you can be present at the battle without being the overall commander, that wouldn't necessarily check for that. One potential problem I now see with checking location (though I believe it was my recommendation—whoops!) would be the possible edge case of you not commanding a battle taking place in your capital registering as though you had (because you're there).

Bear in mind too that for testing purposes you should probably just have the random event fire 100% of the time (rather than 1 in 25 times) so you can easily work out whether it's firing at all!
 

Aregodas

Second Lieutenant
30 Badges
Jun 14, 2017
198
561
  • Stellaris: Nemesis
  • Stellaris: Necroids
  • Imperator: Rome
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Stellaris: Distant Stars
  • Stellaris: Leviathans Story Pack
  • Stellaris: Digital Anniversary Edition
  • Stellaris
  • Crusader Kings II: Way of Life
  • Stellaris: Megacorp
  • Stellaris: Ancient Relics
  • Stellaris: Lithoids
  • Stellaris: Federations
  • Crusader Kings III
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Conclave
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Monks and Mystics
  • Age of Wonders III
  • Crusader Kings II: Holy Fury
  • Crusader Kings II
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sword of Islam
Assuming this is all as it's written in one file, you've specified tyrannical_greed_events as an on action, but put it in an event file. It either needs to be moved to common/on_action, or, if its only purpose is to trigger the next event (as presented), and you're not using it to run other effects or potentially load other random events, just replace your event trigger with this:—

Code:
after = {
        trigger_event = {
            id = tyrannical_greed.0002
            months = 2
        }
    }
I wanted it to be an on_action and its goal was to work a set of random events, not just the one.
Thanks for the reply Anyasia. Hopefully I managed to solve the issue in a similar way as you proposed, although I managed to maintain randomness of event and create a loop so that once the flag has expired another event on the table might trigger, and then another one, and so on, until the duration of the given modifier is expired. All in all, quite happy with the result, though it's a bit messy. I might try to do it differently next time -a new txt file in common/on_action- as suggested, let's see if next time I can make it work.
 

Thomas_Oak

Major
8 Badges
May 11, 2018
643
758
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Warlock: Master of the Arcane
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
After experimenting with my on_action problem all morning, I am beginning to think the problem might be with the vanilla on_action itself. Even changing it to something like the following does not fire.
Code:
on_battle_owner_battle_end = {
    events = {
        TOMSmisc.0102
    }
}

If anyone has a little time to spare, I would be very grateful indeed if you could test to see if you can get either of the on_actions in battle_on_actions.txt to fire an event.
 

Anyasia

Lightbringer
72 Badges
Aug 5, 2015
428
265
  • Europa Universalis IV: Rights of Man
  • Crusader Kings Complete
  • Crusader Kings II
  • Crusader Kings III
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II: Conclave
After experimenting with my on_action problem all morning, I am beginning to think the problem might be with the vanilla on_action itself. Even changing it to something like the following does not fire.
Code:
on_battle_owner_battle_end = {
    events = {
        TOMSmisc.0102
    }
}

If anyone has a little time to spare, I would be very grateful indeed if you could test to see if you can get either of the on_actions in battle_on_actions.txt to fire an event.
Aye. Hell if I know why, but I can't get it to fire, either. I did this as a workaround, which is a bit messy, but seems to be able to achieve your goal:—

Code:
# common/on_action/debug_on_actions.txt
# Have to use an on action here since events fire from native on_combat_end_winner and would be overwritten by a direct event call
toms_on_action = {
    events = {
        TOMSmisc.0102
    }
}

on_combat_end_winner = {
    on_actions = {
        toms_on_action
    }
}

Code:
# events/debug_events.txt
namespace = TOMSmisc

TOMSmisc.0102 = {
    scope = combat_side
    hidden = yes
   
    immediate = {
        side_primary_participant = {
            # We fire a secondary event here so that it can be treated as a character event; I can't work out how to get it to work as a single event.
            # You can also check here to prevent AI from receiving the event,
            # and check whether you're commanding your own troops by comparing side_primary_participant to side_commander
            trigger_event = TOMSmisc.0103
        }
    }
}

TOMSmisc.0103 = {
    type = character_event
    hidden = yes

    # Run your event as normal
}
 
  • 1
Reactions:

Thomas_Oak

Major
8 Badges
May 11, 2018
643
758
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sons of Abraham
  • Warlock: Master of the Arcane
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Crusader Kings II: Monks and Mystics
  • Crusader Kings III
Anyasia you are magnificent. I am glad I wasn't going totally mad. :)

I have the event firing at last, so I am 90% there. Unfortunately I have hit a snag which may mess things up. The events do not seem to be able to use the scope side_commander at all. I am wondering if this scope is only active during combat and this on_action fires when combat ends. Such a nuisance as the battle_on_action scope of friendly_commander was just what was needed. :confused:

Looked further and I think I am wrong again as the vanilla event combat_event.0001 fires from that on-action and utilises that very scope. I shall look further.
 
Last edited:
  • 1
Reactions: