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

SwordArTJBF

Sergeant
57 Badges
Jun 20, 2019
72
0
  • Crusader Kings II
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Ancient Relics
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Hearts of Iron IV: La Resistance
  • Europa Universalis IV: Mandate of Heaven
  • Imperator: Rome Deluxe Edition
  • Stellaris: Synthetic Dawn
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Stellaris: Apocalypse
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Distant Stars
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Crusader Kings II: Conclave
  • Europa Universalis IV: El Dorado
  • Europa Universalis 4: Emperor
  • Crusader Kings III
  • Victoria 2
  • Europa Universalis IV
  • Crusader Kings III: Royal Edition
  • 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
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Stellaris: Megacorp
I've been working on a mod that adds a bunch of council voter positions and scripted events to simulated elections. I've made a decent amount of progress so far, but I can't seem to get it to properly work. The triggered event that's supposed to fire upon starting up the game doesn't fire at all, and when I use the console to trigger it (or any other event I've added) the game instead tries to use the a different specific event every time.

There might be some other issues floating around with it atm, so could anyone here dig through my files and tell me what I need to fix to get it working? because I'm so close to finally completing it, but since I'm fairly new to scripting, I just can't quite figure out what needs fixing in order for it to completely work.
 

Attachments

  • mod.zip
    450,5 KB · Views: 3
A few things I noticed:

You use 'while' inside 'if', but that's not how either of those works. Remove the surrounding 'if'. You can also use 'count < 50', to make the code more intuitive.

To answer your question, you'll have to look into using on_actions to fire events on start-up, and make those events 'is_triggered_only = yes'. Also note that on_startup events fire for all qualifying characters, so be sure to add some trigger to narrow that down.

In general, you should probably use The Validator to check for any errors in your mod(s).
 
The triggered event that's supposed to fire upon starting up the game doesn't fire at all, and when I use the console to trigger it (or any other event I've added) the game instead tries to use the a different specific event every time.
Becuase as Whizzer says its not actually called anywhere, events to fire either need to be mean time to happen to fire on their own, or fired form an on_action.

Also your event id's look really weird and pretty sure they wont actually work as you have them in a namepace format despite not actually using a namespace.

rather than parlaG.001 and parlaF.002 etc etc it should have a common namespace declared at the top of the file and all use that. e.g.

Code:
namespace = parla
character_event = {
    id = parla.001
    hide_window = yes
   
    trigger = {
        OR = {
            has_landed_title = e_brittania
            has_landed_title = k_england
        }
        is_feudal = yes
        NOT = { has_character_modifier = house_term }
        has_law = law_voting_power_1
    }
   
    immediate = {
        add_character_modifier = { name = house_term duration = 1825 }
        empty_house = yes
        fill_house = yes
    }
}
character_event = {
    id = parla.002
    hide_window = yes
   
    trigger = {
        has_dlc = "Conclave"
    }
   
    immediate = {
        set_global_flag = parliament_start
        set_global_flag = senate_start
        set_global_flag = diet_start

    }
}
 
So I feel like I'm finally starting to make some progress with your help. I succeeded in getting the parliament_start flags to make the landed titles accessible, but unfortunately, the election script to fill those slots with random npcs doesn't seem to be working. In addition, specifically for the Byzantine Empire, the localization is broken; I have the title_senator text set as "Senator", but it comes out like this in game
iKYwowa.png


How would I go about causing the election scripts to fire properly and fix the localization? Normally, I'd use the Validator to fix any errors, but I haven't been able to get that to work for any Paradox game for the life of me. It just refuses to read any mod file, acting as if it doesn't even exist in my folder.

Here's the updated zip for the mod's files. Again, I really appreciate your guys help, as I finally feel like I'm getting close to completing my first real mod project
 

Attachments

  • mod.zip
    451,9 KB · Views: 2
Looks like too few or too many brackets in at least one place. I've fixed it in the file below.
You still need to add 'is_triggered_only = yes' to events that are not fired using Mean Time To Happen, which may be all of them.
Be sure to delete your old file with events before adding your new one. Having duplicate events is a disaster when it comes to testing, especially since they aren't restricted in how often they can trigger at all.

You should probably also name your files a bit more accurately, for example your scripted effects file. I've adjusted that one for you.

If you can share how you configure The Validator, I'll help with setting it up correctly.
 

Attachments

  • mod.zip
    451,9 KB · Views: 4
Looks like too few or too many brackets in at least one place. I've fixed it in the file below.
You still need to add 'is_triggered_only = yes' to events that are not fired using Mean Time To Happen, which may be all of them.
Be sure to delete your old file with events before adding your new one. Having duplicate events is a disaster when it comes to testing, especially since they aren't restricted in how often they can trigger at all.

You should probably also name your files a bit more accurately, for example your scripted effects file. I've adjusted that one for you.

If you can share how you configure The Validator, I'll help with setting it up correctly.

so the localization seems to be fixed now, and I can now fire some of the events through the console. One of them (parla.004, specifically for the Byzantines) actually successfully creates a character and gives them a position in the senate, but it only generates one at a time, and it gives my ruler the term modifier meant for the senator themselves and prevents me from firing the event again.

In addition, the generated characters are still not being generated properly automatically, but for some reason, firing the event through the console seems to create a few of the random characters in my rulers court, but doesn't actually assign them to the senator minor title. Is there any way I can use an on_action/ new event or something to automatically create the required random characters and give them positions on the council, preferably in a way that doesn't break the later elections? Because I feel like once I figure that out, there shouldn't be much else I'll need to fix in order to get this up and running properly. I do think that this may require creating different events or editing the current ones, however, as I don't see the current event that triggers the fill_senate script working well as an on_action that fires like 30 times on start-up somehow.
 
so the localization seems to be fixed now, and I can now fire some of the events through the console. One of them (parla.004, specifically for the Byzantines) actually successfully creates a character and gives them a position in the senate, but it only generates one at a time, and it gives my ruler the term modifier meant for the senator themselves and prevents me from firing the event again.

In addition, the generated characters are still not being generated properly automatically, but for some reason, firing the event through the console seems to create a few of the random characters in my rulers court, but doesn't actually assign them to the senator minor title. Is there any way I can use an on_action/ new event or something to automatically create the required random characters and give them positions on the council, preferably in a way that doesn't break the later elections? Because I feel like once I figure that out, there shouldn't be much else I'll need to fix in order to get this up and running properly. I do think that this may require creating different events or editing the current ones, however, as I don't see the current event that triggers the fill_senate script working well as an on_action that fires like 30 times on start-up somehow.

Use repeat_event = { id = parla.00# } to recursively iterate the legislature-populating events and a flag in the trigger (e.g., NOT = { has_character_flag = <legislature>_filled } ) that halts the process once the legislature is fully populated. You'll additionally have to modify the scripted effects to add the <legislature>_filled flag once the threshold is reached. This can be done as follows:
Code:
fill_house = {  
    IF = {
        limit = {
            any_courtier_or_vassal = {    # This part is important: you were using the wrong syntax in the original script
                count = 30
                has_assigned_minor_title = title_mp
            }
        }
        set_character_flag = house_filled
    }
    ELSE = {
        random_courtier_or_vassal = {
            limit = {
                is_female = no
                is_heir = no
                has_regent = no
                is_councillor = no
                age = 25
                OR = {
                    is_landed = no
                    is_republic = yes
                }
                NOR = {
                    has_minor_title = title_mp
                    has_minor_title = title_lord
                }
            }
            give_minor_title = title_mp
        }
    }
}

You're going to want to separate out the block that creates a pool of up to 100 candidates, since the above will stop once it fills 30 seats.
 
Last edited:
Use repeat_event = { id = parla.00# } to recursively iterate the legislature-populating events and a flag in the trigger (e.g., NOT = { has_character_flag = <legislature>_filled } ) that halts the process once the legislature is fully populated. You'll additionally have to modify the scripted effects to add the <legislature>_filled flag once the threshold is reached. This can be done as follows:
Code:
fill_house = {
    IF = {
        limit = {
            any_courtier_or_vassal = {    # This part is important: you were using the wrong syntax in the original script
                count = 30
                has_assigned_minor_title = title_mp
            }
        }
        set_character_flag = house_filled
    }
    ELSE = {
        random_courtier_or_vassal = {
            limit = {
                is_female = no
                is_heir = no
                has_regent = no
                is_councillor = no
                age = 25
                OR = {
                    is_landed = no
                    is_republic = yes
                }
                NOR = {
                    has_minor_title = title_mp
                    has_minor_title = title_lord
                }
            }
            give_minor_title = title_mp
        }
    }
}

You're going to want to separate out the block that creates a pool of up to 100 candidates, since the above will stop once it fills 30 seats.
That sounds like a fairly easy fix. I presume I’d add the repeat_event function after say the "immediate" section, right? I’m also a bit confused as to what exactly I’ll need to put in there, as the wiki portion on it is a stub. Would I just need the has_character_flag scope under the NOT bracket for it to work properly? Or is there anything else I’d need to put under there?
 
Last edited:
Use repeat_event = { id = parla.00# } to recursively iterate the legislature-populating events and a flag in the trigger (e.g., NOT = { has_character_flag = <legislature>_filled } ) that halts the process once the legislature is fully populated. You'll additionally have to modify the scripted effects to add the <legislature>_filled flag once the threshold is reached. This can be done as follows:
Code:
fill_house = { 
    IF = {
        limit = {
            any_courtier_or_vassal = {    # This part is important: you were using the wrong syntax in the original script
                count = 30
                has_assigned_minor_title = title_mp
            }
        }
        set_character_flag = house_filled
    }
    ELSE = {
        random_courtier_or_vassal = {
            limit = {
                is_female = no
                is_heir = no
                has_regent = no
                is_councillor = no
                age = 25
                OR = {
                    is_landed = no
                    is_republic = yes
                }
                NOR = {
                    has_minor_title = title_mp
                    has_minor_title = title_lord
                }
            }
            give_minor_title = title_mp
        }
    }
}

You're going to want to separate out the block that creates a pool of up to 100 candidates, since the above will stop once it fills 30 seats.
I just tried implementing those changes, but when I did, the game crashed after I selected my character and tried to load into the game. The first time, the error log said it was because I had the wrong global flag set in the event, which I fixed, but I'm still getting the same crash. What makes it even weirder is that the error log is now completely blank despite there being an obvious crash, making it really difficult for me to figure out what I need to do to fix it.

I've been trying to get the Validator work for me, but it refuses to work for any mods I've made for any paradox game. It lets me go through the base games files or mods from the workshop, but whenever I try to load a specific mod that I created myself, it just says that the mod was "not found" despite me correctly putting it in the mod name section. Could this be because there's some sorta file (like the validator settings one) that's missing from my custom mod? How would I go about getting this to work, so I can actually fix the problems I'm having?
 
so despite fixing almost all of the errors from the validator, for some reason, I'm still getting a CTD the moment I select a character and the game finishes loading into the chronicle. There's no entries in the error log; it's completely blank, so I have no idea what's causing this. It started happening after I made some changes to the scripted effects to fix the syntax, but I have no idea if that's what even causing it, as I seemed to have largly fixed that.

could any of you guys please take a look through this and see if anythings fucked up? Because I've tried pretty much everything, but I can't figure out what's causing this crash, as the validator and error logs aren't telling me anything.
 

Attachments

  • parliamenttest (3).zip
    453,4 KB · Views: 1
Okay, I sat down and built a template you should be able to adapt for each parliament type.

First, the scripted effects:
Code:
empty_house = {
    any_courtier_or_vassal = {
        limit = { has_minor_title = title_mp }
        remove_title = title_mp
    }
}

generate_house_pool = {
    WHILE = {
        limit = {
            NOT = { any_courtier_or_vassal = { count = 100 } }
        }
        create_character = {
            random_traits = yes
            dynasty = none
            religion = ROOT
            culture = ROOT
            race = ROOT
            female = no
            age = 25
        }
    }
}

fill_house = {
    WHILE = {
        limit = {
            NOT = {
                any_courtier_or_vassal = {
                    count = 30
                    has_assigned_minor_title = title_mp
                }
            }
        }
        random_courtier_or_vassal = {
            limit = {
                is_female = no
                is_heir = no
                has_regent = no
                is_councillor = no
                age = 25
                OR = {
                    is_landed = no
                    is_republic = yes
                }
                NOR = {
                    has_minor_title = title_mp
                    has_minor_title = title_lord
                }
            }
            give_minor_title = title_mp
        }
    }
}



And then the events:
Code:
namespace = parle
character_event = {
    id = parle.000
    hide_window = yes
    is_triggered_only = yes
 
    trigger = {
        has_dlc = "Conclave"
    }
 
    immediate = {
        set_global_flag = parliament_start
    }
}

character_event = {
    id = parle.001
    hide_window = yes
    is_triggered_only = yes
 
    trigger = {
        OR = {
            has_landed_title = k_england
            has_landed_title = e_britannia
        }
        is_feudal = yes
        has_law = law_voting_power_1
    }
 
    immediate = {
        add_character_modifier = { name = house_term duration = 1825 }
        empty_house = yes
        generate_house_pool = yes
        fill_house = yes
    }
}

character_event = {
    id = parle.002
    hide_window = yes
    is_triggered_only = yes
 
    trigger = {
        has_character_modifier = house_term
        NOR = {
            has_landed_title = k_england
            has_landed_title = e_britannia
        }
    }
 
    immediate = {
        remove_character_modifier = house_term
        any_courtier_or_vassal = {
            limit = {
                OR = {
                    has_minor_title = title_mp
                    has_minor_title = title_lord
                }
            }
            trigger_switch = {
                on_trigger = has_minor_title
                title_mp    = { remove_title = title_mp }
                title_lord  = { remove_title = title_lord }
            }
            remove_opinion = { who = FROM modifier = opinion_fired_from_council }
            remove_opinion = { who = FROM modifier = opinion_recently_fired }
        }
    }
}
 
Last edited:
so I FINALLY managed to seem to get to work for the most part. I used on_startup to fire the events to create and fill the council slots, and it seems that the random elections are working quite well.

There's just one more things I'll need to fix. Firstly, when my character gets overthrown in a coup by a faction or civil war, the new ruler won't have any of the council slots, but the character I'm playing as will still have all the old senators/mps or whatever from when he used to hold the title that has them despite no longer holding said title. I looked some more into the on_actions, and I tried the on_new_holder triggers, but they don't seem to do anything.

Is there anything I can do to make it where both the council slots and the random specific councilors will carry over to a new ruler when my character is overthrown or dies? and is there any way I can get rid of all said senators when my character no longer holds the titles that should have them?