[Request / Help] spawn station into existing save [fixed]

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

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

Post Reply
Rothank
Posts: 38
Joined: Mon, 11. Aug 14, 22:48
x4

[Request / Help] spawn station into existing save [fixed]

Post by Rothank » Wed, 24. May 23, 15:23

I am planning to release a small companion-mod to a certain LARGE shippack, which adds a tiny "grey market" faction that only owns one station (a shipyard/wharf combo) and exclusively sells ships & blueprints from said shippack.

So far I've figured out faction creation, staffing it, giving it wares, representatives, station's construction plan and god.xml station placement - it all works flawlessly.
My last major issue is the fact that god.xml only triggers on a new game start. I know this needs to be scripted and my sripting knowledge is... nonexistent, to say the least. I have attempted to canibalize parts of setup_dlc_terran and setup_dlc_split scripts, but failed completely.

SCRIPT REQUEST / ASSITANCE REQUEST:

I am looking for a way to script a station I defined in god.xml to spawn at a sector of my choosing (also defined in god) in an already existing savegame.

my god.xml definition is as follows:

Code: Select all

<diff>
  <add sel="/god/stations">
		<station id="shipyard_aldrin" race="terran" owner="aldrin" type="factory">
			<quotas>
				<quota galaxy="1" zone="1" />
			</quotas>
			<location class="sector" macro="Cluster_116_Sector001_macro" matchextension="false">
				<corerange min="0.2" max="0.5"/>
			</location>
			<station>
				<select faction="aldrin" tags="[shipyard]" />
				<loadout>
					<level exact="1.0" />
				</loadout>
			</station>
		</station>
  </add>
</diff>
Last edited by Rothank on Mon, 29. May 23, 22:17, edited 1 time in total.
Image Image
Image

Dr Reed
Posts: 76
Joined: Fri, 30. Nov 18, 00:05
x4

Re: [Request / Help] spawn station into existing save

Post by Dr Reed » Wed, 24. May 23, 18:18

Rothank wrote:
Wed, 24. May 23, 15:23
My last major issue is the fact that god.xml only triggers on a new game start. I know this needs to be scripted and my sripting knowledge is... nonexistent, to say the least.
I'm sure you don't need any scripts to spawn the station as the additional god.xml stations will be read and spawned the first time you run your mod regardless of game time conditions.


Well, that's been my experience. :)

Rothank
Posts: 38
Joined: Mon, 11. Aug 14, 22:48
x4

Re: [Request / Help] spawn station into existing save

Post by Rothank » Wed, 24. May 23, 20:32

So if that does not happen - could it be that the issue is not with the station spawn, but with my custom faction not initializing at all?
This is the faction's one and only asset, so I have no way to verify that ingame, I think.
Image Image
Image

Dr Reed
Posts: 76
Joined: Fri, 30. Nov 18, 00:05
x4

Re: [Request / Help] spawn station into existing save

Post by Dr Reed » Thu, 25. May 23, 18:14

Do you have the following :

In the library folder : stationgroups.xml and stations.xml
In the MD folder : factionlogic_stations.xml and factionlogic.xml

Also if you look at the setup_dlc_split.xml in the MD folder of the expansion find the <library name="Start_Actions"> you should have something like that in your modsetup script.


I just cut/paste adjusted stuff from the Split DLC to get things to work.

Since you said that you have wares, staff etc.. that's all I can think of at the moment.
Hope this helps.

Rothank
Posts: 38
Joined: Mon, 11. Aug 14, 22:48
x4

Re: [Request / Help] spawn station into existing save

Post by Rothank » Mon, 29. May 23, 22:16

After many hours spent tinkering around this, I was assisted by another, already established, modder.

We (well, he, mostly) came to the conclusion that it is better to define a station macro and use a script to spawn the station on both new and loaded game. The same script is used to establish a faction and set player<>faction reputation.
In the end, we removed god.xml completely, as it is no longer needed.
Image Image
Image

Post Reply

Return to “X4: Foundations - Scripts and Modding”