Add Store Categories V1.0.0.1

Add Store Categories v1.0

Script that allows you to add custom categories to vehicle and construction stores. Script is built into your mod and you set the name and icon for your category by yourself.
Instructions for Adding Your Category in moddesk.xml

Open the moddesk.xml file:
Use a text editor (such as Notepad++ or Visual Studio Code) to open the moddesk.xml file located in your mod’s folder.

Adding the <extraSourceFiles> section:
Ensure that your file contains the <extraSourceFiles> section. If it does not exist, add the following code before the closing </modDesc> tag:

<extraSourceFiles>
<sourceFile filename=”addStoreCategory.lua” />
</extraSourceFiles>

Adding the <storeCategories> and <constructionCategories> sections:
You need to add the <storeCategories> and <constructionCategories> sections to the file if they do not already exist. Insert the following code before the closing </modDesc> tag:

<storeCategories>
<!– Your categories will go here –>
</storeCategories>

<constructionCategories>
<!– Your construction categories will go here –>
</constructionCategories>

Adding a new category in <storeCategories>:
Inside the <storeCategories> section, add your category using the following template:

<storeCategory type=”YOUR_CATEGORY_TYPE” name=”YOUR_STORECATEGORY_NAME” title=”Your Title” image=”path/to/image.png”/>
Replace YOUR_CATEGORY_TYPE with the category type (e.g., DRIVABLES, TRAILERS, etc.), YOUR_STORECATEGORY_NAME with a unique name for your category, Your Title with the name that will be displayed in the game, and path/to/image.png with the path to the image for your category.
Example:

<storeCategory type=”MISC” name=”my_custom_category” title=”My Custom Category” image=”my_custom_image.png”/>

Adding a new category in <constructionCategories> (if necessary):
Inside the <constructionCategories> section, add your construction category using a similar template:

<constructionCategory type=”YOUR_CONSTRUCTION_TYPE” name=”YOUR_CONSTRUCTIONCATEGORY_NAME” title=”Your Title”/>
Replace YOUR_CONSTRUCTION_TYPE with the category type (e.g., buildings, production, etc.), YOUR_CONSTRUCTIONCATEGORY_NAME with a unique name for your construction category, and Your Title with the name that will be displayed in the game.
Example:

<constructionCategory type=”buildings” name=”my_custom_building_category” title=”My Custom Building Category”/>

Save the changes:
After making all the changes, save the moddesk.xml file.

Testing in the game:
Launch the game and check if your new category appears in the store and construction menu.
Ensure that all items are displayed correctly and function without errors.

Debugging (if necessary):
If your category does not appear, check the console for errors. Make sure that all category and item names are spelled correctly and do not contain typos.

Conclusion
Now you know how to add your category in moddesk.xml for Farming Simulator 25. If you have any further questions or issues, feel free to ask for help!

Changelog:

V1.0.0.1

– Now you can add your storeType for vehicles and constructionType for placeables;

Credits:

Average Enjoyer

 

Rate this post

Download mod

File File size
zip addStoreCategories_V1_0_0_1 9 KB

You may also like...

Subscribe
Notify of
guest
4 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
imtryinghere

using this mod, it works after the first item set you get an error in your log saying that the category is already created. so each time you add the stuff to each items modDesc. it tries to add the new category again. giving you the error.

dtapgaming

Only for Store Items not for Placeables AKA constructionCategory 

dtapgaming

multiple mods adding the same constructionCategory make more then one but only place the mods in the first one created leaving a lot of extra tabs that are blank

dtapgaming

    
  — Load construction categories and check for duplicates
  for _, key in xmlFile:iterator(“modDesc.constructionCategories.constructionCategory”) do
      local categoryName = xmlFile:getString(key .. “#type”)
     
    — Check if a construction category with the same type and name already exists
    local categoryExists = false
    for _, existingCategory in ipairs(g_storeManager.constructionCategories) do
      if existingCategory.name == categoryName then
        categoryExists = true
        break
      end
    end
     
    — If the category doesn’t exist, add it to the store manager
    if not categoryExists then
      local defaultIconFilename = “dataS/menu/construction/ui_construction_icons.png”
–rest of code

if you want it this was my fix for my private mods

4
0
Would love your thoughts, please comment.x
()
x