Jump to content
TheUniT

Resource Groups - How do they work?

Recommended Posts

 

TL;DR below, the rest is for context.

 

So I've been trying to create a mod pack I can install whenever I feel like playing LSPDFR, and because LML allows for easy installation of addon vehicles and their meta entries, my aim is to create the entire pack using just LML.

 

At first I didn't care about structuring it, just tick all the boxes and play. But because I'm intending to share it with friends who can't be arsed to fiddle with mods but still want to play LSPDFR, I thought I should put some structure in.

 

Spoiler

Resource Groups

One of the newer features in LML are resources groups, mostly intended for more complicated mods. These groups allow you to group (!) multiple resources to make it easy for the user to disable them. That way you can ship different variations or features of your mod and allow the user to simply enable and disable those depending on their preferences. These groups including their associated resources are visible in the Mod Manager. Consider the following example:

 


<ResourceGroups>
	<ResourceGroup name="Essentials" scriptName="essentials" required="true">
		<Description>Contains all essentiall files to run your mod</Description>
		<Resources>
			<Resource>vehicles</Resource>
			<Resource>peds</Resource>
			<Resource>boats</Resource>
		</Resources>
	</ResourceGroup>
	<ResourceGroup name="New Model Sets" scriptName="modelsets" disabledByDefault="true">
		<Description>Replace game model sets with our new custom models</Description>
		<Resources>
			<Resource>modelsets</Resource>
		</Resources>
	</ResourceGroup>
</ResourceGroups>

 

As you can see, there are a few attributes that can be used on groups. The required attribute prevents the user from disabling this resource group so that it is always loaded. The disabledByDefault tag gets parsed when the mod is first downloaded or installed and will automatically disable this group. It can then be enabled by the user at any time. To uniquely identify a resource group, the scriptName attribute is used. For the UI name the name attribute is used together with the Description tag.

 

This is obviously taken from the LML Wiki page, and what @LMS described here sounds like what I'm trying to do. A simple example of where I would be using this is a materials.dat mod. One setting is to make grip on regular roads more realistic, and one setting is for snow. As there are two separate materials.dat files for it, I want only one to be (able to be) loaded (so I don't get silly questions by said friends).

Though, if at some point I'm confident with using this, I would like to have the entire pack be displayed as a single mod in the manager with the Replacement and Addon Vehicle folders being marked as required, and everything else (like sound mods, graphics mods, which I have already done too) being optional.

 

TL;DR: What I don't understand is what these resources are. Where would you define them and their installation? Do you throw the ResourceGroups into the install.xml alongside the installation instructions themselves?


Logging in...

Launching game...

Error launching game: Cannot load while loading. Please log out and retry.

Logging out...

Error logging out. You are not logged in. You need to be logged in to log out. Please log in to log out.

Share this post


Link to post
Share on other sites

Resources are everything with an Addon, Replacement and Resource tag. Their name is indicated by the script name. Groups support tags for what you want, such as "isRequired" and "disabledByDefault". The example below shows how a resource is referenced from a group. Note that you can also use the Mod Manager to browse your mod and see how it parses it to understand if you have set up everything the way you want it.

<ResourceGroups>
    <ResourceGroup name="Descriptive Name" scriptName="myGroup" disabledByDefault="true">
        <Description>Installs a certain file</Description>
        <Resources>
            <Resource>myResource</Resource>
        </Resources>
    </ResourceGroup>
</ResourceGroups>

<Addons>
    <Addon name="My Variations" scriptName="myResource">
        <DataFile>carvariations.meta</DataFile>
    </Addon>
</Addons>

 


Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Share this post


Link to post
Share on other sites
45 minutes ago, LMS said:

Resources are everything with an Addon, Replacement and Resource tag. Their name is indicated by the script name. Groups support tags for what you want, such as "isRequired" and "disabledByDefault". The example below shows how a resource is referenced from a group. Note that you can also use the Mod Manager to browse your mod and see how it parses it to understand if you have set up everything the way you want it.


<ResourceGroups>
    <ResourceGroup name="Descriptive Name" scriptName="myGroup" disabledByDefault="true">
        <Description>Installs a certain file</Description>
        <Resources>
            <Resource>myResource</Resource>
        </Resources>
    </ResourceGroup>
</ResourceGroups>

<Addons>
    <Addon name="myResource">
        <DataFile>carvariations.meta</DataFile>
    </Addon>
</Addons>

 

Thank you! It looks lovely. Now my issue is that below my created groups it shows that there are 92 ungrouped files that are being loaded. Though I'm sure I've grouped all of my resources. Is there a way to find out which files it's detecting?

Edit: So apparently it is loading all of my groups even though I disabled some of them for testing purposes.

Oh, and one more thing, I think it would be nice if there were drop-down fields that allow you to chose between a set of defined items. Right now, as for my handling mod example, the player can check both boxes, which wouldn't work/isn't intended as they modify the same file.


Logging in...

Launching game...

Error launching game: Cannot load while loading. Please log out and retry.

Logging out...

Error logging out. You are not logged in. You need to be logged in to log out. Please log in to log out.

Share this post


Link to post
Share on other sites

I think that one is on me, it should be scriptName instead of name on the Addon example.

 

And no, currently you cannot see the files in each group, I hope to add that soon though. I also like the exclusivity feature, it needs to be implemented in XML though. So you would need to be able to specify that two groups cannot be enabled at the same time.


Please do not PM me unless really necessary (knowing you helps). If you think you need my attention in a topic, tag me.

Share this post


Link to post
Share on other sites
6 minutes ago, LMS said:

I think that one is on me, it should be scriptName instead of name on the Addon example.

Well, throughout the entire LML Wiki it says name. And just by moving the ResourceGroups above the Addons & Replacements in my install.xml, I got the "ungrouped files"-count from 92 to 54, for some reason. Anyway, that seems to have fixed it, thanks. 😄

 

6 minutes ago, LMS said:

I also like the exclusivity feature, it needs to be implemented in XML though. So you would need to be able to specify that two groups cannot be enabled at the same time.

Yup, that's exactly what I was thinking.


Logging in...

Launching game...

Error launching game: Cannot load while loading. Please log out and retry.

Logging out...

Error logging out. You are not logged in. You need to be logged in to log out. Please log in to log out.

Share this post


Link to post
Share on other sites

Check out the install.xml for for Coastal Callouts for a fairly complex example of how to use resource groups. I've attached a copy here for your convenience. 

 

For a more simple example, see how I set up the install.xml for my gameconfig LML package. https://github.com/pnwparksfan/gameconfig/blob/master/install.xml

install.xml


[REL] Coastal Callouts: An action-packed mod with new vehicles, maps, capabilities, and callouts in and around the waters of Los Santos

[REL] Police Tape: Make your scenes more realistic while stopping peds and traffic

[REL] Better EMS: Realistic and dynamic EMS response

Join the Parks Benefactor Program to support my work and get early beta access!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...