Hiring fee mod not working WIP - any hint

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

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

Esch1lus
Posts: 148
Joined: Mon, 7. Jan 08, 04:28
x4

Hiring fee mod not working WIP - any hint

Post by Esch1lus »

Here's the code:

Code: Select all

<diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <replace sel="//mdscript[@name='NPC_Instantiation']/cues//library[@name='HiringFeeFromCombinedSkill']/actions/set_value[@name='$HiringFee'][1]/@exact">1000 * (1.129305 ^ $combinedskill)</replace>
    <remove sel="//mdscript[@name='NPC_Instantiation']/cues//library[@name='HiringFeeFromCombinedSkill']/actions/do_if/set_value[@name='$HiringFee'][1]/@exact">[$HiringFee, (($combinedskill * 15) * (15 ^ ($combinedskill / 20f)))i].max</remove>
</diff>
Basically my mod do as follows:
Changes the hiring fee formula for npcs to a new value that changes progressively as $combinedskill grows.
Remove the second formula that was used when $combinedskill was > 20
Keeps the addition of 300-700 Cr and then rounds the result.

Game skips node because it can't find the correct one. Changes apply to npcinstantion.xml. structure is as follows:
mod_folder/md/npcinstantion.xml
mod_folder/content.xml

It has been formatted with the help of Copilot/chatgpt.

Tried to remove [1] node selection, tried with [0][1][2]([last]) but no luck.
Realspace
Posts: 1637
Joined: Wed, 15. Nov 06, 10:21
x4

Re: Hiring fee mod not working WIP - any hint

Post by Realspace »

I am not at pc but I advise it is better to add more root's names in bracket to identify the exact cue (should there be identical ones) then relying on numbers. You can also add more [@..] of elements contained in the lower root to better identify it (so, [@name], [@value] etc).
Also remember that if you replace a cue then recall it again (to replace or delete) the root has changed into the new one you previously created. The engine proceeds as in a list, but everything you change in the top of the list is then updated and seen in the bottom of the list, as in a new (virtual) file.

Return to “X4: Foundations - Scripts and Modding”