• Victoria 3 - Sign up now!

    The journey begins, sign up now and get a special in-game item when the game is released.


  • Crusader Kings III Available Now!

    The realm rejoices as Paradox Interactive announces the launch of Crusader Kings III, the latest entry in the publisher’s grand strategy role-playing game franchise. Advisors may now jockey for positions of influence and adversaries should save their schemes for another day, because on this day Crusader Kings III can be purchased on Steam, the Paradox Store, and other major online retailers.


    Real Strategy Requires Cunning
  • Crusader Kings II Expansion Subscription

    Subscribe to the CK II Expansion and enjoy unlimited access to 13 major expansions and more!


HowPow

Corporal
8 Badges
Jul 6, 2012
44
10
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • 500k Club
In this thread, I want to report all my struggles, failings, successes, roadbloacks, and things I don't understand when creating my very first mod from scratch. I am neither coder nor experienced modder and will entirely depend on the guides on this forum and on the wiki. The goal is to have a sort of "modding for dummies" pseudo-guide for extreme newcomers like me, and also to have my own questions answered for the benefit of those that might have the same.


1) First steps

Like the Wiki says, first of we create a mod through the Paradox launcher. My goal is to create some flavour events for Gadir, the two province minor in southern Spain. The Wiki says

Copy the game files you wish to mod to your newly created mod folder or create your own files, while using the same folder structure.

With the examples being a bit nebulous, I wanted to ask this forum: Since I am creating a new event, I have to replicate the location of the event folder from the original (vanilla) game?
The original location of the event folder is this:
Screenshot3.png

So my mod folder should look like this?
Screenshot2.png




2) First attempt at scripting
Here I follow the guides linked at the top of the forum closely. In the events folder in my mod directory, I copied a .txt document of one of the events in the original game, to keep the data formatting (BOMF-8 or something).

Screenshot4.png

At this point, I just replaced the name & titles & description, and added a trigger that fires if the player holds the territory of Gadir. Later on I should probably make this event not fire immediately at game start but we are just learning to walk here. I also copied the part with "immediate" and "limit" from the example event in the guide. Not sure if I need this since the event just checks if you have the territory and nothing random happens.

I also saved this as a scope, to (somehow?) make it my ROOT scope later on. What is curious is that I used that scope already in line 12 as the goto_location, but only defined it (told the program it exists) in line 22. Will this work? Or do I need to define the scope first before using it?




3) Adding options
Historically, the city of Gadir was known for its production of Garum, a fish sauce made of fermenting fish. This event shall be about the smell of fermenting fish affecting the local inhabitants. The guide mentions adding modifiers, but talks about directly writing in your own game files. Since we want to share this mod on steam, I guess it should probably be saved in its own folder? Could someone confirm if my mod folder should look like this right now?
Screenshot5.png

However, the path for the modifiers folder in the original game is: C:\Program Files (x86)\Steam\steamapps\common\ImperatorRome\game\common\modifiers . So should I add another "common" folder and put the modifiers folder inside it?


I would be very happy for your help and if you like this idea of an AAR or not. If it goes against forum rules, feel free to delete.
 
Last edited:
  • 1Like
Reactions:

Idhrendur

Keeper of the Converters
103 Badges
Feb 27, 2009
10.361
1.619
  • Crusader Kings II
  • Sengoku
  • Pillars of Eternity
  • Tyranny: Archon Edition
  • Europa Universalis IV
  • March of the Eagles
  • Victoria 2
  • 500k Club
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Colonel
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Crusader Kings III: Royal Edition
  • Commander: Conquest of the Americas
  • Darkest Hour
I'm hardly an expert at modding, but I like this idea.

1) That looks correct to me, and matches what I see other mods doing.
2) I'm not sure on any of this. But ideally that should be enough to make an event pop up and you can iterate from there.
3) Yes, you'll need to create common and put modifiers inside it.

Also, I'm a bug advocate of taking a little time to learn to use git for projects like this. You don't have to host it on github or anything, but it allows you to snapshot your work when its in known good states, so you can feel free to experiment because its easy to roll back to a snapshot.
 
  • 1Like
Reactions:

HowPow

Corporal
8 Badges
Jul 6, 2012
44
10
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • 500k Club
Thank you for your help! It was great and aided me a lot.

So the event should check if you own the territory of Gadir, then add a modifier. My code looks like this:

Code:
namespace = Gadir_Production


#Production smells
Gadir_production.1 = {
    type = province_event
    title = "Gadir_production.1.t"    #Localization Key - Title of Event
    desc = "Gadir_production.1.desc"     #Localization Key - Description of Event
    picture = great_city
    goto_location = scope:gadir_territory

    trigger = {
        owns = 1344
    }

    immediate = {
        limit = {
            owns = 1344
        }
        save_scope_as = gadir_territory
    }



    option = {                                                 # EFFECT FIELD - FIRST OPTION - Options the player can choose between when receiving the event
        name = Gadir_production.1.a              # LOCALIZATION KEY - Option A text
        scope:gadir_territory = {                      # SAVED SCOPE - Find affected city
               add_province_modifier = {            # EFFECT - Add a province modifier to the saved scope
            name = GadirMod_Fish_stinks_all_unhappyness_modifier                             # SPECIAL FIELD - Find the modifier to add
          
            }
        }
    }
}

This event at the moment has only one option - this way it should de facto be a simple popup that shows you text and adds a modifier on the territory.

To make the modifier, we make a new folder, and create a .txt file in there. To all newcomers like me that might read this, it helps immensely to click through the folder structure of the vanilla game and to recreate the folder structure in your mod folder. Copy the relevant .txt files, in our case it could be C:\Program Files (x86)\Steam\steamapps\common\ImperatorRome\game\common\modifiers\00_from_events_province.txt , into your mod folder, rename it, delete the old entries, and write your own.

I followed the guide: We need folders and text files for the event code, the modifiers, the localization of both event text that you see in the popup and the mouse-over text of the modifier icon, and how often the event procs. My folder structure now looks like this:

File structure image.png


Did I forget anything?

Now the next step is testing my code. I know there is a command that you can make an event fire, in the console commands section of the wiki there is
event [eventid][target]Triggers event for specified character/province/country.
But how do I know my event ID? And do I need to copy paste my own .txt files into the vanilla game folders or can I already enable my own mod from the launcher?

Thanks for reading!
 
Last edited:
  • 1
Reactions:

Idhrendur

Keeper of the Converters
103 Badges
Feb 27, 2009
10.361
1.619
  • Crusader Kings II
  • Sengoku
  • Pillars of Eternity
  • Tyranny: Archon Edition
  • Europa Universalis IV
  • March of the Eagles
  • Victoria 2
  • 500k Club
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Colonel
  • Shadowrun Returns
  • Imperator: Rome Deluxe Edition
  • Crusader Kings III: Royal Edition
  • Commander: Conquest of the Americas
  • Darkest Hour
Thanks for another update. We're moving even further into territory I don't know about, but that file structure looks correct. You should be able to enable your mod already, too. I'm not sure about the eventid though. With any luck it's just Gadir_production.1 or Gadir_Production.Gadir_production.1, but I'm not sure. Have you tried the command with vanilla Imperator events to get a feel for how it works?
 

Sobisonator

Imperatrix: Victoria lead dev
76 Badges
Jun 19, 2011
371
601
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Rome Gold
  • Semper Fi
  • Sengoku
  • Supreme Ruler 2020
  • Supreme Ruler: Cold War
  • Stellaris: Apocalypse
  • Victoria 2: A House Divided
  • Crusader Kings II: Charlemagne
  • Rome: Vae Victis
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Monks and Mystics
  • Knights of Honor
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris - Path to Destruction bundle
  • Europa Universalis III
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II
  • 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 Complete
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • For The Glory
  • For the Motherland
  • Hearts of Iron III
  • Heir to the Throne
  • Crusader Kings II: Reapers Due
  • Hearts of Iron IV: Field Marshal
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Cadet
  • Crusader Kings III: Royal Edition
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Pride of Nations
  • Europa Universalis IV
This is a really great idea, it will help us to identify the missing pieces in our community documentation and open up some conversations about mod management.

Anyone who wants to talk about modding, please join us on the modding discord: https://discord.gg/SGbndVQKD3
It's an active community and we're always keen to help and pad out documentation for modders.