[WIP]Gamestart Help! Ship positioning and gamestart creation

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

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

Post Reply
MetaJonez
Posts: 6
Joined: Mon, 17. Dec 18, 17:38

[WIP]Gamestart Help! Ship positioning and gamestart creation

Post by MetaJonez » Fri, 29. May 20, 19:53

I have never made a mod before, and have a very basic knowledge of XML and how it works. I have spent years modding games and tweaking those mods to my liking.

I am trying to create a gamestart. I have three questions:

1. I placed a Discoverer in space towards the beginning of a game. I named it Discoverer Sacrificial. I saved the game, and then was able to find the ship in the savefile:

<connection connection="ships">
<component class="ship_s" macro="ship_arg_s_scout_01_a_macro" connection="space" name="Discoverer Sacrificial" code="KPA-329" owner="player" knownto="player" spawntime="448.748" thruster="thruster_gen_s_allround_01_mk1_macro" id="[0x17b77c]">
<listeners> ... etc.

My problem is I am not sure where the data for this ship ends in the savefile. This section seems to go on and on, describing cockpit, storage, crew, etc etc, which I would expect ... I just don't know where it ends. My best guess is right before the beginning of the next ship description:

<connection connection="con_engine_01">
<component class="engine" macro="engine_arg_xs_pv_01_macro" connection="ship" id="[0x12adbc]">
<offset>
<position x="-0.5199" y="2.67" z="2.301"/>
</offset>
<render>
<parameter flags="override" value="0.487265" owner="[0x12adbc]" name="mat_dynamicglow" type="glow">
<persistent start="147.842" duration="-1" value="1" target="1"/>
</parameter>
</render>
</component>
</connection>
</connections>
</component>
</connection>
<--------------------------------------------------------------here endeth the discoverer data
<connection connection="ships">
<component class="ship_xs" macro="ship_arg_xs_pv_01_a_macro" ... etc.

Am I correct in this guess?

2. I have a macro of a ship I want to replace the Discoverer Sacrificial with. It is based off an existing ship with a few tweeks. I have the ship itself introduced into the game through a separate mod folder under : \X4 Foundations\extensions:

\New Ship
catalog.xml
ext_01.dat

In the dat file, there is no part on where the ship might be purchased. I want to keep it that way, the idea being the player starts the game with a ship that cannot be replaced. How do I replace the Discoverer Sacrificial in the savefile with the New Ship?

3. Assuming I solve the above, then I have everything for the player set up in that savefile for the gamestart I want to create: PHQ and it's position, the research that is done, ships the player owns (and their locations), inventory, blueprints, cash on hand, and faction relationships. How do I convert the information in this savefile (about 45 minutes in) into a gamestart?

I have looked into other gamestart mods published, but I don't know to what extent I can quote other people's code here. Same with the ship, I can see in other gamestarts how certain ships are placed in game, but all those ships pre-exist in the game. I haven't been able to discern placing a ship from a macro into the game, and I don't know to what degree code is guarded by the programmer here. In the KSP forums for instance, mod licensing is strictly enforced and adhered to, whereas here, unless I am missing something, no more is required than permission requested and credit due if part of one mod is used in another programmer's mod, and code is shared like popcorn. Am I missing something here as well?

Thank you for your time.

DeadAirRT
Posts: 1022
Joined: Fri, 25. Jan 19, 03:26
x4

Re: [WIP]Gamestart Help! Ship positioning and gamestart creation

Post by DeadAirRT » Fri, 29. May 20, 20:08

MetaJonez wrote:
Fri, 29. May 20, 19:53
*snip*
savegame != gamestart

if you want to use any of my gamestart code, feel free. Any questions you may have, you are welcome to ask.

MetaJonez
Posts: 6
Joined: Mon, 17. Dec 18, 17:38

Re: [WIP]Gamestart Help! Ship positioning and gamestart creation

Post by MetaJonez » Sat, 30. May 20, 03:03

DeadAirRT wrote:
Fri, 29. May 20, 20:08

if you want to use any of my gamestart code, feel free. Any questions you may have, you are welcome to ask.
Thank you, I can nearly guarantee it. I solved the ship import question today, realized the above code actually contained a section not a part of the ship. I sort of cheated on the import - the ship is from another gamestart, so I started that gamestart, flew the ship to as close as i could in the sector I wanted, saved that game, and then just grafted the ship from one save to another. loaded that up, there it was, about 30km off my mark. teleported to it and docked.

I'm opening up various gamestarts this evening - I'm getting the gist.

Thank you.

Post Reply

Return to “X4: Foundations - Scripts and Modding”