[Q] Jobs and Select

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

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

User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

[Q] Jobs and Select

Post by Fumblesneeze »

Heya,

I have a few more questions, maybe you guys can help.

1.) Does anyone know exactly how "jobs" work and what they are supposed to do?

2.) Does anyone know where the values for the <select/> statement are coming from?
Mad_Joker
Posts: 274
Joined: Sun, 14. May 06, 11:21
x3

Post by Mad_Joker »

The jobs are basically the tasks that are given to NPC ships that populate the universe (like "go mining there for that", or "patrol that sector").

The select statement is defined in libraries.xsd.

The main attributes are faction, tag and race. What the statement does is it randomly selects a suitable character based on the criteria to fly the ship/be the engineer etc. of that ship that is assigned that job.
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I know what <select> does, but where does it have it's list from? (It can do also create ships, e.g.

Code: Select all

            <select size="class.ship_l" tags="[tag.container]"/>
will give you a freighter ship that can carry container-cargo.)


Concerning jobs, if the player gives one of his ships the command to follow, will that be a job, then? What is the connection between the jobs and the ai scripts?
Streaming while writing mods: twitch.tv/fumblesneeze
Mad_Joker
Posts: 274
Joined: Sun, 14. May 06, 11:21
x3

Post by Mad_Joker »

Well, I guess the list is a global one, i.e. for characters there is a CharacterDB somewhere, which contains lots of characters and names, and for ships all ships that exist in the game.

And no, player ships don't have jobs, only AI scripts. An AI script is something that is executed on an entity (e.g pilot, engineer etc). A job describes the entity that will execute the job and then starts the corresponding AI script on it.

For example:

Code: Select all

<job id="can_chapter2_light_trader_water_medium_sector18" name="{20204,1601}">
    <basket basket="water"/>
    <task task="trade.ship">
      <param name="range" string="cluster"/>
    </task>
    <quota sector="3" zone="1"/>
    <location class="sector" macro="cluster_d_sector18_macro"/>
    <ship>
      <select faction="canteran" tags="liquid" size="ship_m"/>
      <owner exact="canteran" overridenpc="true"/>
    </ship>
  </job>
will create the M sized liquid freighter piloted by a random canteran pilot and will start trading water via the 'trade.ship' AI script in the cluster defined by "cluster_d_sector18_macro".
Vim Razz
Posts: 1842
Joined: Tue, 2. Nov 10, 02:20
x4

Post by Vim Razz »

Also note: Specific jobs in the jobs file can be activated or deactivated by MD script, which is done at several points in the plot. \md\Setup.xml seems to handle most of that.
User avatar
Fumblesneeze
Posts: 75
Joined: Tue, 26. Nov 13, 10:07
x3tc

Post by Fumblesneeze »

I'm still not sure what this is used for that couldn't be done with pure md?

Next question: Are these jobs spawning ships/npcs or are they filtering and when certain conditions are met, run a certain script?

As in the case of the job you posted earlier, is this job checking if there is middle sized ship of the canteran faction with water in storage, and then assigns it the trade script, or is it creating a ship that fits these conditions and then assigns it that ai?
Streaming while writing mods: twitch.tv/fumblesneeze

Return to “X Rebirth - Scripts and Modding”