[WIP] Space Station Recycling

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

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

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

[WIP] Space Station Recycling

Post by jth »

I have been a bit limited in my current campaign by building the wrong type of station on a precious player build location a long time ago and not wanting to go back weeks to a save game without it.

I have looked at yanking it out of the savegame and was thinking about a save game tool to do so. There is another post that has gone into this

http://forum.egosoft.com/viewtopic.php?t=361945

The manual editing does work and it is possible to disconnect the CV from the build location and get another CV to build on it again.

Then thought well why not do it properly and create a mission that recycles player stations. Destroys them with a big bang or chops them up and recycles them.

So I have been working on a StationRecycle script for the last week or so

Objective

To add a way to recycle or cleanly destroy player space stations that are no longer needed or that in 20:20 hindsight have been put up in the wrong place or where the wrong type of station was built and the build location could be better used by something else.

This must free up the build location.

It would be nice if

The station administration personnel were returned to the Albion Skunk. Via pods or just appear in the passenger compartment.
A proportion of the station build components ended up inside the build Construction Vessel (CV).
A proportion of the wares stored inside the station were ejected into space for salvage.
The recycling process produces something pretty to watch in a similar way to the build process.
The original CV can then use the recovered resources to build something else.

The nice to do options can be slotted in once essential parts are built and working.

This is my first attempt, so its slow going :(

What I am currently trying to do is get the Architect to offer a recycling mission. I have got the first bit done and found the Architect, I am currently trying to get her to interact with the player and offer a few options before triggering destruction or recycling.

I have managed to find the Mission Director guide, its help files, plus the modding guide, the XSD files and the Egosoft md scripts in the cat files. I have also found Euclid's propertyAgent at Nexusmods which has been a great help. I am looking at some of the Egosoft md scripts at the moment to try and see how they work.

Is there anything else that is out there that could help ?

Anybody got any scraps of code for mission briefings or interaction ?

Thanks
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

That sounds like a pretty ambitious project. Good luck!

The architect's dialog menu is one of the most packed and convoluted there is. There aren't any truly "blank" slots on it by default. If you just need a dialog slot to test things while you figure the rest out, you could replace the "show me your skills" conversation node when the CV is designated as a buildmodule:

Code: Select all

<replace sel="//cue[@name='DefaultComm']/actions/do_else/add_player_choice_sub[contains(@section,'cArch_charProfileMenu')]">

<do_all>   
  <do_if value="$actor.container.buildmodule and $actor.isplayerowned">
      <add_player_choice text="RECYCLE STATION" section="cArch_MyEventParam" position="right" comment="station recycle test" />
   </do_if>
   <do_else>
      <add_player_choice_sub text="{1002,3002}" position="right" section="cArch_charProfileMenu" choiceparam="[0, 0, $actor, $actor.isplayerowned and $actor.container.buildmodule?]" comment="Show me your profile"/>
   </do_else>
</do_all>

</replace>
Then you'll want to slip a target into the SectionHandler cue to tell the game what to do when your conversation option is selected:

Code: Select all

<add sel="//cue[@name='SectionHandler']/actions/do_else" pos="before">

   <do_elseif value="event.param == 'cArch_MyEventParam'">
      <!-- do various stuff -->
   </do_elseif>

</add>
That should allow you access to your experiments while you're trying to get everything else to work. If you want to make an actual "mission" out of it, then I have no idea how that's done. Another option you might consider in the long run is using a BK Universal menu option from the captain of the CV instead of a dialog option from the architect. The expected UI changes with 2.50 might open up other possibilities as well.

For moving NPC's off the station, take a look at how the <start_actor_transport actor="$guytomove" target="$placetomovehim"/> function works, and pay particular attention to how scripts and control entity designations are handled in conjunction with it. You'll find most examples in "event.param == 'c(NPCtype)_move'" sections, among others.

The other stuff you want to do is pretty far beyond anything I've done or looked at in the game.
jth
Posts: 296
Joined: Tue, 3. Jan 06, 23:31
x3

Post by jth »

Thanks for the information, its greatly appreciated
Vim Razz wrote:The architect's dialog menu is one of the most packed and convoluted there is. There aren't any truly "blank" slots on it by default.

.....

Another option you might consider in the long run is using a BK Universal menu option from the captain of the CV instead of a dialog option from the architect. The expected UI changes with 2.50 might open up other possibilities as well.
I take your point about the Architect menu slots being full.

I am currently going with the station manager as the contact instead, they have three empty slots. I am using one as a top level menu for Destroy or Recycle Station and then giving the choice for which to do with a sub menu. I will keep your code up my sleeve just in case.
Vim Razz wrote:For moving NPC's off the station, take a look at how the <start_actor_transport actor="$guytomove" target="$placetomovehim"/> function works, and pay particular attention to how scripts and control entity designations are handled in conjunction with it. You'll find most examples in "event.param == 'c(NPCtype)_move'" sections, among others.
I am currently looking at the payload part which is recycling or blowing the station up, so your pointers about moving actors are well timed. Thanks
Vim Razz wrote:If you want to make an actual "mission" out of it, then I have no idea how that's done.
I got lucky on this one and found some Egosoft test code

I have managed to find some simple mission code called MissionTimerTest from Egosofts Test_MD.xml script which shipped within the md folder of 06.cat

Here is the Egosft MissionTimerTest code plus a small cue that triggers it when you enter a sector.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<!-- Missions flyto
     jth 02/09/2014 -->

<mdscript name="RecycleStation"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="RecycleSt0" instantiate="true" >
      <conditions>
        <event_object_changed_zone object="player.primaryship"/>
      </conditions>

      <actions>
        <signal_cue cue="MissionTimerTest"/>
      </actions>
    </cue>

    <cue name="MissionTimerTest">
      <conditions>
        <event_cue_signalled/>
      </conditions>
      <actions>
        <create_group groupname="$Crates"/>

        <do_all exact="10">
          <create_object name="$Crate" groupname="$Crates" 
                         macro="macro.props_sm_container_xs_wares_macro" zone="player.zone">
            <position object="player.ship" z="1km" min="150m" max="400m"/>
          </create_object>
          <add_cargo object="$Crate" ware="ware.inv_albiontobacco" exact="2"/>
        </do_all>
        <create_mission cue="MissionTimerTest" name="'Fly to crates'" description="'blah!'" 
                        faction="faction.albionenergy" type="missiontype.kill" endtime="player.age + 500s"/>
        <set_objective cue="MissionTimerTest" group="$Crates" action="objective.flyto"/>
      </actions>
    </cue>
  </cues>
</mdscript>
My Description of what MissionTimerTest does

Ten Albion tobacco crates should appear behind you and show up as targets, the words Fly to crates and a timer should appear in the top left of the main screen. The counter should count down from 500 seconds which will be displayed as (8:20) At the end of 500 seconds the mission ends and the description and counter vanish. The crates remain. If you want to you can collect them.

There is also another more complicated example called CrateGuidance and NoCrateIconTest from Egosofts Test_MD.xml script which also shipped within the md folder of 06.cat

Between the two examples I think that there is enough to turn this into a mission

I am hoping to get a station blown up soon ...... :)

Return to “X Rebirth - Scripts and Modding”