Creating Xenon operational stations not worksites

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

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

Post Reply
Realspace
Posts: 1342
Joined: Wed, 15. Nov 06, 10:21
x4

Creating Xenon operational stations not worksites

Post by Realspace » Thu, 16. Feb 23, 10:30

As the title suggests, I wish to add Xenon DEFEND stations to several new sector I added. This is made for continuing an old save with the right occupation of the sectors. Not needed for a new game where god file does the thing.
I used this script that works normally for adding special factories as solar plants at the start of the game, and it works with the <event_cue_signalled cue="md.Setup.GameStart" />.
But when doing the script for Xenon defend stations it only spawns a worksite, not the station:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<mdscript name="Setup_Frontier" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
	<cues>
	 <cue name="Frontier_Sectors" >
		   <conditions>
     <event_cue_signalled cue="md.Setup.Start"/>
    </conditions>
	<actions>
<!--========================= XENON in FRONTIER ============-->

	<!-- Xenon shipyards in PTNI -->
				<find_sector name="$sector"  macro="macro.cluster_rs202_sector002_macro"/>
				<do_if value="$sector.exists">
				 <!--Add a station -->
		    	        <create_station name="shipyard_xenon_cluster_rs202"  macro="macro.station_gen_factory_base_01_macro" owner="faction.xenon" sector="$sector" rawname="'{20102,1421}'" state="componentstate.operational" constructionplan="xen_shipyard">
        <position x="1604273" y="0" z="1903"  />
      </create_station>
			</do_if>
 
	<!--_________________________________ETC ETC_____________________________-->
			</actions>
		</cue>
	</cues>
</mdscript>

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Creating Xenon operational stations not worksites

Post by euclid » Thu, 16. Feb 23, 13:40

Did you try state="complete" ?

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

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

Re: Creating Xenon operational stations not worksites

Post by Realspace » Thu, 16. Feb 23, 15:23

Hi Euclid, thanks for the hint but it does not work.

Mean, I changed the state="componentstate.operational" into what you suggest but this way even worksites won't appear.

Is it that what you mean? Looking in the vanilla files, only these 3 states exist for stations: operational, wreck, construction.

Or should I add the state="complete" somewhere else?
Thank you

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Creating Xenon operational stations not worksites

Post by euclid » Thu, 16. Feb 23, 16:45

You are correct, the available states are as you said. I just saw several patch commands with state="complete". However, this

Code: Select all

 <create_station name="$station" macro="macro.station_xen_shipyard_base_01_macro" owner="faction.xenon" sector="$sector" state="componentstate.operational" constructionplan="'xen_wharf'">
 ---
 
should work (haven't tested it myself), meaning that the name might need a "$" and/or the constructionplan might need xen_wharf. These are the only things I can think of.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

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

Re: Creating Xenon operational stations not worksites

Post by Realspace » Wed, 22. Feb 23, 18:38

It still does not work. I am changing the course of actions. Since I introduced a true expansion to my mod, what I need is a script that makes the game reload the god file and recall the new stations in case of continuing a game (not a new game). Can you help me on this?
This is something that in theory any dlc's setup does in order to recall the god file for an existing game. But I can't find the string in the various setups as f.i. md/setup_dlc_terran.xml

there is this that seems related, in the inituniverse:

Code: Select all

<cue name="InitGodCreatedStation" instantiate="true">
      <conditions>
        <event_god_created_station space="player.galaxy"/>
      </conditions>
      <actions>
        <signal_objects object="player.galaxy" param="'init station'" param2="event.param" param3="true"/>
      </actions>
    </cue>
Last edited by Realspace on Wed, 22. Feb 23, 20:02, edited 1 time in total.

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

Re: Creating Xenon operational stations not worksites

Post by Dr Reed » Wed, 22. Feb 23, 20:00

Unless I am reading this wrong, the DLCs just add new stations by using another god file, to new games and existing states, by using the diff add lines.

Code: Select all

  <diff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
	<add sel="/god/objects">
  		  Insert new stuff 
 	</add>
 	
	<add sel="/god/stations">
		Insert new stuff
	</add>
  </diff>	
So you should be able to add the Xenon Defence stations this way as long as it is an expansion mod to your base mod. As for updating existing stuff in the base mod I have no idea how that would be done.

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

Re: Creating Xenon operational stations not worksites

Post by Realspace » Wed, 22. Feb 23, 20:08

Thank you, yes I did this way by creating a little mod that has dependancy from the main mod and only adds the new god and the special objects. Still they don't appear immediately if continuing an old save.
The whole problem is about making new stations appear in an old save game, they appear perfectly in a new start. Being XRSGE a total overhaul, god file is completely replaced so adding causes no problem.
Reinitiating the god engine seems the thing to do, I only don't know how... :gruebel:

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13289
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Creating Xenon operational stations not worksites

Post by euclid » Thu, 23. Feb 23, 13:47

Realspace wrote:
Wed, 22. Feb 23, 20:08
..... Still they don't appear immediately if continuing an old save ....
"immediately" means they do appear eventually? I suspect that the change is active but not yet in the current game unless you save, exit, restart and load the saved game.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Post Reply

Return to “X4: Foundations - Scripts and Modding”