Repack construction vessel

The place to discuss scripting and game modifications for X Rebirth.

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

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Repack construction vessel

Post by mihaib » Sat, 5. Sep 15, 16:30

I've been working on a mod to repack the construction vessel, but I have a problem. I modified the architect script to allow players to repack the construction vessel when not building. I have been using the "clear_buildmodule" and "disconnect_from_build_location" functions to achieve this, and it works, mostly.

The problem is that the ship build module is full of build plans by now and the "clear_buildmodule" function won't really clear this queue. This can be seen in a save file just bellow the <component class="buildmodule" ...> line. As a side effect, the construction vessel won't work correctly when deployed to a built station and it will build automatically without you being able to decide what modules and in what order if you use it to build a new station.

I already spent a few days on this problem trying to access various properties, but I can't find any way to clear this build queue.

Does any one know how can you really clear the CV build module? Can it be cleared? Is there any property that gives you access to this queue to clear it?

w.evans
Posts: 2963
Joined: Tue, 18. Nov 14, 16:23
x4

Post by w.evans » Sat, 5. Sep 15, 16:37

jth recently added that functionality to the Space Station Recycling mod. Haven't taken a look at the new code, but you could take a look at how it's done with that mod.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Sat, 5. Sep 15, 17:46

IIRC <disconnect_from_build_location/>
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Sat, 5. Sep 15, 19:13

I just tested that mod and they have the same issue :(.

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Sat, 5. Sep 15, 19:17

I already call <disconnect_from_build_location>, right after <clear_buildmodule>.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Sat, 5. Sep 15, 19:24

ah, sorry - didnt read your post properly cause i anserwed from the phone first... i think the keyword you have to search for is
buildplan
which you can find in both the scriptproperties.html and in the aiscript/md/common xsd files
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Sat, 5. Sep 15, 21:16

Unfortunately I found nothing valuable related to the buildplan neither in common.xsd or scriptproperties. I've been trying and searching for three days now and it seems you can only add build plans to a build module <add_build_plan> but you can't clear or reset the list. Also, I found no property in scriptproperties that allows you to access the current build plan list for the buildmodule or any of it's parent types.

The only way I managed to get rid of that queue was to use <destroy_object> on the build module, but I found no way to create the build module back, so the CV is useless after that.

I'm thinking that repacking CVs just isn't supported, but maybe someone has a good idea for a workaround, other than cloning the ship and destroying the original :).

Rubini
Posts: 452
Joined: Mon, 7. May 07, 05:17
xr

Post by Rubini » Sun, 6. Sep 15, 18:56

Hi mate,

An idea can be force the buildplan clean by put on it a empt buildplan after clear_buildmodule" and "disconnect_from_build_location . Try it and let we know!

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Sun, 6. Sep 15, 20:36

Rubini wrote:Hi mate,

An idea can be force the buildplan clean by put on it a empt buildplan after clear_buildmodule" and "disconnect_from_build_location . Try it and let we know!
I just tried that, and it doesn't work. I also tried calling <clear_buildmodule> again after adding the new build plan, but there is no change.

I'm thinking this is the same behavior when you create a new station using the repacked CV. The new station macro is used, but with the old build plan from the previous station.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Sun, 6. Sep 15, 20:42

where did you use the <clear_buildmodule/> on? (what did you specify as buildmodule?) was it the Construction Ship?
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Mon, 7. Sep 15, 10:14

UniTrader wrote:where did you use the <clear_buildmodule/> on? (what did you specify as buildmodule?) was it the Construction Ship?
I specified the CV build module. It is something like this:
<clear_buildmodule buildmodule="$actor.container.buildmodule" />

This script is patched to the NPC_Architect.xml file where that variable makes sense. They also use it in the file to get the build module.

Also, I am certain it has some effect, because if I don't call <clear_buildmodule> the CV is not released from the station.

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 7. Sep 15, 10:55

hmm, what about this:

Code: Select all

<destroy_object object="$actor.container.buildmodule" explosion="false"/>
<patch_object object="$actor.container"/>
?

note that it may be necesary to re-assign the Architect when using this because he may still try to use the (cached) old build module


also it may be worth a try to use .buildingmodule instead of .buildmodule - the former seems to be used for stations, the latter for ships..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Mon, 7. Sep 15, 10:57

hmm, what about this:

Code: Select all

<destroy_object object="$actor.container.buildmodule" explosion="false"/>
<patch_object object="$actor.container"/>
?

note that it may be necesary to re-assign the Architect when using this because he may still try to use the (cached) old build module


also it may be worth a try to use .buildingmodule instead of .buildmodule - the former seems to be used for stations, the latter for ships..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Mon, 7. Sep 15, 12:04

UniTrader wrote:hmm, what about this:

Code: Select all

<destroy_object object="$actor.container.buildmodule" explosion="false"/>
<patch_object object="$actor.container"/>
?

note that it may be necesary to re-assign the Architect when using this because he may still try to use the (cached) old build module


also it may be worth a try to use .buildingmodule instead of .buildmodule - the former seems to be used for stations, the latter for ships..
This looks promising. I'll try it as soon as I get home and I'll let you know how it goes.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 7. Sep 15, 13:42

mihaib wrote:I just tested that mod and they have the same issue :(.
I would have to disagree with that :( as my released CV's do build from scratch successfully in all my tests destroying stations, recycling stations or just detaching the CV. The build locations are also releasing properly.

The buildplan does appear to belong to the buildmodule inside the CV which makes it stick to the CV and not the architect

I managed to get the whole thing to work by doing a combination of things

The first was to to clear the CV's buildmodule before destroying the station and before attempting to detach the CV. That seemed to help a lot athough you might have to wait a bit too. Without doing that the CV was indeed unusable whatever I did to the architect. It took me a couple of days trial and error to find that out.

I was hoping that the architect would work at that point but it did not. They run their own copy of the NPC_Architect script and in there are some variables that probably need to be reset for an existing architect to start a new station. The only way that I could do that without patching the NPC_Architect script was to clone the architect.

If you blow the build module then I don't think you will be building any stations with that CV.

jth

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Mon, 7. Sep 15, 14:38

jth wrote:
mihaib wrote:I just tested that mod and they have the same issue :(.
I would have to disagree with that :( as my released CV's do build from scratch successfully in all my tests destroying stations, recycling stations or just detaching the CV. The build locations are also releasing properly.

The buildplan does appear to belong to the buildmodule inside the CV which makes it stick to the CV and not the architect

I managed to get the whole thing to work by doing a combination of things

The first was to to clear the CV's buildmodule before destroying the station and before attempting to detach the CV. That seemed to help a lot athough you might have to wait a bit too. Without doing that the CV was indeed unusable whatever I did to the architect. It took me a couple of days trial and error to find that out.

I was hoping that the architect would work at that point but it did not. They run their own copy of the NPC_Architect script and in there are some variables that probably need to be reset for an existing architect to start a new station. The only way that I could do that without patching the NPC_Architect script was to clone the architect.

If you blow the build module then I don't think you will be building any stations with that CV.

jth
Hi,

I'm not sure we are talking about the same problems, so just to clarify.

I can build new stations just fine with a repacked CV, it's just that I can't choose the stage / module after each build. The architect automatically starts the next stage after the current one is built.
The other problem appears when I use the repacked CV to deploy to another station. Then it just scraps built modules and starts building them again.
You don't have any of these issues?

I don't believe there are problems with the architect. I saved the game with a repacked CV, I edited the save to remove the build queue, and I loaded that save. The CV works perfectly, with no issue and I barely touched the architect. Just some basic variable cleanup that I found in the "Cancel construction" script inside the NPC_Architect.xml file.

Also, about the order of operations, I too clear the build module, do some variable cleanups and then I detach from build location, but I don't clone the architect. Build locations are released properly if I call <destroy_object> on the station (which I don't as that is not my goal, just for testing).

I also looked at your script related to releasing the CV and I saw little difference when it comes to the order of operations or what operations we perform on the CV.

It would be great if you don't have these problems, because that would mean there is a solution. When I have the proper setup I will test again your mod and recheck these issues.

Xenon_Slayer
EGOSOFT
EGOSOFT
Posts: 13092
Joined: Sat, 9. Nov 02, 11:45
x4

Post by Xenon_Slayer » Mon, 7. Sep 15, 15:41

UniTrader wrote:hmm, what about this:

Code: Select all

<destroy_object object="$actor.container.buildmodule" explosion="false"/>
<patch_object object="$actor.container"/>
:( oh god why! Yes, I guess that may have worked if you updated the architect.

Anyway, we've found why the build plan wasn't cleared with that action and it should be fixed in an upcoming build.

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Mon, 7. Sep 15, 15:53

Xenon_Slayer wrote:
UniTrader wrote:hmm, what about this:

Code: Select all

<destroy_object object="$actor.container.buildmodule" explosion="false"/>
<patch_object object="$actor.container"/>
:( oh god why! Yes, I guess that may have worked if you updated the architect.

Anyway, we've found why the build plan wasn't cleared with that action and it should be fixed in an upcoming build.
Yes!!! :D Thanks a lot for looking at this :D. I will hold on with the mod for now and do the cleanup manually inside the save file until you release the fix.

jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth » Mon, 7. Sep 15, 21:01

mihaib wrote:
jth wrote:
mihaib wrote:I just tested that mod and they have the same issue :(.
I would have to disagree with that :( as my released CV's do build from scratch successfully in all my tests destroying stations, recycling stations or just detaching the CV. The build locations are also releasing properly.

The buildplan does appear to belong to the buildmodule inside the CV which makes it stick to the CV and not the architect

I managed to get the whole thing to work by doing a combination of things

The first was to to clear the CV's buildmodule before destroying the station and before attempting to detach the CV. That seemed to help a lot athough you might have to wait a bit too. Without doing that the CV was indeed unusable whatever I did to the architect. It took me a couple of days trial and error to find that out.

I was hoping that the architect would work at that point but it did not. They run their own copy of the NPC_Architect script and in there are some variables that probably need to be reset for an existing architect to start a new station. The only way that I could do that without patching the NPC_Architect script was to clone the architect.

If you blow the build module then I don't think you will be building any stations with that CV.

jth
Hi,

I'm not sure we are talking about the same problems, so just to clarify.

I can build new stations just fine with a repacked CV, it's just that I can't choose the stage / module after each build. The architect automatically starts the next stage after the current one is built.
The other problem appears when I use the repacked CV to deploy to another station. Then it just scraps built modules and starts building them again.
You don't have any of these issues?

I don't believe there are problems with the architect. I saved the game with a repacked CV, I edited the save to remove the build queue, and I loaded that save. The CV works perfectly, with no issue and I barely touched the architect. Just some basic variable cleanup that I found in the "Cancel construction" script inside the NPC_Architect.xml file.

Also, about the order of operations, I too clear the build module, do some variable cleanups and then I detach from build location, but I don't clone the architect. Build locations are released properly if I call <destroy_object> on the station (which I don't as that is not my goal, just for testing).

I also looked at your script related to releasing the CV and I saw little difference when it comes to the order of operations or what operations we perform on the CV.

It would be great if you don't have these problems, because that would mean there is a solution. When I have the proper setup I will test again your mod and recheck these issues.
I think that you might need more than the cancel Construction as that gives up before a single stage is completed which is a rather simpler state than a half built sttaion.

I think that we do indeed have or had different issues due to the different approaches

What I had during development was

Without cloning the Architect I couldn't build a new station on the same spot. It remembered what the state of the previous station was and refused to start from scratch. I didn't clear the various variables as I can't as I am not patching the NPC_Architect script.

Plus I also had it refuse to list the available stations until I cloned the Architect

Both went away when I cleared the build module of the CV and cloned the Architect although I think that the buildmodule caused me the bigger problem.

I thought that I ought to do a little test and detach the CV's from two stations in the same zone and then attach them to the opposite station. The stations are of different types and stages.

In both cases the CV correctly identified the build stage of the station that it was now attached to and did nothing. I could then pick the next build action. Then I told them to add some storage. The first did it correctly the second went off and built a different stage to what I told it to :(

The iffy build station is very old and dates back to at least version 2

I ought to try recycling the second station first and then rebuilding it under v3.6 and then detach and upgrade, may have a go tomorrow

Good fun this building lark :)

jth

mihaib
Posts: 36
Joined: Sat, 5. Sep 15, 12:36

Post by mihaib » Tue, 8. Sep 15, 14:43

I'm also having some other trouble with the build stages when using a repacked CV. At some point I had a "Cell Fab Matrix" factory built with a clean CV, than I detached that CV and used it to build another "Cell Fab Matrix" in another zone. It worked on auto like described, but it also did something strange at the end.

The factory was almost completed and after building a defense module the CV started rebuilding the stage 1 of the storage module while the stage 2 of that module was already built and standing.

We have these issues related to the build module and its build queue, but it seems we are in luck and the devs are going to fix the <clear_buildmodule> command. Until then I guess you could try to implement some workarounds, like the one suggested by UniTrader to destroy the build module, patch the CV and reassign the architect.

I will wait for the fix though and publish the mod after if I think it's still needed :).

Thanks to everyone for the help on this.

Post Reply

Return to “X Rebirth - Scripts and Modding”