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

schwarherz

CKPlus Triumvirate
79 Badges
Jun 3, 2012
2.033
589
  • Crusader Kings II: Charlemagne
  • Stellaris - Path to Destruction bundle
  • Hearts of Iron IV Sign-up
  • Stellaris Sign-up
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Semper Fi
  • Victoria: Revolutions
  • Magicka
  • Hearts of Iron III Collection
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III
  • For the Motherland
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Republic
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Legacy of Rome
  • Stellaris: Apocalypse
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Crusader Kings II: Monks and Mystics
  • Tyranny: Archon Edition
  • Cities: Skylines - Mass Transit
  • BATTLETECH
  • Surviving Mars
  • PDXCon 2017 Awards Winner
  • Hearts of Iron IV: Death or Dishonor
  • Surviving Mars: Digital Deluxe Edition
  • Crusader Kings II: Jade Dragon
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Cadet
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris
  • Crusader Kings II: Conclave
  • Cities: Skylines - After Dark
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Pre-order
  • Stellaris: Nemesis
  • 500k Club
  • Victoria 2
mod_cleanslate_cleanslate.jpg


GitHub [download] | Steam Workshop [workshop]​

GOAL
To provide a clean, stable, readable base from which other modders can "jump off" to create their own mods more easily and fix any bugs and oversights that Paradox has missed.


Features
- Modding Improvements
This is CleanSlate's original goal. All script has been updated to use newer script features where applicable, and inefficient and/or hard-to-comprehend script has been optimized, and where necessary, documented. Scripted triggers and effects have been properly put to use, and various new scripted triggers have been added, for modders to make use of. See the master changelog, typically included in the download, for more information.
- Bugfixes
CleanSlate is also a massive community patch, fixing nearly 500 bugs and countless minor issues. For details, see the master changelog, typically included in the download.).
- Better Tooltips
You'll no longer see 'Ruler: Spouse: Opinion of Ruler decreases by 10 for 5 years (Furious)'. Almost (*) all uninformative parts of tooltips have been cut, making it easier to see what happens.

In addition, various requirements to enact laws and take decisions has been made easier to read as well.

The game is now much better informing you about losing traits, when you gain a trait opposite to one your current traits, and should always send a notification if trait changes are a matter of chance, meaning you'll no longer have to check your character page to check if you did indeed get (un)lucky.

* Due to limitations in the game's source code, some tooltips could not be cleaned up entirely.
- Never-before-seen events
We have, of course, not added any new events. What you will finally see, for the first time, are various Paradox-developed events, some of which have been part of the game since its very first release, and others, added by various patches and expansions. Among these are siege events, guardian events and birth events.
- Inconsistencies Corrected
While working our way through all of the game's script files, we have smoothed over several inconsistencies. Not all older content properly accounts for various new features added over the years. Consider content that locks out women, without regard for religion features and game rules, or not properly considering various sexual dispositions characters can have towards each other.

Current release
Beta 2.8 - All base game script rewritten, most content reorganized for easier searching.


Future goals
Correct all localization, in all four languages.
Fixing bugs reported on the official forums.


Compatibility
Crusader Kings II version 3.3.4 highly recommended.
May work with versions back to 3.2.x.
Ironman compatible, not achievement compatible.

ui_scale: Include the following line in your scale_ui_xxxx.mod file:
dependencies = { "CleanSlate" }

CleanSlate is not and in most cases cannot be compatible with any mods that have not been built off CleanSlate. That is the downside of thoroughly overhauling the game's script.
We recommend anyone interesting in rebasing mods on CleanSlate to compare current mod files to vanilla files, and bring these changes over to CleanSlate's files. Reading CleanSlate's master changelog for additions and removals is highly recommended.
Authors of large mods are advised to wait until CleanSlate is stable, to avoid endless compatibility patching whenever CleanSlate is updated.


Feedback
CleanSlate is not yet finished. Efforts to squash more bugs is ongoing. New bugs may currently be part of CleanSlate. If you come across any, please report them, so that we can make CleanSlate even better.


Background
As I'm sure everyone in the CK2 Modding Community is aware, the vanilla script for the game is... well... it's a mess. There are myriad bugs, hardly any of the scripting itself is human readable, and the localization is scattered over a dozen or so files with no real organization to it. There have clearly been several batches of cooks on this particular broth. To resolve this, the CK2Plus mod team presents our new standalone community resource: CleanSlate.

To be clear, this mod/resource will (eventually) overwrite every. single. vanilla. file. It already overwrites the vast majority. It will not be compatible with any other mod that modifies vanilla files (unless it's specifically built off of CleanSlate) and vanilla saves are not compatible.

As of right now, the mod is in BETA. Save compatibility between versions is not guaranteed. Until we reach the first full release things are just changing too much between each version to guarantee that.


===Hall of Paradox Scripting Shame===
Location: Unknown (we forgot where we saw this)
Code:
trigger_if = {
    limit = { religion = FROM }
    religion = FROM
}

Location: Unknown (we forgot where we saw this)
Code:
ai_chance = {
  factor = 1

  modifier = {
    factor = 0
    ai = no
  }
}

Location: Scripted Triggers
Code:
#Have to be Christian denomination with potential Religious head, and have been singled out for Beatification
modifier = {
    factor = 0
    NOR = {
        NAND = {
            event_target:saint_person = {
                religion = catholic
            }
            event_target:saint_person = {
                religion = fraticelli
            }
            event_target:saint_person = {
                religion = orthodox
            }
            event_target:saint_person = {
                religion = iconoclast
            }
            event_target:saint_person = {
                religion = nestorian
            }
            event_target:saint_person = {
                religion = misphysite
            }
            event_target:saint_person = {
                religion = monophysite
            }
            event_target:saint_person = {
                religion = paulician
            }
            event_target:saint_person = {
                has_religion_feature = religion_beatification
            }
        }
        NOR = {
            event_target:saint_person = {
                has_character_flag = beatified
            }
            event_target_saint_person = {
                has_religion_feature = religion_beatification
            }
        }
    }
}

Location: Personality Traits Events
Code:
trigger = {
    trait = lustful
    personality_traits = 6
}

weight_multiplier = {
    days = 1

    modifier = {
        factor = 2
        personality_traits = 6
    }
}

Location: Succession Laws
Code:
OR = {
    AND = {
        tier = baron
        is_feudal = yes
    }
    holder_scope = { is_feudal = yes }
    holder_scope = { is_patrician = yes }
}

OR = {
    NOT = { tier = baron }
    holder_scope = { is_patrician = yes }
}

Location: Unknown (we forgot where we saw this)
Code:
random_list = {
    100 = {
        character_event = { id = ZE.11050}
    }
}

Location: CBs
Code:
OR = {
    OR = {
        is_female = no
        NOR = {
            religion_group = muslim
            ROOT = { succ_law_title = { has_law = agnatic_succession } }
            has_religion_feature = religion_patriarchal
        }
    }
    OR = {
        is_female = yes
        NOR = {
            religion_group = muslim
            ROOT = { succ_law_title = { has_law = enatic_succession } }
            has_religion_feature = religion_matriarchal
        }
    }
}

Location: CBs
Code:
ROOT = {
    OR = {
        NOT = { religion_group = pagan_group }
        is_reformed_religion = yes
    }
}
OR = {
    NOT = { ROOT = { religion_group = pagan_group } }
    ROOT = { is_reformed_religion = yes }
}

location: events
Code:
ROOT = {
    opinion = {
        who = ROOT
        value >= -20
    }
}

location: events
Code:
OR = {
    religion_group = zoroastrian_group

    NOR = {
        religion = manichean
        religion = mazdaki
    }
}

Dishonorable Mention:
Code:
2000+ references in 200+ files to "trait = incapable" instead of "is_incapable = yes"

Have you found a bug?
Bugs can be reported on our GitHub page here,
For multiple bugs, please submit reports individually for our ease of tracking. Thank you for your help!​
 
Last edited:
  • 18Like
  • 4Love
  • 2
Reactions:
(check calendar) OK, not April 1 today....
AVE MARIA! May god bless you good guys.
Will you split every entries in some override-only files (for example "interface\coat_of_arms\coats_of_arms.txt") into separated files, to enhance modular compatibilities?
 
Last edited:
Very neat idea. Needed this tool years ago lol when I started modding :)
 
I'm not doing any CK2 modding right now, but this is amazing. Good work!
 
  • 1
Reactions:
(check calendar) OK, not April 1 today....
AVE MARIA! May god bless you good guys.
Will you spilt every entries in some override-only files (for example "interface\coat_of_arms\coats_of_arms.txt") into separated files, to enhance modular compatibilities?
Absolutely. Because this is intended, first and foremost, to be a platform for other mods to jump off of, we'll likely make several changes like that. For instance: common\religions\00_religions.txt will be split into individual files per religion group. We'll likely do the same with common\cultures\00_cultures.txt.
 
  • 1Like
Reactions:
Well, you have my full support. Actually, do you need any extra pair of hand to contribute?

Also, seeing the commits is great to see how the progress advances, but it'd be nicer to keep a record of what files are done. something like "Y of Y event files done; W of Z decison files done; etc."

Any help is much appreciated. Most of the work is still ahead - events.

As for decisions and events, we've yet to start on those. We'll likely go through them alphabetically, just as we've done with the common folder, for the most part. Note that CleanSlate.mod contains which common folders are fully done. We could include individual decision and event files there, if you prefer.
 
This looks like a really cool idea. I may contribute too if I have time. Looking at messy code is always painful.
Any help is absolutely appreciated! Just send me a message later if you'd like to help and I can get the permissions set up.
 
Time for a progress update:

All script found in the common folder has been carefully rewritten and re-organised to be more readable, and more efficient in execution by reduced scoping, reduced use of triggers and usage of all additions to the scripting language that were barely used, if at all. In total, this entails over 400.000 lines of code processed. Any new bugs found during testing were also squashed and so far the game runs very smoothly with this maintenance work done.

Several large and unwieldy files have been split into smaller sizes, so that you can find what you're looking for much more quickly. Among these files are cultures, religions and all the scripted macros (triggers, effects and score values), as well as succession voting. Several more may follow at a later date. Of note is a particularly bad system of triggers and effects used in various religion conversion events. Over 4500 lines in total, it has been replaced by less than 100 lines in total. The new solution is both much easier to read and maintain, it should also be a lot faster in execution. It has been tested to work perfectly so far.

Additionally, almost all of the game's localisation files have been neatly sorted by category, instead of by DLC and patch number. It's now much easier to find something you want to change, instead of a directionless search through 123 files. The new files count roughly 100.

Work has started on decisions, with events to follow afterwards. This is the bulk of the workload and will take some time to process fully. Any help from experienced coders/scripters is appreciated.
 
Last edited:
  • 1Love
Reactions:
Time for a progress update:

All script found in the common folder has been carefully rewritten and re-organised to be more readable, and more efficient in execution by reduced scoping, reduced use of triggers and usage of all additions to the scripting language that were barely used, if at all. In total, this entails over 400.000 lines of code processed. Any new bugs found during testing were also squashed and so far the game runs very smoothly with this maintenance work done.

Several large and unwieldy files have been split into smaller sizes, so that you can find what you're looking for much more quickly. Among these files are cultures, religions and all the scripted macros (triggers, effects and score values), as well as succession voting. Several more may follow at a later date. Of note is a particularly bad system of triggers and effects used in various religion conversion events. Over 4500 lines in total, it has been replaced by less than 100 lines in total. The new solution is both much easier to read and maintain, it should also be a lot faster in execution. It has been tested to work perfectly so far.

Additionally, almost all of the game's localisation files have been neatly sorted by category, instead of by DLC and patch number. It's now much easier to find something you want to change, instead of a directionless search through 123 files. The new files count roughly 100.

Work has started on decisions, with events to follow afterwards. This is the bulk of the workload and will take some time to process fully. Any help from experienced coders/scripters is appreciated.

Jesus, talk about inefficiency... Your work is seen and appreciated :)
 
"It will not be compatible with any other mod not explicitly made to build off of it"
Will it have any effect on mods which do not edit vanilla files? For example mine uses some vanilla triggers, events and localisation, amoungst others. So, are all the names remaining the same? Will there still be all the existing triggers/events/etc - just cleaned up?
 
"It will not be compatible with any other mod not explicitly made to build off of it"
Will it have any effect on mods which do not edit vanilla files? For example mine uses some vanilla triggers, events and localisation, amoungst others. So, are all the names remaining the same? Will there still be all the existing triggers/events/etc - just cleaned up?

Most names will remain the same, some effects and triggers will be removed. It should be easy to make it compatible. We will provide a full list of significant changes, which will of course include a list of removed or otherwise adjusted scripted triggers and effects.
 
Last edited:
  • 1
Reactions:
As a modding hook, could you please change the graphical culture for the Eastern Christian religions to 'easterngfx'. This enables changes like adding Orthodox councillors to the other heresies and branches. The ability to make compatible overrides for religions got lost in the 3.x patch, so this will nice to settle in a central spot. The religion group will still fallback to westerngfx for normal use.
 
As a modding hook, could you please change the graphical culture for the Eastern Christian religions to 'easterngfx'. This enables changes like adding Orthodox councillors to the other heresies and branches. The ability to make compatible overrides for religions got lost in the 3.x patch, so this will nice to settle in a central spot. The religion group will still fallback to westerngfx for normal use.
I'll play around with it a bit. Might require more work than it sounds like but could be worth it.

EDIT: Done. In addition to this change, I also made Miaphysite (and monophysite) use africangfx and Nestorian (and Messalian) use persiangfx.
 
Last edited:
  • 1Like
Reactions:
I'll play around with it a bit. Might require more work than it sounds like but could be worth it.

EDIT: Done. In addition to this change, I also made Miaphysite (and monophysite) use africangfx and Nestorian (and Messalian) use persiangfx.
Thanks for the inclusion. Though africangfx and persiangfx aren't great options, since these are used already for pagan and Zoroastrian religions.
 
Thanks for the inclusion. Though africangfx and persiangfx aren't great options, since these are used already for pagan and Zoroastrian religions.
You're thinking of westafricangfx africangfx isn't used in any religion (though I'll double check tomorrow). So far as persiangfx I did a little research and visually Zoroastrian architecture and Nestorian architecture are very similar so it shouldn't be a problem. Unless I'm missing a use for those gfx types other than the gfx files?
 
You're thinking of westafricangfx africangfx isn't used in any religion (though I'll double check tomorrow). So far as persiangfx I did a little research and visually Zoroastrian architecture and Nestorian architecture are very similar so it shouldn't be a problem. Unless I'm missing a use for those gfx types other than the gfx files?
The religion graphical cultures are used for the map shields, the spiritual councillor and the temple icons, The other parts wouldn't match well. The mixup with Africans is an old error in the province icons file.