[Help] Gamestart not always spawning on correct station

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

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

Post Reply
user1679
Posts: 794
Joined: Fri, 20. Jul 18, 23:20

[Help] Gamestart not always spawning on correct station

Post by user1679 » Sat, 20. Feb 21, 00:57

I wrote a simple gamestart that is supposed to put the player on the shipyard in Argon Prime with a basic Discoverer class ship and 5k credits. The problem is that when I start adding mods, the gamestart sometimes spawns me on a production facility or other random station instead of the shipyard.

Couple things to note:

1. The mods I use don't change sector size or station spawns, they're only ship mods and "quality of life" mods
2. The shipyard is usually right next to the wrong station I spawn on
3. I don't know which mod is causing the problem

Here is the relevant code:

Code: Select all

            <location galaxy="xu_ep2_universe_macro" zone="zone002_cluster_14_sector001_macro" room="dockingbay_arg_s_01_hightech_macro" docked="true">
              <player disembarked="true">
                <position x="-2.464350" y="1.756518" z="19.906940" />
                <rotation yaw="143.560242" pitch="0" roll="0" />
              </player>
            </location>
It is my understanding that the position is for the player based on the platform they are standing on. I get this information from a script I wrote with the assitance of Unitrader here on the forums that simply logs my location when I switch to external view. The question I have: Is there a way to guarantee I always get spawned on the argon shipyard in argon prime, regardless of where it is in the sector (in case it is a mod changing its location)?

Thanks!

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

Re: [Help] Gamestart not always spawning on correct station

Post by DeadAirRT » Sat, 20. Feb 21, 02:18

Nothing in your script specifies the shipyard. It just specifies a certain type of stock that any station can have.

Look into how the young gun start puts you in the equipment dock, should have syntax for macro= something

user1679
Posts: 794
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Gamestart not always spawning on correct station

Post by user1679 » Sat, 20. Feb 21, 05:00

DeadAirRT wrote:
Sat, 20. Feb 21, 02:18
Nothing in your script specifies the shipyard. It just specifies a certain type of stock that any station can have.

Look into how the young gun start puts you in the equipment dock, should have syntax for macro= something
Thanks for that. 'Young Gun' seems to be x4ep1_gamestart_flightschool based on the default gamestarts file and the T file for my locale. I can see that I am missing the interior tag from the location block.

Not entirely sure how to get the macro ID of a ship I'm standing on other than what I posted. My script logs the following which is where I got the information for my code block in my OP

player.sector.macro.id
player.zone.macro.id
player.object.macro.id
player.room.macro.id

The default gamestart has different values for location station="station_gen_factory_base_01_macro" and interior module="dockarea_arg_m_station_01_macro" so I don't think my log script is getting all the info I need.

user1679
Posts: 794
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Gamestart not always spawning on correct station

Post by user1679 » Sat, 20. Feb 21, 06:03

So I rewrote my location dump script and got more information that I'll try modifying my gamestart with
### LOCATION_INFO ###

galaxy=xu_ep2_universe_macro, sector=cluster_14_sector001_macro, station=station_gen_factory_base_01_macro, zone=zone002_cluster_14_sector001_macro, object=null

### LOCATION_INTERIOR_INFO ###

module=null, corridor=null, door=null, room=dockingbay_arg_s_01_hightech_macro

### PLAYER_COORDINATE_INFO ###

position=position.[-2.464000m, 1.757000m, 19.907000m], rotation=rotation.[149.977844deg, -1.375084deg, -0.000000deg]

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

Re: [Help] Gamestart not always spawning on correct station

Post by DeadAirRT » Sat, 20. Feb 21, 22:11

It's strange that the station is showing that macro, I would have thought the macro was argon_shipyard or something.

Either way, you just need to figure out how to make it specific enough to only include the shipyard and not other factories in that zone with a high-tech dock.

user1679
Posts: 794
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Gamestart not always spawning on correct station

Post by user1679 » Sat, 20. Feb 21, 22:51

DeadAirRT wrote:
Sat, 20. Feb 21, 22:11
It's strange that the station is showing that macro, I would have thought the macro was argon_shipyard or something.

Either way, you just need to figure out how to make it specific enough to only include the shipyard and not other factories in that zone with a high-tech dock.
Yeah, even with the additional information I still get randomly spawned on a different station. I even tried adding station="true" in before docked="true" but the script threw a station redefined error and failed to load. I can't find any API or scripting reference to see if there might be some other way of getting the proper location.

user1679
Posts: 794
Joined: Fri, 20. Jul 18, 23:20

Re: [Help] Gamestart not always spawning on correct station

Post by user1679 » Sat, 20. Feb 21, 23:42

Turns out I was missing the shipyard="true" parameter

After a few new game tests, this properly spawns me on the Argon Shipyard:

Code: Select all

            <location galaxy="xu_ep2_universe_macro" sector="cluster_14_sector001_macro" zone="zone002_cluster_14_sector001_macro" room="dockingbay_arg_s_01_hightech_macro" station="station_gen_factory_base_01_macro" shipyard="true" docked="true">
              <player disembarked="true">
                <position x="-2.464000" y="1.757000" z="19.907000" />
                <rotation yaw="149.977844" pitch="-1.375084" roll="0" />
              </player>
            </location>

Post Reply

Return to “X4: Foundations - Scripts and Modding”