Flavor modding guide

Mepper’s general guide for M&T 3.0 flavor creation (v1):

One general remark that I would like to make is that it helps a lot to simply look at how things are coded in the 3.0 codebase and copy the used methods to achieve similar things. Monkey see monkey do is a highly effective way of learning to write flavor for 3.0. E.g. if you want to code a disaster, take a look at some disaster files, and if you want to make an event chain try to find similar chains and adapt from those. Also, the Modding Section on the EU4 wiki is very helpful: https://eu4.paradoxwikis.com/Modding The only thing to keep in mind is that effects that give “magic” money/manpower/development are all banned. Using on_actions

Due to performance concerns we try to trigger most events from on_actions if possible. They are to be found in common/on_actions/00_on_actions.txt. For those who are not familiar with on_actions, they are basically a set of triggers which if fulfilled trigger events included in them. There are on_actions for all kinds of different things in the game. A few examples would be:

on_startup on_monarch_death on_new_heir

These are fairly self-explanatory. If you want to e.g. fire an event which should happen after the death of a monarch, put it in the on_monarch_death on_actions, inside the events = {}. Then set your event to be is_triggered_only, give it a MTTH of 1 day, and make the trigger in such a way that it only happens when you want it to happen. Using on_actions is much cheaper on performance than triggering events with mean_time_to_happen and should therefore always be preferred.

For random events best use the pulse on_actions, e.g.: on_five_year_pulse. This simply triggers the events inside its events = {} every five years. Now you can also put a random_list inside, like this:

random_events = { 50 = Plague_Spawner.1 50 = 0 }

This way every five years there is a 50% chance that a that the Plague_Spawner.1 event is fired. You can use this to create custom chances every five years that certain events are fired, which is excellent for random flavor events. This method to fire random events is much cheaper than using long MTTHs.

General remark on the use of MTTH:

The shorter they are, the better. If in years, use years instead of months.

List of custom scripted_effects to use in 3.0 content creation

Changing stability: Stab_Add[value] or Stab_Subtract[value] E.g.: Stab_Add50Percent = yes Stab_Add1 = yes Stab_Subtract50Percent = yes Stab_Subtract3 = yes Moving capital: Effect_set_capital = { target = [prov ID] } E.g.: Effect_set_capital = { target = 217 } Adding event-based unrest to a province: In province scope, just do add_unrest = [value]. Then add a province modifier from common/event_modifiers/MND_Rebels.txt. In this file I defined quite a few types of unrest. Almost all these work on 3.0 systems, for which a custom tooltip is needed to display their effects. These tooltips can be found in localisation/MND_l_english.yml. Example: add_province_modifier = { name = "nobles_organizing" duration = 1825 }	custom_tooltip = nobles_organizing_tt add_unrest = 5 }

Adding event-based advisors:

M&T 3.0 uses Vanilla advisors with altered effects, and each advisor is aligned to a faction. Many advisors only exist for specific factions. The M&T advisors can be found in the common/advisortypes folder, in the 00_[Faction]_advisors.txt files. Only these advisors should be created. E.g. “statesman” no longer exists, now use for instance: type = statesman_NO to create a statesman aligned with the Nobles. Boosting factions: To give or subtract influence for factions in your government, use this effect: FC_Boost = { Faction = NO Value = 20 } The example uses NO (Nobles}, but otherwise use TR (Tribals), BU (Bureaucracy), BG (Burghers), CL (Clergy). Just make the value negative and it will subtract. Changing elite’s loyalty: To add or subtract country wide elite loyalty (so it effects every province) use this effect: Public_ChangePowerbrokerLoyaltyTooltipProv = { Powerbroker = NO Amount = 10 } The example uses NO (Nobles}, but otherwise use TR (Tribals), BU (Bureaucracy), BG (Burghers), CL (Clergy). Just make the value negative and it will subtract. Changing government type: To change government type there is custom scripted_effects, found in common/scripted_effects/SYS-API.txt. They are the Pol_ChangeGov[Govtype] effects. E.g. (from SYS-API): Pol_ChangeGovRepublic = { change_government = republic add_government_reform = Pol_Mandate$Mandate$ add_government_reform = Pol_Stylings$Stylings$ add_government_reform = Pol_ExtraPowers$ExtraPowers$ add_government_reform = Pol_Assembly$Assembly$ add_government_reform = Pol_TermOfOffice$TermOfOffice$ Pol_SetGovernmentHelper1 = yes ## Nobility Pol_SetGovernmentHelper2 = yes ## Core add_government_reform = Pol_Privileges1 [[SpecialArrangement]        add_government_reform = $SpecialArrangement$        remove_government_reform = Pol_Privileges1    ] }

Everything surrounded with Dollar signs needs a value. So e.g. taken from an event: DNZ = { Pol_ChangeGovRepublic = { Mandate=1 Stylings=1 ExtraPowers=1 Assembly=2 TermOfOffice=5 } add_government_reform = Pol_Nobility2 } What government reforms are which value can be found in the common/government_reforms folder. 01_government_reforms_common is used for each government type, the rest are specific to each government type. I highly recommend when you want to change a government type to use the monkey see monkey do method and look for events or decisions which change a certain government to a similar one that you would like to create. Using the 3.0 API

To directly influence 3.0 systems there is a custom API file, common/scripted_effects/SYS-API.txt. In this file a lot of modifiers can be triggered to occur in either country or province scope. There are way too many of these to give an explanation on all of them, but best use the unparsed¬ version of the mod and ctrl+f roughly what you want and glance through the results you get. There are a lot of comments in the file explaining what these effects do, and I would highly recommend you look through at least some effects and their comments.

Inside the API effect groups you want to use you basically set a trigger condition for an effect with your specific parameters set. This can either be done with an if clause, or preferably trigger_switch (which is like an exclusive if clause, only one of the triggers can fire in the same scope).

An example of this would be:

trigger_switch = { on_trigger = has_idea teutonic_order_ideas_5 = { change_key = { lhs = Modi_MerchantFromTradeCenter value = 0.3 } }	[More ideas…] }

So, if you have the fifth Idea of the Teutons unlocked you will get 30% extra merchants from trade centers. Note that since this is not a Vanilla effects, the localisation in-game has to be made custom. Do this like so:

teutonic_order_ideas_5: "Germanic Merchants" teutonic_order_ideas_5_desc: "Our Order has a lengthy history of trade and support within the Hanseatic League and Empire. There is no clearer example than Konigsberg, a member of the Hansa since 1340. We owe much of our success to the Imperial coin that flows through our cities.\nMerchants from Trade Centers: §G+30.0%§!" The last line create a new line and simply writes out the modifier with the value in a custom color (G for green, Y for Yellow, R for red). To color a block of localisation, start with §[Color code (e.g. R or G)] and end with §!.

If you want to apply a custom effect a country or province from let’s say an event, you can’t fire them directly from the SYS-API file, as these are modifiers, not effects. So instead create an event_modifier and trigger the API modifier with having the event_modifier.