Difference between revisions of "HPL3/Resources Configuration"

From Frictional Wiki
Jump to navigation Jump to search
(Created page with "Every HPL3 mod needs to point out all of the resources that are to be used in the mod. Resources are essentially collections of folders and files which are going to be used by...")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
{{shortPageTitle}}
 
Every HPL3 mod needs to point out all of the resources that are to be used in the mod. Resources are essentially collections of folders and files which are going to be used by the mod. For example: 3D Models, Scripts, Audio, Textures, etc.
 
Every HPL3 mod needs to point out all of the resources that are to be used in the mod. Resources are essentially collections of folders and files which are going to be used by the mod. For example: 3D Models, Scripts, Audio, Textures, etc.
 
This article explains how to configure the resources for a mod.
 
This article explains how to configure the resources for a mod.
 +
 +
{{Tip|It is recommended to use the [https://wiki.frictionalgames.com/page/HPL3/Third_Party_Tools/HPL3_Mod_Manager HPL3 Mod Manager] to configure everything that is listed on this page.}}<br />
  
 
==Resources Configuration File==
 
==Resources Configuration File==
In order to make the mod load our resources / assets, we need to list where exactly those resources are located. All of the resources for the mod are listed inside a single XML file, called <code>resources.cfg</code>. The file should be located inside the main mod folder.
+
In order to make the mod load our assets and maps, we need to list where exactly those resources are located. All of the resources for the mod are listed inside a single XML file, called <code>resources.cfg</code>. The file should be located inside the main mod folder.
  
 
The syntax for adding a resource directory is as follows:
 
The syntax for adding a resource directory is as follows:
Line 10: Line 13:
 
     <Directory Path="/FolderName" AddSubDirs="true" />
 
     <Directory Path="/FolderName" AddSubDirs="true" />
 
</Resources></syntaxhighlight>
 
</Resources></syntaxhighlight>
 +
{| class="wikitable"
 +
|Path
 +
|The relative path to the folder that contains the resources.
 +
|-
 +
|AddSubDirs
 +
|Whether to include sub-folders that are located inside the folder specified in <code>Path</code> as part of the resources or not (recursive). It is recommended to always set this to <code>true</code>.
 +
|}
 +
 +
{{note|The file lists directories in which the resources are located at in the form of relative path to the mod. That means you do not need to provide a full path for the folder.}}
  
'''Path''' - The relative path to the folder that contains the resources.<br>
+
===Example===
'''AddSubDirs''' - Whether to include sub-folders that are located inside the folder specified in <code>Path</code> as part of the resources or not. It is recommended to always set this to <code>true</code>.
+
Given the following mod structure:
 +
<syntaxhighlight lang="css">
 +
modFolder/
 +
├── config/
 +
│  ├── lang/
 +
│  │  ├── english.lang
 +
│  ├── main_init.cfg
 +
├── maps/
 +
├── script/
 +
├── static_objects/
 +
├── entry.hpc
 +
├── resources.cfg
 +
</syntaxhighlight>
 +
The resources file will look like this:
 +
<syntaxhighlight lang="xml">
 +
<Resources>
 +
    <Directory Path="/config" AddSubDirs="true" />
 +
    <Directory Path="/maps" AddSubDirs="true" />
 +
    <Directory Path="/script" AddSubDirs="true" />
 +
    <Directory Path="/static_objects" AddSubDirs="true" />
 +
</Resources>
 +
</syntaxhighlight>
  
{{note|The file lists directories in which the resources are located at in the form of relative path to the mod. That means you do not need to provide a full path for the folder.}}
+
[[Category:Modding]]
 +
[[Category:English]]

Latest revision as of 14:29, 8 June 2023

Every HPL3 mod needs to point out all of the resources that are to be used in the mod. Resources are essentially collections of folders and files which are going to be used by the mod. For example: 3D Models, Scripts, Audio, Textures, etc. This article explains how to configure the resources for a mod.

Icon tip.png Tip: It is recommended to use the HPL3 Mod Manager to configure everything that is listed on this page.


Resources Configuration File

In order to make the mod load our assets and maps, we need to list where exactly those resources are located. All of the resources for the mod are listed inside a single XML file, called resources.cfg. The file should be located inside the main mod folder.

The syntax for adding a resource directory is as follows:

<Resources>
    <Directory Path="/FolderName" AddSubDirs="true" />
</Resources>
Path The relative path to the folder that contains the resources.
AddSubDirs Whether to include sub-folders that are located inside the folder specified in Path as part of the resources or not (recursive). It is recommended to always set this to true.
Note icon.png The file lists directories in which the resources are located at in the form of relative path to the mod. That means you do not need to provide a full path for the folder.

Example

Given the following mod structure:

modFolder/
├── config/
   ├── lang/
      ├── english.lang
   ├── main_init.cfg
├── maps/
├── script/
├── static_objects/
├── entry.hpc
├── resources.cfg

The resources file will look like this:

<Resources>
    <Directory Path="/config" AddSubDirs="true" />
    <Directory Path="/maps" AddSubDirs="true" />
    <Directory Path="/script" AddSubDirs="true" />
    <Directory Path="/static_objects" AddSubDirs="true" />
</Resources>