[MOD] Player Owned Ship Production

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

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

aftokinito
Posts: 229
Joined: Sun, 30. Mar 08, 17:29
x4

Re: [MOD] Player Owned Ship Production

Post by aftokinito » Fri, 11. Jan 19, 17:36

Please, do note that POSP might undo some of the fixes introduced in 1.51 beta.
I'll update POSP to support 1.51 soon.

pit800
Posts: 6
Joined: Fri, 7. Dec 18, 00:39
x4

Re: [MOD] Player Owned Ship Production

Post by pit800 » Sun, 13. Jan 19, 10:21

i wilspeak with the ship Trader and x4 foundations stopt work

Berserk Knight
Posts: 398
Joined: Tue, 17. Dec 13, 01:34
x4

Re: [MOD] Player Owned Ship Production

Post by Berserk Knight » Wed, 16. Jan 19, 03:06

Found this on Nexus the other day.

I'm still laughing at the utter stupidity of it.

Breach of modding protocols (flat out replacement of base game files instead of using proper extension method when all they do is add some entries to "god"),
redundant changes (bundles your mod, and then doing what it ALREADY DOES to the base game files) (<-specifically, the ware.xml changes)

ned228
Posts: 29
Joined: Sun, 15. Jun 14, 21:20
x4

Re: [MOD] Player Owned Ship Production

Post by ned228 » Wed, 16. Jan 19, 18:18

Mod crashes the game when buying ship blueprints after owning a shipyard

u45u
Posts: 3
Joined: Sat, 8. Dec 18, 20:37
x4

Re: [MOD] Player Owned Ship Production

Post by u45u » Wed, 16. Jan 19, 19:43

so with the requirement of having to buy blueprints from representatives and not just having all the ships unlocked, how would one get a hold of xenon ship blueprints or maybe the possibility of getting a hold of xenon station parts

Aramm500
Posts: 2
Joined: Tue, 11. Dec 18, 14:31
x4

Re: [MOD] Player Owned Ship Production

Post by Aramm500 » Wed, 16. Jan 19, 20:15

Everything seems to be working fine. Until, I buy ship blueprints, then CTD :(

Baldamundo
Posts: 99
Joined: Sat, 21. Jun 08, 18:46
x4

Re: [MOD] Player Owned Ship Production

Post by Baldamundo » Wed, 16. Jan 19, 21:50

Aramm500 wrote:
Wed, 16. Jan 19, 20:15
Everything seems to be working fine. Until, I buy ship blueprints, then CTD :(
Hmm, I've just crashed on buying ship equipment blueprints.

Think I bought some blueprints earlier in the game and there was no issue, but that was before the 1.51 beta patch and with a different combination of mods. But maybe it's specific to the particular blueprints.

EDIT: Just reread over the thread then did some testing. Turns out it's the same bug others are reporting where owning a shipyard causes it to crash when you buy blueprints. Did anyone find a solution besides demolishing your shipyard?

EDIT2: I'm also having an issue in that medium shields aren't available to be equipped from my shipyard. They work fine in AI shipyards, and I definitely have the blueprints :gruebel:

aftokinito
Posts: 229
Joined: Sun, 30. Mar 08, 17:29
x4

Re: [MOD] Player Owned Ship Production

Post by aftokinito » Thu, 17. Jan 19, 18:15

Berserk Knight wrote:
Wed, 16. Jan 19, 03:06
Found this on Nexus the other day.

I'm still laughing at the utter stupidity of it.

Breach of modding protocols (flat out replacement of base game files instead of using proper extension method when all they do is add some entries to "god"),
redundant changes (bundles your mod, and then doing what it ALREADY DOES to the base game files) (<-specifically, the ware.xml changes)
DMCA'd, thanks for reporting.
Baldamundo wrote:
Wed, 16. Jan 19, 21:50
Aramm500 wrote:
Wed, 16. Jan 19, 20:15
Everything seems to be working fine. Until, I buy ship blueprints, then CTD :(
Hmm, I've just crashed on buying ship equipment blueprints.

Think I bought some blueprints earlier in the game and there was no issue, but that was before the 1.51 beta patch and with a different combination of mods. But maybe it's specific to the particular blueprints.

EDIT: Just reread over the thread then did some testing. Turns out it's the same bug others are reporting where owning a shipyard causes it to crash when you buy blueprints. Did anyone find a solution besides demolishing your shipyard?

EDIT2: I'm also having an issue in that medium shields aren't available to be equipped from my shipyard. They work fine in AI shipyards, and I definitely have the blueprints :gruebel:
The crash happens outside of my control, it's an issue with the LearnBlueprint function that causes a crash because of how the Lua state is handled when it comes to blueprints vs how it is handled by the rest of the game (MD, for example).
So far the only solution I've been able to find is to start a new save with POSP enabled and never disable it for the lifetime of that save.

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Re: [MOD] Player Owned Ship Production

Post by Blacky_BPG » Thu, 17. Jan 19, 18:50

But that did not work that way either.
I also started a new game with 1.50 and POSP enabled. I bought some blueprints for the basics and then a shipyard (this time even with just one L & XL ship category, not mixed) and as soon as the modules were finished the game crashed when I wanted to buy a blueprint.

So there is definitely something wrong with the LearnBlueprint function. I also had to output the values which are passed to the LearnBlueprint function in the LUA and these are correct and will be passed just like without player shipyard modules.

I think you can do absolutely nothing, Egosoft has to do something, and if they finally do, they will include the player shipyard function anyway.


Nevertheless, you has done a great job so far, and that can only be praised. Thank you.

aftokinito
Posts: 229
Joined: Sun, 30. Mar 08, 17:29
x4

Re: [MOD] Player Owned Ship Production

Post by aftokinito » Thu, 17. Jan 19, 19:57

Blacky_BPG wrote:
Thu, 17. Jan 19, 18:50
But that did not work that way either.
I also started a new game with 1.50 and POSP enabled. I bought some blueprints for the basics and then a shipyard (this time even with just one L & XL ship category, not mixed) and as soon as the modules were finished the game crashed when I wanted to buy a blueprint.

So there is definitely something wrong with the LearnBlueprint function. I also had to output the values which are passed to the LearnBlueprint function in the LUA and these are correct and will be passed just like without player shipyard modules.

I think you can do absolutely nothing, Egosoft has to do something, and if they finally do, they will include the player shipyard function anyway.


Nevertheless, you has done a great job so far, and that can only be praised. Thank you.
The problem is that GetBlueprints returns blueprints that you already know, which indicates that the state is not properly passed to Lua.
When you call LearnBlueprint in that case, the game crashes for some reason.

u45u
Posts: 3
Joined: Sat, 8. Dec 18, 20:37
x4

Re: [MOD] Player Owned Ship Production

Post by u45u » Thu, 17. Jan 19, 22:15

aftokinito wrote:
Thu, 17. Jan 19, 19:57
Blacky_BPG wrote:
Thu, 17. Jan 19, 18:50
But that did not work that way either.
I also started a new game with 1.50 and POSP enabled. I bought some blueprints for the basics and then a shipyard (this time even with just one L & XL ship category, not mixed) and as soon as the modules were finished the game crashed when I wanted to buy a blueprint.

So there is definitely something wrong with the LearnBlueprint function. I also had to output the values which are passed to the LearnBlueprint function in the LUA and these are correct and will be passed just like without player shipyard modules.

I think you can do absolutely nothing, Egosoft has to do something, and if they finally do, they will include the player shipyard function anyway.


Nevertheless, you has done a great job so far, and that can only be praised. Thank you.
The problem is that GetBlueprints returns blueprints that you already know, which indicates that the state is not properly passed to Lua.
When you call LearnBlueprint in that case, the game crashes for some reason.
i imagine thats the problem the devs had that prevented this from being available in base game on launch

Baldamundo
Posts: 99
Joined: Sat, 21. Jun 08, 18:46
x4

Re: [MOD] Player Owned Ship Production

Post by Baldamundo » Thu, 17. Jan 19, 23:39

Any idea why I can't build shields on M class ships at my shipyard? It works fine at NPC shipyards, I have the blueprint, I'm able to use M class shields on my stations, and I'm able to build M class shields as the turret/engine shields on L and XL ships at my shipyard, but for some reason I don't have any shield options available on M class ships :gruebel:

Also having an issue with saved ship loadouts never working at player shipyards - even ones saved at that shipyard with exactly the same set of available components

Berserk Knight
Posts: 398
Joined: Tue, 17. Dec 13, 01:34
x4

Re: [MOD] Player Owned Ship Production

Post by Berserk Knight » Fri, 18. Jan 19, 00:53

Baldamundo wrote:
Thu, 17. Jan 19, 23:39
Any idea why I can't build shields on M class ships at my shipyard? It works fine at NPC shipyards, I have the blueprint, I'm able to use M class shields on my stations, and I'm able to build M class shields as the turret/engine shields on L and XL ships at my shipyard, but for some reason I don't have any shield options available on M class ships :gruebel:

Also having an issue with saved ship loadouts never working at player shipyards - even ones saved at that shipyard with exactly the same set of available components
Do you have...
1. Both blueprints for M shields/turrets? There are 2 versions, one for use in separately damageable L/XL ship and station engine/turret groups, the other for M ships where they are integrated and can not be damaged separately.
2. L/XL build capability AND S/M build capability on the same station? You'll want Blacky_BPG's fix on this post for that one.

...Oh yeah, #2 only causes problems on engines and turrets. If shields aren't appearing at all for M ships, it's probably #1.

Baldamundo
Posts: 99
Joined: Sat, 21. Jun 08, 18:46
x4

Re: [MOD] Player Owned Ship Production

Post by Baldamundo » Fri, 18. Jan 19, 01:23

Berserk Knight wrote:
Fri, 18. Jan 19, 00:53
Do you have...
1. Both blueprints for M shields/turrets? There are 2 versions, one for use in separately damageable L/XL ship and station engine/turret groups, the other for M ships where they are integrated and can not be damaged separately.
2. L/XL build capability AND S/M build capability on the same station? You'll want Blacky_BPG's fix on this post for that one.

...Oh yeah, #2 only causes problems on engines and turrets. If shields aren't appearing at all for M ships, it's probably #1.
Huh. I'm only seeing one set of blueprints available at any of the faction reps.

Is this the distinction between <blueprint ware="shield_par_m_standard_01_mk2"/> and<blueprint ware="shield_par_m_standard_02_mk2"/>, and would I be able to fix it with a savegame edit?

pit800
Posts: 6
Joined: Fri, 7. Dec 18, 00:39
x4

Re: [MOD] Player Owned Ship Production

Post by pit800 » Sat, 19. Jan 19, 08:20

i buy bluprints after ownning a schipyard and x 4 stopt work

aftokinito
Posts: 229
Joined: Sun, 30. Mar 08, 17:29
x4

Re: [MOD] Player Owned Ship Production

Post by aftokinito » Sat, 19. Jan 19, 20:00

pit800 wrote:
Sat, 19. Jan 19, 08:20
i buy bluprints after ownning a schipyard and x 4 stopt work
I no read thread so no konw.

Staberind
Posts: 119
Joined: Wed, 5. May 10, 23:32
x4

Re: [MOD] Player Owned Ship Production

Post by Staberind » Sun, 20. Jan 19, 05:43

Heh,
Anyway, even with 0 mods there is deffo something wrong with blueprints/research, even if you have not got the research done, they sometimes drop anyway, plus I have had crashes at similar points with and without POSP, buying blups from faction reps. I think crashes with shipbuilding just reveal this quicker, so I don't think its an issue with POSP, more due to X4 needing a little more work.
mmmh, probably quicker to talk about it on disco.
Aladna Hill, Again, AP, 3.1. in the last Game worthy of the "X" title. <<<< X4 might just be changing this. :?:

Berserk Knight
Posts: 398
Joined: Tue, 17. Dec 13, 01:34
x4

Re: [MOD] Player Owned Ship Production

Post by Berserk Knight » Sun, 20. Jan 19, 13:40

I have 2 additions that'll make things go smoother.

/md/InitUniverse.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="//cue[@name='CreateShipDealerNPCs']/@checkinterval">1min</replace>
</diff>
This will create ship dealers on shipyards every 1 minute instead of the stock interval of 29 minutes.
Yes, the lack of ship dealers on the station is the exact reason why you can't build ships in your shipyard for a while. (...Unless you got lucky and the build module got built right before the tick.)


/md/Job_Helper.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<diff>
	<replace sel="/mdscript/cues/cue/actions/do_if/add_to_group">
          <do_if value="$Shipyard.isplayerowned">
            <cancel_cue cue="AddShipyard"/>
          </do_if>
          <do_else>
            <add_to_group groupname="md.$Shipyards" object="$Shipyard"/>
          </do_else>
	</replace>
	<replace sel="/mdscript/cues/cue/cues/cue/cues/cue[@name='FindSuitableShip']/actions/do_if/do_if/do_while/do_all/do_if/do_all/do_if/do_if/add_build_to_construct_ship">
                                <do_if value="$Shipyard.isplayerowned">
                                  <set_value name="$Build" exact="null"/>
                                </do_if>
                                <do_else>
                                  <add_build_to_construct_ship result="$Build" object="$Shipyard" buildobject="$Ship"/>
                                </do_else>
	</replace>
</diff>
The first part was SUPPOSED TO stop player shipyards from being registered and then cancel the cue.
...Which shouldn't happen anyways since every trigger for this cue has a player faction check in it, so this cue shouldn't be firing for player shipyards.
Both of them fail for some reason, and the cue still fires.

So I put in the second part. When the shipyard looks for a job ship to build, if it's a player owned shipyard, it'll do nothing.

This will keep your shipyards free of NPC faction build orders.
It will NOT prevent NPC ships from using it like an equipment dock to restock ammo or get repairs.

Baldamundo wrote:
Fri, 18. Jan 19, 01:23
Huh. I'm only seeing one set of blueprints available at any of the faction reps.

Is this the distinction between <blueprint ware="shield_par_m_standard_01_mk2"/> and<blueprint ware="shield_par_m_standard_02_mk2"/>, and would I be able to fix it with a savegame edit?
Ah...I see the problem. The wares.xml only changes a single ware for shields.

Then the answer is yes to both.

Mysterial
Posts: 644
Joined: Wed, 6. Nov 02, 20:31
x4

Re: [MOD] Player Owned Ship Production

Post by Mysterial » Sat, 26. Jan 19, 02:46

Berserk Knight wrote:
Sun, 20. Jan 19, 13:40
The first part was SUPPOSED TO stop player shipyards from being registered and then cancel the cue.
...Which shouldn't happen anyways since every trigger for this cue has a player faction check in it, so this cue shouldn't be firing for player shipyards.
Both of them fail for some reason, and the cue still fires.

So I put in the second part. When the shipyard looks for a job ship to build, if it's a player owned shipyard, it'll do nothing.

This will keep your shipyards free of NPC faction build orders.
Are you sure this is actually where the build orders come from? The code in Job_Helper checks for the shipyard owner matching the desired ship. But I was poking around in the resupply code and found that order.restock.subordinates does not. It just uses the closest friendly shipyard.

Berserk Knight
Posts: 398
Joined: Tue, 17. Dec 13, 01:34
x4

Re: [MOD] Player Owned Ship Production

Post by Berserk Knight » Sat, 26. Jan 19, 13:49

Mysterial wrote:
Sat, 26. Jan 19, 02:46
Are you sure this is actually where the build orders come from? The code in Job_Helper checks for the shipyard owner matching the desired ship. But I was poking around in the resupply code and found that order.restock.subordinates does not. It just uses the closest friendly shipyard.
Hmm, it seems the AI was trolling me. After 2.5 hours of SETA, one of the NPC factions did indeed get an order (or 2) through. (Apparently, 1+hour of SETA while you have the only functioning shipyard in the galaxy isn't enough.)
Still a lot less than what I normally get without that little patch of mine (which is basically an instant spam-fest of build orders) so it might be working to some degree?

I think there are 2 different job ship build order queues, one that's global which is periodically picked up by Job_Helper, and another that's posted to a specific shipyard and instantly started by order.restock.subordinates.

Fixing that and interrupt.restock as well should make player shipyards NPC order free.

Post Reply

Return to “X4: Foundations - Scripts and Modding”