i think this function will let me patch existing ships to apply changes to them, but i don't really understand how to call the function from my mod. any help would be nice...<xs:element name="patch_macro">
<xs:annotation>
<xs:documentation>
Patch an object based on its macro, to add components that may be missing when loading a savegame. This action is only required by extensions and should normally only be used when loading a savegame
in which the extension was not active yet. The script is responsible for finding the objects, usually ships or stations, that need patching.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attributeGroup ref="action" />
<xs:attribute name="object" type="object" use="required" />
</xs:complexType>
</xs:element>
Question for master modders
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 31
- Joined: Fri, 27. Mar 15, 20:58
Question for master modders
-
- Posts: 3617
- Joined: Sun, 8. Apr 12, 09:40
to patch a single ship by conversation (in that case with the defence guy) make an YourModpatch.xml on the md/ folder
in that example the option will be shown on Sul and heavy Sul, add your macro in the conditionarea for the shiptype you want to patch
but in case you modify a macro and want to patch all ships in the universe simply use the <patch_macros >
in that Sample below both Sul-types will patched once only after load the game
in that example the option will be shown on Sul and heavy Sul, add your macro in the conditionarea for the shiptype you want to patch
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="YourMod" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<!-- conversation hook defence guy -->
<cue name="Base" instantiate="true" >
<conditions>
<check_any>
<event_conversation_started conversation="default" />
<event_conversation_returned_to_section section="default" />
</check_any>
<check_value value="event.object.type" exact="entitytype.defencecontrol" />
<check_value value="event.object.owner" exact="faction.player" />
<check_value value="event.object.iscontrolentity" />
<check_any>
<check_value value="event.object.container.macro" exact="macro.units_size_l_kit_carrier_01_macro" />
<check_value value="event.object.container.macro" exact="macro.units_size_l_kit_carrier_02_macro" />
</check_any>
</conditions>
<actions>
<add_player_choice_sub text="'Yeah, pimp my ride!'" section="ymod_pimpmyride" />
</actions>
</cue>
<cue name="YourMod_patch" instantiate="true">
<conditions>
<check_any>
<event_conversation_next_section section="ymod_pimpmyride"/>
</check_any>
</conditions>
<actions>
<patch_macro object="event.object.container" />
</actions>
</cue>
</cues>
</mdscript>
in that Sample below both Sul-types will patched once only after load the game
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="YourMod" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Base" version="1">
<conditions>
<event_game_loaded/>
</conditions>
<actions>
<patch_macros macro="macro.units_size_l_kit_carrier_01_macro"/>
<patch_macros macro="macro.units_size_l_kit_carrier_02_macro"/>
</actions>
</cue>
</cues>
</mdscript>
-
- Posts: 198
- Joined: Sat, 4. Oct 14, 13:07
@Marvin
Oops, I was seeking for this too. But in my case I would like to do it with a station. Sorry I'm very newbie on coding. In the second example the short one, where it says: mdscript name="YourMod" is the name of the folder extension of the mod in question, true?
And I supose in the case of a station where it says: patch_macros macro="macro.units_size_l_kit_carrier_01_macro"/ then here the macro's name of the station, true?
Thanks a lot and sorry for interfere in the thread.
Oops, I was seeking for this too. But in my case I would like to do it with a station. Sorry I'm very newbie on coding. In the second example the short one, where it says: mdscript name="YourMod" is the name of the folder extension of the mod in question, true?
And I supose in the case of a station where it says: patch_macros macro="macro.units_size_l_kit_carrier_01_macro"/ then here the macro's name of the station, true?
Thanks a lot and sorry for interfere in the thread.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
this is an individual Name for each MDscript - just keep it the same as the File Name and choose one which wont collide with the Game Files or other Modsantoniut wrote:Oops, I was seeking for this too. But in my case I would like to do it with a station. Sorry I'm very newbie on coding. In the second example the short one, where it says: mdscript name="YourMod" is the name of the folder extension of the mod in question, true?

exactly. it is basically a merged <find_objects/> and <patch_macro/> commandantoniut wrote:And I supose in the case of a station where it says: patch_macros macro="macro.units_size_l_kit_carrier_01_macro"/ then here the macro's name of the station, true?

if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help

-
- Posts: 198
- Joined: Sat, 4. Oct 14, 13:07
-
- Posts: 3617
- Joined: Sun, 8. Apr 12, 09:40
as much i figured out, that patch_macro(s) doesn't have much effect on stationsantoniut wrote: then here the macro's name of the station, true?
you can patch Ships very good, but Stations or especially productions haven't changed yet in my tests after patching them that way
if i'm wrong, let me know

-
- Posts: 31
- Joined: Fri, 27. Mar 15, 20:58
k i got it working and i think i know why you can't patch a station production...
because the patch command just looks for what is missing in a macro from the save file compared to the version that is i nthe system... so if you just try to add a macro that has the same anme at the same point it ignores it..
because the patch command just looks for what is missing in a macro from the save file compared to the version that is i nthe system... so if you just try to add a macro that has the same anme at the same point it ignores it..
-
- Posts: 335
- Joined: Mon, 23. Apr 12, 23:56
maybe trying to patch each submacro of a station would help? or is that already covered by the patch_macro(s) ? maybe the patch_macro looks at the "main" macro of the station and sees no difference, because it is changed somewhere beneath in a different macro.
didn't try myself yet, just passing thoughts.
didn't try myself yet, just passing thoughts.
-
- Moderator (Script&Mod)
- Posts: 14571
- Joined: Sun, 20. Nov 05, 22:45
i think its more like removing the changed factory parts (destroy without explosion) and then patching the Station..
if not stated otherwise everything i post is licensed under WTFPL
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter
I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help
