[Request] Increasing mineral yield

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

ArbeeRB
Posts: 5
Joined: Thu, 6. Dec 18, 22:48
x4

[Request] Increasing mineral yield

Post by ArbeeRB »

Hey!

I want to increase the yield asteroids give, to create an "easier" economy. But I am completely new to modding.
I did find the correct .xml within CAT8, but I am dumbfound how to correctly edit it so my changes take effect.
Original:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<regionyields xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="regionyields.xsd">
  <resource ware="ore" scaneffect="scfx_result_region_ore_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="2.5" replenishtime="60" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="240" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="25000" replenishtime="2400" scaneffectintensity="1.0" />
  </resource>
  <resource ware="silicon" scaneffect="scfx_result_region_silicon_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="2.5" replenishtime="90" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="360" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="25000" replenishtime="3600" scaneffectintensity="1.0" />
  </resource>
  <resource ware="ice" scaneffect="scfx_result_region_ice_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="2.5" replenishtime="30" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="120" scaneffectintensity="0.3" />
  </resource>
  <resource ware="nividium" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="2.5" replenishtime="250" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="600" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="2500" replenishtime="3600" scaneffectintensity="1.0" />
  </resource>
  <resource ware="hydrogen" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
  <resource ware="helium" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
  <resource ware="methane" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
</regionyields>
Please help me correct any mistakes I made. So far I came up with this:

Code: Select all

<diff>
  <replace sel="//Regionyields">
  <resource ware="ore" scaneffect="scfx_result_region_ore_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="2.5" replenishtime="6" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="24" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="250000" replenishtime="24" scaneffectintensity="1.0" />
  </resource>
  <resource ware="silicon" scaneffect="scfx_result_region_silicon_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="2.5" replenishtime="9" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="36" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="25000" replenishtime="36" scaneffectintensity="1.0" />
  </resource>
  <resource ware="ice" scaneffect="scfx_result_region_ice_01" scaneffectdensity="0.003">
    <yield name="medium" resourcedensity="92.5" replenishtime="3" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="2500" replenishtime="12" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="250000" replenishtime="36" scaneffectintensity="1.0" />
  </resource>
  <resource ware="nividium" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="2.5" replenishtime="250" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="25" replenishtime="600" scaneffectintensity="0.3" />
    <yield name="veryhigh" resourcedensity="2500" replenishtime="3600" scaneffectintensity="1.0" />
  </resource>
  <resource ware="hydrogen" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
  <resource ware="helium" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
  <resource ware="methane" scaneffect="" scaneffectdensity="0.001">
    <yield name="medium" resourcedensity="100" replenishtime="60" gatherspeedfactor="1.0" scaneffectintensity="0.1" />
    <yield name="high" resourcedensity="1000" replenishtime="240" gatherspeedfactor="4.0" scaneffectintensity="0.3" />
  </resource>
</regionyields>
</replace>
</diff>
User avatar
Drewgamer
Posts: 536
Joined: Fri, 27. Aug 10, 08:39
x4

Re: [Request] Increasing mineral yield

Post by Drewgamer »

I think I can help a bit here:

"regionyields" are used in the /resources element of "region_definitions" to determine how many extra resources an area gets. The main problem you're running into here is that only a VERY few sectors (I think less than 5) actually use "veryhigh". You could also look into "regionobjectgroups" for base yields of the individual object yields.

On another note, you may not want to replace the entire "regionyields" section (it looks like you're not changing a bunch of fields). It will make compatibility harder with other mods (or if Ego adds/changes anything to that section and you forget to incorporate it).

See the spoiler below if you need/want some tips on how to better accomplish that :)
Spoiler
Show
So for example, if you want to change the "high" yield of ore you'd do this:

Code: Select all

<replace sel="//regionyields/resource[@name='ore']/yield[@name='high']>
	<yield name="high" resourcedensity="2500" replenishtime="24" scaneffectinteensity="0.3"/>
</replace>
Or if you just wanted to change "resourcedensity" you'd do this:

Code: Select all

<replace sel="//regionyields/resource[@name='ore']/yield[@name='high']/@resourcedensity>2500</replace>
You can do as many of these as you want in your main <diff></diff> block.
Check out my mod Crystal Rarities
ArbeeRB
Posts: 5
Joined: Thu, 6. Dec 18, 22:48
x4

Re: [Request] Increasing mineral yield

Post by ArbeeRB »

Thanks for your reply!

So, taking your first option, if I want to change multiple fields I would have to add the <replace sel= for each field that I change?
For example:

Code: Select all

<replace sel="//regionyields/resource[@name='ore']/yield[@name='high']>
	<yield name="high" resourcedensity="2500" replenishtime="24" scaneffectinteensity="0.3"/>
	<replace sel="//regionyields/resource[@name='ice']/yield[@name='high']>
	<yield name="high" resourcedensity="2500" replenishtime="24" scaneffectinteensity="0.3"/>
</replace>
Also, you mentioned regionobjectgroups.
Looking at the file, it determines the "yield" per asteroid. So if I wanted to (greatly) increase the amount mined per asteroid, I would be better off editing this file instead?
Again, thanks for your help.
ShiBDiB
Posts: 79
Joined: Mon, 7. May 07, 00:12
x4

Re: [Request] Increasing mineral yield

Post by ShiBDiB »

Not exactly what you asked.. but increasing yield is not going to help the economy from what I've seen. There isn't typically a shortage of raw resources.
-----
My Mods
Go Home Drone, Reaction Force, Disable Story, Pay The Builder, Landlord, Training Exercise
Github with the latest (Unstable) Versions
Nexus Page
Steam Workshop Page
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: [Request] Increasing mineral yield

Post by DeadAirRT »

ArbeeRB wrote: Fri, 8. May 20, 22:33 Thanks for your reply!

So, taking your first option, if I want to change multiple fields I would have to add the <replace sel= for each field that I change?
For example:

Code: Select all

<replace sel="//regionyields/resource[@name='ore']/yield[@name='high']>
	<yield name="high" resourcedensity="2500" replenishtime="24" scaneffectinteensity="0.3"/>
	<replace sel="//regionyields/resource[@name='ice']/yield[@name='high']>
	<yield name="high" resourcedensity="2500" replenishtime="24" scaneffectinteensity="0.3"/>
</replace>
Also, you mentioned regionobjectgroups.
Looking at the file, it determines the "yield" per asteroid. So if I wanted to (greatly) increase the amount mined per asteroid, I would be better off editing this file instead?
Again, thanks for your help.
So first, when you are replacing things, you want to replace as little as possible otherwise you override other mods.

This is an example of a more specific, less destructive diff.

Code: Select all

<replace sel="//regionyields/resource[@name='ore']/yield[@name='high']/@resourcedensity">yournumberhere</replace>
In case you were wondering, region yields is not the best to change. It affects how many asteroids are spawned and would likely degrade performance.

Regionobjectgroups would be better to change, here is an example of a fairly specific diff:

Code: Select all

<replace sel="//group[@name='asteroid_ore_l']/@yield">800</replace>
Now as shib pointed out, this would not really help you. There is not a lack of resources in the game and vanilla economy over saturates quickly. You may make faster money short term, but expect your miners to be sitting around being useless much sooner.

Return to “X4: Foundations - Scripts and Modding”