Jump to content

[mod] [Rimworld] Gender balancer


Recommended Posts

[Rimworld] Gender balancer

View File
This mod enables the re balancing of genders for non alien races.

 

Features:

  • Adds compProperties to re balance gender probabilities

 

Requirements:

  • none

 

Load order:

 

Installation:

  • Unpack the contents of the zip into "...steam/steamapps/common/rimworld/mods"
  • Activate the mod and put it above the races you want to patch, but below alien races, if you're using it.
  • Wait for the game to restart

 

Regarding alien races:

If you want to change the gender ration of a race using the alien race framework you do not need this mod.

You can use this mod only to change the gender ration of vanilla pawns or creatures added that do not use the alien races framework.

The alien races framework has an option to set the gender ratio already built in.

Spoiler

To re-balance an alien races race, you need to edit the <maleGenderProbability> value in the Alien race settings. Either directly or by creating a patch file.

You should find the settings in the mod folder in Defs/ThingDef_Race/raceName.xml it's possible that the XML is in a different folder, in that case, get searching.

As an example from the dragonian race


<Defs>
	<AlienRace.ThingDef_AlienRace ParentName="DR_PawnBase">
		<defName>Dragonian</defName>
		<label>Dragonian</label>
		<description>...</description>
			<alienRace>
				<generalSettings>
					<maleGenderProbability>0</maleGenderProbability>
					<useOnlyPawnkindBackstories>true</useOnlyPawnkindBackstories>
					<immuneToAge>true</immuneToAge>
					.
					.
					.
 

Change that value to something between 1 and 0 to set the desired ratio.

If the variable is not in the XML, add it.

 

 

 

How to balance a race:

There are 2 ways of re balancing the gender distribution of a race.

You can add the gender balance properties directly to the race you wish to balance or create a patch that automatically adds the properties for you.

 

To balance a race directly, find the race in your mods folder, it should be within the defs/thingDefs_races folder.

Open the file of the race you wish to balance in an editor.

I'll use the Impmother from the more monstergirls pack as an example.

Spoiler

<ThingDef ParentName="AnimalThingBase" ADogSaidBody="LegsArmsTail">
    <defName>Impmother</defName>
    <label>imp mother</label>
    <description>A demonic creature. Imps were developed by larger, more intelligent demons to serve as menial slaves. They have a very unusual lifespan, only reaching adulthood in the last 8 years of their life. However, an adult imp (called an impmother) produces offspring very rapidly and produces enough milk to make a cow blush. Their personalities are mischievous and they love attention, but they can become very attached to their mother or owner. They prefer hot climates.</description>
    <statBases>
      <MoveSpeed>4.70</MoveSpeed>
      <ComfyTemperatureMin>-15</ComfyTemperatureMin>
      <ComfyTemperatureMax>80</ComfyTemperatureMax>
      <MarketValue>300</MarketValue>
    </statBases>
    <comps>
      <li Class="CompProperties_Milkable">
        <milkDef>Milk</milkDef>
        <milkIntervalDays>1</milkIntervalDays>
        <milkAmount>24</milkAmount>
      </li>
    </comps>
    <tools>
      <li>
        <label>horn</label>
        <capacities>
          <li>Scratch</li>
          <li>Stab</li>
        </capacities>
        <power>11</power>
        .
        .
        .
  </ThingDef>

 

 

Check for the <comps> tag within the <ThingDef ParentName="AnimalThingBase"> tag, and insert the first snippet below into it and set the weights the way you want them.

If there is no <comps> tag. insert the second snippet into the ThingDef.

Spoiler

<li Class="GenderBalancer.GenderBalanceSettings">
	<maleGenderWeight>1</maleGenderWeight>
	<femaleGenderWeight>1</femaleGenderWeight>
	<noGenderWeight>0</noGenderWeight>
</li>



<comps>
	<li Class="GenderBalancer.GenderBalanceSettings">
		<maleGenderWeight>1</maleGenderWeight>
		<femaleGenderWeight>1</femaleGenderWeight>
		<noGenderWeight>0</noGenderWeight>
	</li>
</comps>

 

 

When you're done it should look like this.

Spoiler

<ThingDef ParentName="AnimalThingBase" ADogSaidBody="LegsArmsTail">
    <defName>Impmother</defName>
    <label>imp mother</label>
    <description>A demonic creature. Imps were developed by larger, more intelligent demons to serve as menial slaves. They have a very unusual lifespan, only reaching adulthood in the last 8 years of their life. However, an adult imp (called an impmother) produces offspring very rapidly and produces enough milk to make a cow blush. Their personalities are mischievous and they love attention, but they can become very attached to their mother or owner. They prefer hot climates.</description>
    <statBases>
      <MoveSpeed>4.70</MoveSpeed>
      <ComfyTemperatureMin>-15</ComfyTemperatureMin>
      <ComfyTemperatureMax>80</ComfyTemperatureMax>
      <MarketValue>300</MarketValue>
    </statBases>
    <comps>
      <li Class="CompProperties_Milkable">
        <milkDef>Milk</milkDef>
        <milkIntervalDays>1</milkIntervalDays>
        <milkAmount>24</milkAmount>
      </li>
	  <li Class="GenderBalancer.GenderBalanceSettings">
		<maleGenderWeight>1</maleGenderWeight>
		<femaleGenderWeight>1</femaleGenderWeight>
		<noGenderWeight>0</noGenderWeight>
	  </li>
    </comps>
    <tools>
      <li>
        <label>horn</label>
        <capacities>
          <li>Scratch</li>
          <li>Stab</li>
        </capacities>
        <power>11</power>
        .
        .
        .
  </ThingDef>

 

 

 

If you want to create a patch, you'll have to create a simple mod to enable it.

If you don't know how here is a quick and dirty way.

Simply create a copy of the GenderBalancer mod, give it a new name, go into the About folder and edit the About XML with your infos.

Move one folder up, delete the Assemblies folder and create a new folder called Patches.

folders.PNG.bff3107792157ee90926f679265e99c3.PNG

Open the patchExample.xml, copy and paste the entire operation block until you have enough for all species you wish to patch, and replace PATCH_SPECIES_DEF_NAME with the defName of the species you wish to patch, in this case it would be Impmother. It should look like this.

Spoiler

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<!-- Adds comps if not already part of that species, followed by the genderbalance comps class -->
	<Operation Class="PatchOperationConditional">
		<xpath>/Defs/ThingDef[defName="Impmother"]/comps</xpath>
		<nomatch Class="PatchOperationAdd">
			<xpath>/Defs/ThingDef[defName="Impmother"]</xpath>
			<value>
				<comps>
					<li Class="GenderBalancer.GenderBalanceSettings">
						<maleGenderWeight>1</maleGenderWeight>
						<femaleGenderWeight>1</femaleGenderWeight>
						<noGenderWeight>0</noGenderWeight>
					</li>
				</comps>
			</value>
		</nomatch>
		<match Class="PatchOperationAdd">
			<xpath>/Defs/ThingDef[defName="Impmother"]/comps</xpath>
			<value>
				<li Class="GenderBalancer.GenderBalanceSettings">
					<maleGenderWeight>1</maleGenderWeight>
					<femaleGenderWeight>1</femaleGenderWeight>
					<noGenderWeight>0</noGenderWeight>
				</li>
			</value>
		</match>
	</Operation>
</Patch>

 

 

Save it, rename it to your liking and move it into the patches folder.

Start Rimworld and enable your newly created patch.

 

 

Patches using this mod:

Genital support patch for lost forest

 

If you created your own patch comment or pm me and I'll add you to the list.

 

 

Known issues:

  • Does not work if placed above alien races in the load order

 

Error reporting/Suggestions:

Please let me know if you experience issues with this patch and feel free to suggest improvements/changes.


 

Link to comment
  • 1 month later...

This is in some sore need of better documentation right now. I wanted to use it to balance SOME males into Arachne but the issue comes from

 

"I don't know where I should be looking to add these comps"

"I don't know if that demo you have is ready to go or if it requires a certain name"

"Where's the goddamn imgur guide"

It's going to be really useful if it's understood, but I don't right now. I don't know what files I'm aiming to modify and how.

Link to comment
6 hours ago, reploidsham said:

This is in some sore need of better documentation right now. I wanted to use it to balance SOME males into Arachne but the issue comes from

 

"I don't know where I should be looking to add these comps"

"I don't know if that demo you have is ready to go or if it requires a certain name"

"Where's the goddamn imgur guide"

It's going to be really useful if it's understood, but I don't right now. I don't know what files I'm aiming to modify and how.

Can you send me a link to the arachne race you're trying to patch?

I wanted to create a tutorial using the lost forest as example, but that mod was removed from steam and thanks to auto updates, my mod folder.

Link to comment
1 hour ago, bearlyAlive said:

Can you send me a link to the arachne race you're trying to patch?

I wanted to create a tutorial using the lost forest as example, but that mod was removed from steam and thanks to auto updates, my mod folder.

 

for a some odd reason. My HDD still has that mod, the lost forest. I'm sad on what happen. I don't get why people remove their mod without any word or reason. I hate people do that.

 

I can pm you if you still want it. It's as it. I didn't touch or edit anything. 

 

 

since people remove mods for some odd reason without word, I usually set my rimworld update to "only update this game when I launch it" or on the steam settings under download. I usually set it to "update" in times When I go to sleep.

 

Plus Now I backup the rimworld mods from the workshop and copy it to my other hardrive just in case if it affects my gameplay.

 

Spoiler

6.thumb.png.1652834ec3329fb58e2da872b895b492.png7.thumb.png.0f1b805a4137b951dd14eda8a2e0d7ba.png

 

Link to comment
7 hours ago, Rogelio11 said:

 

for a some odd reason. My HDD still has that mod, the lost forest. I'm sad on what happen. I don't get why people remove their mod without any word or reason. I hate people do that.

 

I can pm you if you still want it. It's as it. I didn't touch or edit anything. 

 

 

since people remove mods for some odd reason without word, I usually set my rimworld update to "only update this game when I launch it" or on the steam settings under download. I usually set it to "update" in times When I go to sleep.

 

Plus Now I backup the rimworld mods from the workshop and copy it to my other hardrive just in case if it affects my gameplay.

 

  Hide contents

6.thumb.png.1652834ec3329fb58e2da872b895b492.png7.thumb.png.0f1b805a4137b951dd14eda8a2e0d7ba.png

 

Lost Forest author did not delete the data, but I don't understand why author rolled 3.0.1 back to 3.0.0.

Link to comment
On 6/23/2019 at 11:00 PM, reploidsham said:

This is in some sore need of better documentation right now. I wanted to use it to balance SOME males into Arachne but the issue comes from

 

"I don't know where I should be looking to add these comps"

"I don't know if that demo you have is ready to go or if it requires a certain name"

"Where's the goddamn imgur guide"

It's going to be really useful if it's understood, but I don't right now. I don't know what files I'm aiming to modify and how.

I added a more elaborate explanation on how to balance a race, I hope that it answers your questions.

Link to comment
10 hours ago, juste95 said:

I don't understand how this mod works.

 

I want a rimworld with 90 % or 100% male pawns. Is it possible to add a option menu, where I can change the percentage of male and female spawn pawns?

This is unfortunately the wrong mod for that. This merely enables patching for races that are not default in RW or added via the alien races mod.

Link to comment
13 hours ago, bearlyAlive said:

This is unfortunately the wrong mod for that. This merely enables patching for races that are not default in RW or added via the alien races mod.

Ah. Oh.

 

Okay, but thank you. Are you know the right mod for me? I cant find something on steam or ludeon...

Link to comment
12 minutes ago, juste95 said:

Is it a big thing to create this mod? I'm absolutly ungifted in things like modding :D

Hard to say, I had to do a teensy bit of C# programming to get it to work.

After a bit of thinking, it might be possible to balance regular pawns with this mod, I haven't actually tested it with vanilla pawns.

I'll try tomorrow and see how much I mess up.

Link to comment
9 minutes ago, bearlyAlive said:

Hard to say, I had to do a teensy bit of C# programming to get it to work.

After a bit of thinking, it might be possible to balance regular pawns with this mod, I haven't actually tested it with vanilla pawns.

I'll try tomorrow and see how much I mess up.

Thank you!

Link to comment
10 hours ago, juste95 said:

Is it a big thing to create this mod? I'm absolutly ungifted in things like modding :D

I tried creating a patch for human pawns and it works quite well.

Since you're unexperienced in mod creation, could you try and create a patch by yourself, with the steps provided in the first post and tell me if anything is unclear?

Link to comment
10 minutes ago, Narlicious said:

Does this work with a custom animal race? Like, could I make a race of wolves that is always male?

Yes! That is exactly the purpose of this mod. You just need to add the genderBalancer settings to the comps of the species you wish to rebalance.

I wrote a little guide on how to accomplish that in the description of this mod.

Link to comment

That's awesome. I tried to put together a pair of custom races a while back, with one being humanoid that were always female and the other being canines that were always male, but I couldn't figure out how to do the male part of the pair. This really helps me out!

Link to comment
  • 3 weeks later...
On 7/3/2019 at 6:58 AM, bearlyAlive said:

I tried creating a patch for human pawns and it works quite well.

Since you're unexperienced in mod creation, could you try and create a patch by yourself, with the steps provided in the first post and tell me if anything is unclear?

Hello! Sorry for the late answer. I tried it and it works! Thank you!

Link to comment
  • 2 weeks later...

Hello, I've also attempted to do as juste95 did but it did not work for me. I've gone over the instructions many times and I believe I followed them exactly: delete Assemblies, make new folder named Patches, copy patchExample.xml into it, edit the race name (to "Human"), and edit the about.xml. Here are the errors I got:

Could not find type named GenderBalancer.GenderBalanceSettings from node <li Class="GenderBalancer.GenderBalanceSettings"><maleGenderWeight>1</maleGenderWeight><femaleGenderWeight>0</femaleGenderWeight><noGenderWeight>0</noGenderWeight></li>

XML error: <maleGenderWeight>1</maleGenderWeight> doesn't correspond to any field in type CompProperties. Context: <li Class="GenderBalancer.GenderBalanceSettings"><maleGenderWeight>1</maleGenderWeight><femaleGenderWeight>0</femaleGenderWeight><noGenderWeight>0</noGenderWeight></li>

XML error: <femaleGenderWeight>0</femaleGenderWeight> doesn't correspond to any field in type CompProperties. Context: <li Class="GenderBalancer.GenderBalanceSettings"><maleGenderWeight>1</maleGenderWeight><femaleGenderWeight>0</femaleGenderWeight><noGenderWeight>0</noGenderWeight></li>

XML error: <noGenderWeight>0</noGenderWeight> doesn't correspond to any field in type CompProperties. Context: <li Class="GenderBalancer.GenderBalanceSettings"><maleGenderWeight>1</maleGenderWeight><femaleGenderWeight>0</femaleGenderWeight><noGenderWeight>0</noGenderWeight></li>

For error checking, I copy-pasted the Impmother example, and it's identical to mine (except for the "Impmother" part). I'm a beginner with programming and RimWorld modding is extremely overwhelming for me, I completely failed to understand it every time I attempted. I have absolutely no idea what's going on in the slightest.

Link to comment
15 hours ago, bearlyAlive said:

@Alkerae Did you install and activate the gender balancer mod?

I did not, for whatever reason I presumed this was something to be edited into other mods and that it wasn't a mod in itself. Doing so fixed it... although curiously, I had to load my custom folder before the main gender balancer mod, or it still throws those errors. Weird, but it works now. Thank you.

Link to comment
  • 3 weeks later...

Having an issue here. I did everything as you instructed for the patch. And while it worked for the basic core game Human pawns it doesn't work for any of the alien races.

I have no idea just what I'm doing wrong since I followed the instructions enough to get Humans working, but none of the alien races work. And I'm fairly sure the patch code is accurate: 

Spoiler

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<!-- Adds comps if not already part of that species, followed by the genderbalance comps class -->
    <Operation Class="PatchOperationConditional">
        <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]/comps</xpath>
        <nomatch Class="PatchOperationAdd">
            <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]</xpath>
            <value>
                <comps>
                    <li Class="GenderBalancer.GenderBalanceSettings">
                    <maleGenderWeight>1</maleGenderWeight>
                    <femaleGenderWeight>1</femaleGenderWeight>
                    <noGenderWeight>0</noGenderWeight>
                </li>
                </comps>
            </value>
        </nomatch>
        <match Class="PatchOperationAdd">
            <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]/comps</xpath>
            <value>
                <li Class="GenderBalancer.GenderBalanceSettings">
                    <maleGenderWeight>0</maleGenderWeight>
                    <femaleGenderWeight>1</femaleGenderWeight>
                    <noGenderWeight>0</noGenderWeight>
                </li>
            </value>
        </match>
    </Operation>
</Patch>

Would love to know if I went wrong somewhere and advice on how to get it working? Do I need to set the top gender weights the same as the lower ones on aliens but not Humans or something? Should I have edited the Xpath to the mod folder in the Steam workshop somehow?

 

That or I'm completely lost in the description of this mod since it says it's for rebalancing non alien races, but includes instructions for rebalancing alien races, or what I assumed were alien races, and in the comments you say it's not made for default Humans. Are not all mod races considered 'alien races'?

Link to comment
3 hours ago, Fenguard said:

Having an issue here. I did everything as you instructed for the patch. And while it worked for the basic core game Human pawns it doesn't work for any of the alien races.

I have no idea just what I'm doing wrong since I followed the instructions enough to get Humans working, but none of the alien races work. And I'm fairly sure the patch code is accurate: 

  Reveal hidden contents

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
<!-- Adds comps if not already part of that species, followed by the genderbalance comps class -->
    <Operation Class="PatchOperationConditional">
        <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]/comps</xpath>
        <nomatch Class="PatchOperationAdd">
            <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]</xpath>
            <value>
                <comps>
                    <li Class="GenderBalancer.GenderBalanceSettings">
                    <maleGenderWeight>1</maleGenderWeight>
                    <femaleGenderWeight>1</femaleGenderWeight>
                    <noGenderWeight>0</noGenderWeight>
                </li>
                </comps>
            </value>
        </nomatch>
        <match Class="PatchOperationAdd">
            <xpath>/Defs/ThingDef[defName="Fantasy_Goblin"]/comps</xpath>
            <value>
                <li Class="GenderBalancer.GenderBalanceSettings">
                    <maleGenderWeight>0</maleGenderWeight>
                    <femaleGenderWeight>1</femaleGenderWeight>
                    <noGenderWeight>0</noGenderWeight>
                </li>
            </value>
        </match>
    </Operation>
</Patch>

Would love to know if I went wrong somewhere and advice on how to get it working? Do I need to set the top gender weights the same as the lower ones on aliens but not Humans or something? Should I have edited the Xpath to the mod folder in the Steam workshop somehow?

 

That or I'm completely lost in the description of this mod since it says it's for rebalancing non alien races, but includes instructions for rebalancing alien races, or what I assumed were alien races, and in the comments you say it's not made for default Humans. Are not all mod races considered 'alien races'?

Sorry for confusing you, by Alien races I mean races using the Alien Races Framework. My mod does not re-balance those races, because alien races have gender balancing already built in.

Check this snippet from the Dragonian race here on LL.

Spoiler

<Defs>
	<AlienRace.ThingDef_AlienRace ParentName="DR_PawnBase">
		<defName>Dragonian</defName>
		<label>Dragonian</label>
		<description>...</description>
		<alienRace>
			<generalSettings>
				<maleGenderProbability>0</maleGenderProbability>
				<useOnlyPawnkindBackstories>true</useOnlyPawnkindBackstories>
              .
              .
              .

 

As you can see there is a value for male gender in the settings of the alien race. If you want to re-balance yours, you either have to write a patch overwriting that value or go into the file directly and change it. The value should be between 0 and 1; 0 being all female and 1 all male.

If the entry is missing, simply add it.

 

The monster used as example does not use the alien races framework, It behaves like a simple animal.

 

I'll update the mod description in order to avoid confusion in future.

Link to comment
5 hours ago, bearlyAlive said:

Sorry for confusing you, by Alien races I mean races using the Alien Races Framework. My mod does not re-balance those races, because alien races have gender balancing already built in.

Check this snippet from the Dragonian race here on LL.

  Reveal hidden contents


<Defs>
	<AlienRace.ThingDef_AlienRace ParentName="DR_PawnBase">
		<defName>Dragonian</defName>
		<label>Dragonian</label>
		<description>...</description>
		<alienRace>
			<generalSettings>
				<maleGenderProbability>0</maleGenderProbability>
				<useOnlyPawnkindBackstories>true</useOnlyPawnkindBackstories>
              .
              .
              .

 

As you can see there is a value for male gender in the settings of the alien race. If you want to re-balance yours, you either have to write a patch overwriting that value or go into the file directly and change it. The value should be between 0 and 1; 0 being all female and 1 all male.

If the entry is missing, simply add it.

 

The monster used as example does not use the alien races framework, It behaves like a simple animal.

 

I'll update the mod description in order to avoid confusion in future.

Oh, okay. I get it, thanks for explaining. Not all of them use the one framework mod! Understood and probably my issue! :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use