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

HowPow

Sergeant
51 Badges
Jul 6, 2012
59
68
  • Europa Universalis IV
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis III Complete
  • Cities: Skylines - Mass Transit
  • Cities: Skylines - Natural Disasters
  • Europa Universalis IV: Mandate of Heaven
  • Shadowrun Returns
  • Age of Wonders III
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mare Nostrum
  • Cities: Skylines - Green Cities
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Cities: Skylines - Parklife
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Dharma
  • Magicka: Wizard Wars Founder Wizard
  • Shadowrun: Dragonfall
  • Shadowrun: Hong Kong
  • Cities: Skylines Industries
  • Imperator: Rome
  • Cities: Skylines - Campus
  • Imperator: Rome - Magna Graecia
  • Crusader Kings III
  • Europa Universalis 4: Emperor
  • Victoria 3 Sign Up
  • Victoria: Revolutions
  • Crusader Kings II
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Europa Universalis III
  • Europa Universalis III: Chronicles
  • Divine Wind
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Call to arms event
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV: Cossacks
  • Victoria 2
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • 500k Club
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: El Dorado
  • Cities in Motion
  • Europa Universalis IV: Common Sense
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:
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:
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:
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?
 
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.