Where in the save XML file is war relationship stored?

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

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

Post Reply
HopelessArgonRefuge
Posts: 2
Joined: Tue, 27. Jun 23, 23:09
x4

Where in the save XML file is war relationship stored?

Post by HopelessArgonRefuge » Wed, 28. Jun 23, 23:48

I ask because it is not contained in the relationships or boosted relationships. I have TER and ARG at war with each other, but their relationship in the save XML file is only -3 or -0.1. There are a few pilots I see that have -1 boosted relationships on a decay timer, but I don't see where the war relationship is kept.

Thanks.

User avatar
Dj_FRedy
Posts: 230
Joined: Mon, 27. Jun 11, 05:58
x4

Re: Where in the save XML file is war relationship stored?

Post by Dj_FRedy » Thu, 29. Jun 23, 03:01

Those values you see are the ones actually used for faction relations. What you see in the UI are those same values converted for better visualisation/understanding.
Some schematics taken from the file 'factions.xml':
Default Relation Ranges:
self: 1.0 to 1.0
ally: 0.5 to 1.0
member: 0.1 to 1.0
friend: 0.01 to 1.0
neutral: -0.01 to 0.01
enemy: -1.0 to -0.01
killmilitary: -1.0 to -0.1
kill: -1.0 to -0.32
nemesis: -1.0 to -1.0

UI value mapping (analogously for negative values):
1.0 = 30
0.32 = 25
0.1 = 20
0.032 = 15
0.01 = 10
0.0032 = 5
These values are fixed. Between them, logarithmic interpolation is used. Approximate formulas:
uivalue = 10 * log10(relation * 1000)
relation = 10^(uivalue / 10) / 1000
Between -0.0032 and +0.0032 (UI -5...+5) linear interpolation is used, and 0.00064 equates to one UI value step.
I use Lua as a converter for personal reference:

Code: Select all

function round(x, digits)
    local mult = 1
    if digits and digits > 0 then
        mult = 10^digits
    end
    if x == nil then
        print("Invalid number provided to Helper.round().")
        print(TraceBack())
    else
        print("x = " .. x .. ", mult = " .. mult)
        return math.floor(x * mult + 0.5) / mult
    end
end

-- Approximate formulas to calculate relation/uirelation values:
local uivalue = 30
local relation = 10^(uivalue / 10) / 1000
print("relation: " .. round(math.abs(relation), 2)) -- necessary to change the rounding to 4, 3, 2 as appropriate to approximate

local relation = relation
local uivalue = 10 * math.log(relation * 1000, 10)
print("uivalue: " .. math.floor(uivalue))
"All my contributions to the Technical Support and Public Beta Feedback sections will be concise and to the point, no diatribes, that's what the other sections are for".
Thank you for your efforts.

Post Reply

Return to “X4: Foundations - Scripts and Modding”