`<replace>` on terraforming project `resources` applies with zero errors but has no effect in-game

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

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

Zephelor
Posts: 1
Joined: Tue, 12. Jul 22, 14:15
x4

`<replace>` on terraforming project `resources` applies with zero errors but has no effect in-game

Post by Zephelor »

# [Modding] `<replace>` on terraforming project `resources` applies with zero errors but has no effect in-game

**Game version / setup:** PC, Steam, base game + Boron (Kingdom's End) + Split Vendetta + Cradle of Humanity (Terran) DLCs.

## Goal

A simple balance mod: reduce the credit price, ware amounts, and duration of terraforming projects, and remove the drone delivery phase, via a standard extension using `libraries/terraforming.xml` diff patching.

## Minimal reproduction

Single project, single attribute, nothing else touched:

```xml
<?xml version="1.0" encoding="utf-8" ?>
<diff>
<replace sel="/terraforming/projects/project[@id='res_arcology']/resources/@price">10</replace>
</diff>
```

Placed at `extensions/arcology_price_only/libraries/terraforming.xml`, with a minimal valid `content.xml` (id `arcology_price_only_test`, no dependencies missing, extension shows as active with correct version in-game).

## Expected result

Opening the Arcology project in the terraforming menu should show a price of 10 credits (down from the vanilla 200,000,000).

## Actual result

The project still shows the **exact vanilla values**. This isn't just "looks unchanged" — I confirmed it mathematically: the resource quantities shown for Arcology (69646 advancedelectronics / 17412 claytronics / 174114 hullparts when I tested a related change with modified ware amounts) back-calculate to an *identical* implied market price (~765.8 cr) for all three wares, which only makes sense if the game is still using the original `price="200000000"` and original ware weights (1/4/10) — i.e., the patch is having **zero effect** on the value used at runtime.

## What I've ruled out

- **XML/patch syntax**: valid per `diff.xsd` grammar (RFC 5261-style, matches the pattern used in official DLC diff files and in a community mod I compared against). Tried both attribute-only replace and whole-`<resources>`-element replace (with and without child `<ware>` nodes — confirmed via schema that ware-less resources are valid, "direct payment").
- **Debug log** (`-debug all -logfile`): completely clean for this file, every single time, across many iterations — no `No matching node`, no `Unknown node`, nothing.
- **Extension setup**: correct folder structure, correct `content.xml`, extension shows active with correct version in the in-game Extensions menu, confirmed via first-time "Installing Extension" popup on a brand-new extension ID.
- **Loose files vs `.cat`/`.dat`**: tested both (via X Tools Catalog Tool), same result.
- **`-prefersinglefiles`**: no change.
- **Conflicting extensions**: removed a similar community mod entirely, no other extension patches this file or path.
- **Savegame caching**: tested on a terraforming project never opened before in that save, still no effect.
- **General patch mechanism**: confirmed working — an identical single-attribute `<replace>` on `libraries/wares.xml` (changing Energy Cells price) applies correctly and is visible in-game immediately.

So the diff mechanism itself works, and applies cleanly to this exact file with zero logged errors, but the resulting value is not what the game actually uses when computing project cost.

## Question

Is it possible that some or all of the terraforming project economic calculations (price/resource scaling, delivery drone counts) have been moved to internal/hardcoded logic in a relatively recent update, rather than being read live from `libraries/terraforming.xml` at project-display/launch time? I found an old comment on an unrelated mod (Faster Workforce Growth) mentioning that some workforce-growth parameters "are no longer working" because Egosoft changed related code, and that this was tied to terraforming — which would be consistent with what I'm seeing here.

If anyone has a terraforming balance mod that is confirmed still working on the current version, I'd be very grateful to know which specific technique/file/attribute you're patching — happy to share my full test files if useful.

Return to “X4: Foundations - Scripts and Modding”