help with overwriting md file

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

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

Post Reply
00NightHunter00
Posts: 14
Joined: Wed, 8. Apr 20, 21:08
x4

help with overwriting md file

Post by 00NightHunter00 » Mon, 24. Oct 22, 07:39

im having issues replacing/ overwriting a md script file

im trying to replace a md file that was added through the mod swi cause im making a overhaul of said mod but cant seem to get the correct way to write the code to do what i want

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
 <replace sel="//mdscript">
  <mdscript name="SWI_Failsafe_Stations" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="D:\x4 extract\libraries\md.xsd">
  </mdscript>
 </replace>
</diff>
this is what i thought would do it but no luck any help would be appreciated

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: help with overwriting md file

Post by kuertee » Wed, 26. Oct 22, 04:01

I would replace the first child and not the root.
Then save it with the same filename.
E.g. clearing genericmissions.xml to replace all its contents:
1. The diff XML file

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="/mdscript/cues">
		<cues>
			<cue name="MyCue">
			</cue>
		</cues>
	</replace>
</diff>
2. Save it as "x4 game\extensions\mymod\md\genericmissions.xml".
Note the filename needs to reside in exactly the same place as the original BUT in your own mod folder.
E.g. "md\genericmissions.xml" is in "x4 game\extensions\mymod\".
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

Realspace
Posts: 1374
Joined: Wed, 15. Nov 06, 10:21
x4

Re: help with overwriting md file

Post by Realspace » Fri, 28. Oct 22, 09:23

Remember to activate the debuglog...it saved me a lot of headaches when replacing many md's. It's the only way to know if it targets. As Kuertee told, be sure it is the same name in the same folder and I add, if it is a mod of a mod, always add DEPENDANCY in the content otherwise the mod it should replace could be loadee after and your mod simply missing the target.

If it is a patch of another mod, the directory should reflect that too. As when patching a dlc

kuertee
EGOSOFT
EGOSOFT
Posts: 789
Joined: Sun, 14. Dec 03, 13:05
x4

Re: help with overwriting md file

Post by kuertee » Sat, 29. Oct 22, 12:26

Realspace wrote:
Fri, 28. Oct 22, 09:23
Remember to activate the debuglog...it saved me a lot of headaches when replacing many md's. It's the only way to know if it targets. As Kuertee told, be sure it is the same name in the same folder and I add, if it is a mod of a mod, always add DEPENDANCY in the content otherwise the mod it should replace could be loadee after and your mod simply missing the target.

If it is a patch of another mod, the directory should reflect that too. As when patching a dlc
Good point, realspace.

I missed that nighthunter was modding SWI.

In this case the folder needs to be as below IF the MD XML file is SWI-specific. I think so anyway.
x4 game\extensions\mymod\extensions\StarWarsMod_M1\md\yourxmlfile.xml

If the MD file is from the base game, then the folder nees to be:
x4 game\extensions\mymod\md\yourxmlfile.xml

EDIT: Also, replace "md" with whatever folder the file is original from. E.g. "library", "aisciprt", etc.
Mods: RPG: Reputations and Professions, Social Standings and Citizenships, Crime has Consequences, Alternatives to Death. Missions/NPCs: Emergent Missions, NPC Reactions, Mod Parts Trader, High-sec Rooms are Locked, Hacking Outcomes, More Generic Missions, Waypoint Fields for Deployment. Others: Auto-cam, Friendly Fire Tweaks, Teleport From Transporter Room, Wear and Tear. QoL: Trade Analytics, Loot Mining, Ship Scanner, Signal Leak Hunter, Station Scanner, Surface Element Targeting, etc.

Post Reply

Return to “X4: Foundations - Scripts and Modding”