[TUTORIAL] How to Create a Custom Gamestart

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

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

Post Reply
Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

[TUTORIAL] How to Create a Custom Gamestart

Post by Ajpav13 » Mon, 31. Aug 15, 21:08

Hello!

This tutorial / guide will have two major sections: 1) The Quick and Dirty 2) Everything Explained.

Disclaimer: I am NOT a PROGRAMMER nor claim to be any intelligent-computer-wiz (My major is a Politics - so I know how to shake hands, kiss babies, and lie that's about all lol). All the information here I have gleaned through trial and error (mostly error lol).

Also I want to state right-out: I'm kind of a flake on the forums, so apologies if I don't answer right away, but I encourage you to LEARN and EXPERIMENT yourself! (I mean if a Social Sciences major can rock this stuff out, there is no reason why you can't) :rofl:

While this looks like a lot - using this template, all you have to do is literally: copy/paste/and choose some unique names - that's it! :D

8) Using this tutorial, you should be able to whip out your own customized game start within: 20 min - 45 min! Easy-Peasy-Lemon-Squeezie!
8)
...unless you do not know how to copy/past/think of a few "new" names/or are morally incapable of stealing mine :P

References:
1. Vahadar's amazing collection of little tricks to edit your save-game
http://forum.egosoft.com/viewtopic.php?t=350404
2. Observe's awesome tutorial on creating a universe with many extra goodies and explanations of how the game works (I STRONGLY recommend you read his short Appendix Section)
http://forum.egosoft.com/viewtopic.php?t=347831
3. The official Mission Director (md) guide from Egosoft
http://www.egosoft.com/download/x_rebir ... rGuide.pdf
4. Rougey's Website - X Rebirth Section - cool website, easy for finding macros - with pictures included
http://roguey.co.uk/xrebirth/
5. Revils' list of Macros
https://github.com/Revils/XRebirthSaveE ... lation.xml
6. XML Validator (allows you to check your work - see if you made any "basic xml not-XR related mistakes")
http://www.w3schools.com/xml/xml_validator.asp
7. Theqmann's excellent XML Patch guide
http://forum.egosoft.com/viewtopic.php?t=354310

Suggested Software:
1. Notepad++ - for opening xml documents so you can edit them (kind of necessary) It is Free.
https://notepad-plus-plus.org/download/v6.8.2.html
2. Egosoft XR Catalogue extractor
http://forum.egosoft.com/viewtopic.php?t=363625
3. Nemesis1982's Save-game Editor (Trust me, you want this)
http://forum.egosoft.com/viewtopic.php?t=375817
4. Seidir's fantastically easy-to-use extractor
http://forum.egosoft.com/viewtopic.php?t=349543

TO BE DONE
1) Figure out how to add stations on game-start (If you know this please PM me!)
2) Finish the Tutorial Detailed Explanation part
3) Upload a PDF with pictures of each example
4) Make things look pretty here
5) Grab a 6-pack for myself


Anyone and everyone can use/reference/repost/or change this guide, you do not need to ask permission/credit me if you do :thumb_up: :thumb_up:
Last edited by Ajpav13 on Wed, 2. Sep 15, 04:58, edited 7 times in total.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:10

The Quick and Dirty:

The Basics of Creating a Mod - content.xml
1. Create a file in the game's "extensions" file, if the file "extensions" is not there - create it!
You can find it here: \Steam\steamapps\common\x_rebirth\extensions

2. Create a file within extensions, name it whatever the heck you want. For this example, mine is named: Ajpav_Mod . My new file's path is: \Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod

3. Within your new file (ex: Ajpav_Mod), open up Notepad++ and create a file named "content" - save it as an xml file. The path will be: \Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\content.xml

4. In content.xml copy and paste the following into the first 2 lines:
<?xml version="1.0" encoding="utf-8"?>
<content id="" name="" description="" author="" version="" date="" save="false" />
5. Now you will enter text in between the quotation marks of the 2nd line.
5a. <content id="" Put the exact name of your mod's file-name, for example, mine is Ajpav_Mod so it will be: <content id="Ajpav_Mod"

5b. name="" This will be the 'Fancy Name' of your mod, so get creative, I'm going to call mine Ajpav's Fancy Creative Mod so it will be: name="Ajpav's Fancy Creative Mod"

5c. description="" This is a short description of what your mod does. So mine will look like:
description="This mod will allow you to have a new game-start with a new cockpit, weapons, missiles, extra money and two ships"

5d. version="" This states the version your mod is in, it is a number that when divided by 100 becomes a decimal. so this is the first iteration of this mod, so I will call it "010" which divided by 100 becomes: 0.1
It will look like this: version="010"

5e. author="" This is the name you go by on steam or the forums, pretty much so that you can get credit for creating this. My name is Ajpav so it will be: author="Ajpav"

5f. date="" this is the date you released the mod, a very nice accompaniment to the version, so that users can take into account any recent patches. Mine will be: date="2015-08-30"

5g. save="false" DO NOT MESS WITH THIS!!! What it does: it allows your mod to be removed from an ongoing game and for that game to continue despite it being removed, just keep the value as "false" unless you really know what you're doing (which, if you're reading this, you probably don’t - no offense hehehe)

All Together, my new content.xml looks like this:
<?xml version="1.0" encoding="utf-8"?>
<content id="Ajpav_Mod" name="Ajpav's Fancy Creative Mod" description="This mod will allow you to have a new game-start with a new cockpit, weapons, missiles, extra money and two ships" author="Ajpav" version="010" date="2015-08-30" save="false" />
Last edited by Ajpav13 on Thu, 17. Sep 15, 11:45, edited 5 times in total.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:11

Creating the gamestarts.xml document

1. Open up your mod's file (mine is Ajpav_Mod) and create a new file, you must name it: "libraries"

Thus my new file's path becomes: \Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\libraries

2. Open up Notepad++ and create a file named "gamestarts" - save it as an XML file. The path will be: \Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\libraries\gamestarts.xml

3. In your new gamestarts.xml document copy and paste the following
<diff>
<add sel="/gamestarts">
<gamestart id=" " name=" " description=" " image=" ">
<location galaxy="xu_ep1_universe_macro" zone=" ">
<position x="0.0" y="0.0" z="0.0" />
<rotation yaw="0.0" pitch="0.0" roll="0.0" />
</location>
<player macro="player" money="">
<ship macro=" ">
<!-- This is for personal notes: Ajpav is AWESOME -->
<upgrade macro=" " />
<ammo macro=" " />
</ship>
</player>
</gamestart>
</add>
</diff>
4. gamestart id=" " Create a unique gamestart id name that is short, that you can reference later. For mine I am going to call it: ajpav_start so mine will become: gamestart id="ajpav_start"

5. name=" " Create a title for your new game-start, this is the name that will show up in the start-menu of X Rebirth when selecting a game. Mine is called: name="Terran Bro"

6. description=" " You can write out a small description here, this will show up in the start-menu of X Rebirth when selecting a game. Mine will be: description="After hijacking a container of spacefuel, you and your broskis bro out and wake up hungover on the Skunk, with matching tatoos, and a Balor 6km away calling you Commander... WTH happend?

Location: {20003,1}, {20004,7}, {20005,27}

Property:
- 1x {20101,3901}"


6a. NEVER WRITE THE FOLLOWING 4 CHARACTERS BY THEMSELVES: < > " &
-Why? Because they are used for coding in xml, if you want to use them they are respectively: &lt; &gt; &quot; &amp;

6b. & 10;

is the code for a new paragraph, like hitting your "Enter" key once.
Edit: use & 10; without a space between the "&" and the "10;" part - for some silly reasons, the forum reads it as a new paragraph and will not visually display it together. :evil:

6c. {20003,1} and all the other sets of numbers in braces reference specific text the language files in X Rebirth. They can be found in the Game's folder labeled "t". The 1st number is the "page id", the 2nd is the "t id". This allows you to add common text found in-game and have it automatically translated to the player's language choice.
Use either of the extractors, or the save-game editor listed above and check out the 0001-L034.xml document (which is English), and you will see on that the following numbers refer to these text items. Its pretty self-explanatory after you look at the document.

{20003,1} is "Albion"
{20004,7} is "Far Out"
{20005,27} is "The Big Empty"
{20101,3901} is "Balor"


7. image=" " is for all the different game-start images you see prior to selecting a game. (At time of writing, I do not know how to add your own game-images). I chose: image=" gamestart_1
">


Your Options from the stock images are:

gamestart_1
gamestart_2
gamestart_3
gamestart_4
gamestart_5
gamestart_6


8. zone=" " is the zone that you choose to start the player in. The easiest way to figure this out is to fly to the zone you want the player to start in and take a "picture" of the zone. In your game-save files, located in Documents\Egosoft\X Rebirth\ (this file will be a 9-digit number)\screenshots , you will see a text-document accompanying the picture you took. Copy and paste the part in quotations found in:
teleport zone=""

So for the example, I pasted the part in quotations from my picture's text-document: zone=" tzonecluster_b_sector04_zone27_macro ">

This is the zone called "The Big Empty"

9. XYZ Coordinates and yaw, pitch and roll: If these values are left as is, when you spawn a player in a zone, they will be spawned in the exact center of that zone.

Not entering checked coordinates is not always good, because perhaps there is a station there (and you could accidentally spawn the player inside the station) Or perhaps you want them to be oriented to an object of interest.

The easiest way to do this is to take a picture of where you want the player to spawn and what you want them to be looking at, and using the method above, simply enter or extrapolate the values from the picture's accompanying text document.
<position x="0.0" y="0.0" z="0.0" />
<rotation yaw="0.0" pitch="0.0" roll="0.0" />
In my game-start, I want the player to be looking toward the PMC Plutarch Exchange station from the side, so I took a picture of where I wanted the player to start & entered the values from that text document:
<position x="5801.25" y="2767.624" z="18059.982" />
<rotation yaw="-148.48059" pitch="-4.85616" roll="0.0" />
10. <player macro="player" money=""> is the amount of starting money you are choosing to give the player. I want my player to start with 6,969 Credits, so I have entered:
<player macro="player" money="6969">
11. <ship macro=" "> This is the cockpit-type you start with. I want my player to start with the Jonferco 'Hawk Mk3' Combat Configuration, so mine will be:
<ship macro=" unit_player_ship_b_macro ">
Your choices are:

unit_player_ship_macro is the Argon Shipwrights 'Pride Mk1' Adventurer Configuration (the normal Skunk Cockpit)
unit_player_ship_a_macro is the Jonferco 'Trapezium Mk2' Merchant Configuration
unit_player_ship_b_macro is the Jonferco 'Hawk Mk3' Combat Configuration
unit_player_ship_c_macro is the Jonferco 'Crane Mk2' Management Configuration

12. <!-- Notes to Self -->, any text that you place in between this: <!-- --> are personal notes within any xml document you create, they will not be read by the game, and can help you sort your document as you make your mod. I want to remind myself that I'm AWESOME, so I wrote: <!-- This is for personal notes: Ajpav is AWESOME -->

13. <upgrade macro=" " /> is for upgrades, this includes: Weapons, Shields, Engines, Scanners, Targeting Computers, and Trading computers.
Your Options are the following:

-Weapons:
weapon_player_mining_mk1_macro is the Mining Laser
weapon_player_impulse_mk1_macro is the Pulsed Maser Mk1
weapon_player_impulse_mk2_macro is the Pulsed Maser Mk2
weapon_player_machinegun_mk1_macro is the Particle Repeater Mk1
weapon_player_machinegun_mk2_macro is the Particle Repeater Mk2
weapon_player_plasma_mk1_macro is the Plasma Cannon Mk1
weapon_player_plasma_mk2_macro is the Plasma Cannon Mk2
weapon_player_shotgun_mk1_macro is the Inertial Hammer Mk1
weapon_player_shotgun_mk2_macro is the Inertial Hammer Mk2

-Shields
shieldgenerator_player_bal_mk1_macro is the Steady Shield Mk1
shieldgenerator_player_bal_mk2_macro is the Steady Shield Mk2
shieldgenerator_player_bal_mk3_macro is the Steady Shield Mk3
shieldgenerator_player_bal_mk4_macro is the Steady Shield Mk4
shieldgenerator_player_bal_mk5_macro is the Steady Shield Mk5
shieldgenerator_player_cap_mk2_macro is the Behemoth Shield Mk2
shieldgenerator_player_cap_mk3_macro is the Behemoth Shield Mk3
shieldgenerator_player_cap_mk4_macro is the Behemoth Shield Mk4
shieldgenerator_player_cap_mk5_macro is the Behemoth Shield Mk5
shieldgenerator_player_rec_mk2_macro is the Dashing Shield Mk2
shieldgenerator_player_rec_mk3_macro is the Dashing Shield Mk3
shieldgenerator_player_rec_mk4_macro is the Dashing Shield Mk4
shieldgenerator_player_rec_mk5_macro is the Dashing Shield Mk5

-Engines:
engine_player_bal_mk1_macro is the Equalized Engine Mk1
engine_player_bal_mk3_macro is the Equalized Engine Mk3
engine_player_bal_mk4_macro is the Equalized Engine Mk4
engine_player_bal_mk5_macro is the Equalized Engine Mk5
engine_player_man_mk2_macro is the Sidewinder Engine Mk2
engine_player_man_mk3_macro is the Sidewinder Engine Mk3
engine_player_man_mk4_macro is the Sidewinder Engine Mk4
engine_player_man_mk5_macro is the Sidewinder Engine Mk5
engine_player_spe_mk2_macro is the Supercharged Engine Mk2
engine_player_spe_mk3_macro is the Supercharged Engine Mk3
engine_player_spe_mk4_macro is the Supercharged Engine Mk4
engine_player_spe_mk5_macro is the Supercharged Engine Mk5

-Scanners:
unit_player_ship_scanner_1_macro is the Basic Scanner
unit_player_ship_scanner_2_macro is the Advanced Scanner
unit_player_ship_scanner_3_macro is the Police Scanner

-Targeting Systems
software_target_computer_mk1_macro is the Targeting System Extension Mk1
software_target_computer_mk2_macro is the Targeting System Extension Mk2

-Trading Computers
software_trading_computer_mk1_macro is the Trading Computer Mk1
software_trading_computer_mk2_macro is the Trading Computer Mk2
software_trading_computer_mk3_macro is the Trading Computer Mk3

14. <ammo macro=" " /> is the missiles your ship will have as well as Marines, (And Marines are in-general, badass - kind of the supreme-warriors of mankind, especially U.S. Marines - just saying).

-Missiles:
missile_player_dumbfire_macro are V Crushers
missile_player_dumbfire_heavy_macro are Meteorites
missile_player_guided_light_macro are Starflashers
missile_player_guided_macro are Sunstalkers
missile_player_guided_heavy_macro are Hellbusters
missile_player_swarm_macro are Astrobees
missile_player_swarm_heavy_macro are Tristars
missile_player_torpedo_macro are Novadrones
missile_player_emp_macro are Constrictors

-Marines:
character_argon_male_marine_mk1_macro are Recruit Marines
character_argon_male_marine_mk2_macro are Veteran Marines
character_argon_male_marine_mk3_macro are Elite Marines

14. And you're done with the gamestarts.xml Below is the text-version of my gamestarts.xml for reference.
<?xml version="1.0" encoding="utf-8"?>
<diff>
<add sel="/gamestarts">
<gamestart id="ajpav_start" name="Terran Bro" description="After hijacking a container of spacefuel, you and your broskis bro out and wake up hungover on the Skunk, with matching tatoos, and a Balor 6km away calling you Commander... WTH happend?.

Location: {20003,1}, {20004,7}, {20005,27}

Property:
- 1x {20101,3901}" image="gamestart_1">
<location galaxy="xu_ep1_universe_macro" zone="tzonecluster_b_sector04_zone27_macro">
<position x="5801.25" y="2767.624" z="18059.982" />
<rotation yaw="-148.48059" pitch="-4.85616" roll="0.0" />
</location>
<player macro="player" money="696969">
<ship macro="unit_player_ship_b_macro">
<!-- ship weapons, shields, engines, and upgrades -->
<upgrade macro="weapon_player_impulse_mk2_macro" />
<upgrade macro="weapon_player_machinegun_mk2_macro" />
<upgrade macro="weapon_player_plasma_mk2_macro" />
<upgrade macro="weapon_player_shotgun_mk2_macro" />
<upgrade macro="weapon_player_mining_mk1_macro" />
<upgrade macro="shieldgenerator_player_cap_mk5_macro" />
<upgrade macro="engine_player_bal_mk5_macro" />
<upgrade macro="unit_player_ship_scanner_3_macro" />
<ammo macro="missile_player_dumbfire_heavy_macro" count="20" />
<ammo macro="missile_player_swarm_macro" count="20" />
<ammo macro="missile_player_guided_heavy_macro" count="20" />
<ammo macro="missile_player_torpedo_macro" count="20" />
<ammo macro="missile_player_emp_macro" count="20" />
</ship>
</player>
</gamestart>
</add>
</diff>
15. STOP: Do the FOLLOWING IN EXACT ORDER!!!!!
Spoiler
Show
15a. Stand Up
15b. Grab a Beer
15c. Open the Beer
15d. Drink the Beer
-You have now successfully created a new game-start!!! AWESOME!!! Ensure you test it out & enjoy creating custom game-starts! Next, I will show you how to set factions to known, how to create ships, how to create crew and NPCs that are of your faction, (To Be Added: Creating Stations) at the start of your game.
Last edited by Ajpav13 on Mon, 7. Sep 15, 00:24, edited 13 times in total.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:12

Setting Factions to Known and Creating Ships at start of game.

1. Create a file named "md" in your Mod's folder, (This is referred to as the Mission Director folder)
The Path will be:
\Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\md

2. Create an XML document, name it whatever you want - so mine will be named: Setup_Gamestarts_Ajpav
The Path will be:
\Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\md\Setup_Gamestarts_Ajpav

3. Copy and Paste this into your new XML document:
<?xml version="1.0" encoding="utf-8"?>
<mdscript name=" " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name=" " module=" ">
<conditions>
<event_cue_signalled cue="md.Setup.GameStart"/>
</conditions>
<!-- Open up all Jumpgates -->
<actions>
<signal_cue cue="md.Setup.Open_Jumpgates_Lib"/>

<!-- Allows the player to know the factions exist -->
<set_faction_known faction="faction.heartofalbion" known="true"/>
<set_faction_known faction="faction.reivers" known="true"/>

<!-- Allows the now know factions to be seen in the Player Status ui by adding them to the encyclopedia -->
<add_encyclopedia_entry type="factions" item="faction.heartofalbion.id" />
<add_encyclopedia_entry type="factions" item="faction.reivers.id" />

<!-- Creates a Ship in the zone the player is in which is defined as "player.zone"-->
<create_ship name="" macro="" zone="player.zone">
<owner exact="faction.player" overridenpc="true"/>
<pilot actor="null"/>
<defence actor="null"/>
<engineer actor="null"/>
<cargo>
<wares list="[ware.fuelcells]">
<fillpercent exact="100"/>
</wares>
</cargo>
<units>
<unit category="unitcategory.defence" mk="2" exact="43"/>
<unit category="unitcategory.defence" mk="4" exact="43"/>
<unit category="unitcategory.defence" mk="6" exact="43"/>
<unit category="unitcategory.welder" mk="1" exact="21"/>
</units>
<drop ref=""/>
<safepos object="player.playership" max="6km" radius="2km"/>
</create_ship>
</actions>
</cue>
</cues>
</mdscript>
4. <mdscript name=" " In the quotations, put whatever you named this XML docutment in Step 2 of this subsection, I named this document "Setup_Gamestarts_Ajpav" so mine will be: <mdscript name="Setup_Gamestarts_Ajpav"

5. cue name=" " Create a name for this "cue". A cue generally has 3 parts: The Cue, The Conditions for the cue to take place, and The Actions that come after those conditions have been met.
So what is a cue? The short answer is: it tells the X Rebirth game, "Hey X Rebirth! I got a few Conditions! When they happen I want you to take the following Actions! Now DO IT!"

-IMPORTANT: Cue names, MUST ALWAYS
1) Be named with a CAPITAL Letter
2) Be unique within the XML document you are working with. (i.e. no other cue can have the same name).

I am naming this cue: <cue name="Setup_Create_Stuff"

3) module=" "> The name for this MUST be the "gamestart id" you gave the 2nd XML Document we made located in: \Steam\steamapps\common\x_rebirth\extensions\Ajpav_Mod\libraries\gamestarts.xml

Using my example, you will recall I typed: gamestart id="ajpav_start", therefore my module here in this XML document is: module="ajpav_start ">

4) <set_faction_known faction="faction.heartofalbion" known="true"/> This allows the player to "know" that some factions exist, a player MUST know a faction exists in order for they player to have the faction listed in the encyclopedia and therefore showing up in the game's ui (user interface). In the example I am letting the player start knowing the Heart of Albion and the Reivers.

-To find a XML name for a player to "know" open up any game-save file located in Documents\Egosoft\X Rebirth\ (this file will be a 9-digit number)\save
The various factions will be one of the first blocks listed. (Always keep the 1st part "faction." Period included when adding faction XML names)

-If you do NOT want the player to start out knowing any factions, simply delete the entire line between < and >. (So delete this: <set_faction_known faction="faction.heartofalbion" known="true"/>)

5) <add_encyclopedia_entry type="factions" item="faction.heartofalbion.id" /> allows the now known faction to the player's encyclopedia and thus be visually seen in the player's ui when he looks for his faction standing scores.

-Use the same method for looking up and replacing other factions

-If you want the player to NOT see the faction in their ui until they actually "meet" the faction in-game, simply delete the entire line between the < and > (So delete this: <add_encyclopedia_entry type="factions" item="faction.heartofalbion.id" />).

6) Creating a Ship at Start: <create_ship name=" " This starts the process of creating a ship. Choose any name, this will be a name the game uses only within this XML document to find your ship.

This name MUST:

-Be a unique name within the XML document
-Start with the "$" sign

Because I am going to create a Balor, I have decided to refer to this ship as "$pavbalor", I will use this name later within the document. So mine becomes: <create_ship name="$pavbalor"

7. macro=" " This is where you choose the type of ship you want the game to create.

To find the ship's "macro" go to this web-site: http://roguey.co.uk/xrebirth/ships/ and look through the ships Rougey has listed. On his website, under Balor, you can see next to "XML macro (for devs)" it lists the macro as: units_size_l_single_attack_ship_macro
So for mine I will make it: macro="units_size_l_single_attack_ship_macro"

8. zone="player.zone"> this tells the game to create the ship in the same zone the player is currently located at. I will cover changing this zone to another one in the next tutorial.

9. <owner exact="faction.player" this assigns the Balor I am creating to the player's faction and thus ownership. If you want another ship to show up at game start and be a part of another faction (like maybe a fat Titurel owned by the Reivers that the player can board and capture) you change it here.

10.
<cargo>
<wares list="[ware.fuelcells]">
<fillpercent exact="100"/>
</wares>
</cargo>
This part creates wares within the ship's cargo hold, I am adding Fuel Cells so that the ship can jump. As you can see Fuel Cells have a special id that is used.

NOT ALL WARES HAVE THE SAME FORMAT FOR THEIR IDs!!! Some have names that are pluralized, other singular, and still other COMPLETELY DIFFERENT ID NAMES are used.

To add other wares and find out their id, follow the format (replacing "fuelcells" with their id) which can be found here: http://roguey.co.uk/xrebirth/wares/ . On Rougey's website, click one of the dialogue buttons and then click on the ware you want, just like the Balor, it will be under "Ware Id (for devs)".

Note that to determine the amount, you have to select a percentage of cargo space that will be used for that ware. <fillpercent exact="100"/> tells the game to use the Balor's fuel-classed-cargo space and fill it up to 100%.
11.
<units>
<unit category="unitcategory.defence" mk="2" exact="43"/>
<unit category="unitcategory.defence" mk="4" exact="43"/>
<unit category="unitcategory.defence" mk="6" exact="43"/>
<unit category="unitcategory.welder" mk="1" exact="21"/>
</units>
This part allows you to add drones to the ship you created. <unit category="unitcategory.defence" mk="2" creates the actual drone, and exact="43"/> is the number of drones you will create.

Your options here are:

<unit category="unitcategory.defence" mk="1 This is the Interceptor URV Mk1
<unit category="unitcategory.defence" mk="2" This is the Interceptor URV Mk2
<unit category="unitcategory.defence" mk="3" This is the Intrepid URV Mk1
<unit category="unitcategory.defence" mk="4" This is the Intrepid URV Mk2
<unit category="unitcategory.defence" mk="5" This is the Overrun URV Mk1
<unit category="unitcategory.defence" mk="6" This is the Overrun URV Mk2
<unit category="unitcategory.welder" mk="1" This is the Construction URV
<unit category="unitcategory.transport" mk="1" This is the Cargolifter URV
<unit category="unitcategory.attack" mk="1" This is the Assault URV (the one that still doesn't work)
<unit category="unitcategory.gascollector" mk="1" This is the Scoop Collector URV Mk1
<unit category="unitcategory.gascollector" mk="2" This is the Scoop Collector URV Mk2
<unit category="unitcategory.orecollector" mk="1" This is the Surface Miner URV Mk1
<unit category="unitcategory.orecollector" mk="2" This is the Surface Miner URV Mk2

12. <drop ref="ship_large_military"/> I don't know what a ship's "drop ref" is, but I know you MUST HAVE IT. To find the "drop ref" look in your XRebirth game libraries\ships.xml . Do a search using the ship's macro (which for the Balor is: units_size_l_single_attack_ship_macro) and find it's drop ref, copy and paste it here.

13. <safepos object="player.playership" max="6km" radius="2km"/> Remember when you had to go find a place to start the player, and we wanted to make sure we were clear of any stations or other game - objects? This allows you to create the ship (the Balor in this example) 6km away from a sphere surrounding the player by 2km.
When you use this, take into account the size of the ship itself, (for example, a Fulmekron is over 1km in length I think). The safepos allows you to ensure that no ship is created in the same space as another object.

Following these steps, I have successfully created a ship (without a crew) that will be spawned on game start in the zone that the player is located in. For this example, that zone happens to be "The Big Empty"

Everything all together will look like this:
<mdscript name="Setup_Gamestarts_Ajpav" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Setup_Create_Stuff" module="ajpav_start">
<conditions>
<event_cue_signalled cue="md.Setup.GameStart"/>
</conditions>
<!-- Open up all Jumpgates -->
<actions>
<signal_cue cue="md.Setup.Open_Jumpgates_Lib"/>

<!-- Allows the player to know the factions exist -->
<set_faction_known faction="faction.heartofalbion" known="true"/>
<set_faction_known faction="faction.reivers" known="true"/>

<!-- Allows the now know factions to be seen in the Player Status ui by adding them to the encyclopaedia -->
<add_encyclopedia_entry type="factions" item="faction.heartofalbion.id" />
<add_encyclopedia_entry type="factions" item="faction.reivers.id" />

<!-- Creates a Ship: Balor Size L in the zone the player is in which is defined as "player.zone"-->
<create_ship name="$pavbalor" macro="units_size_l_single_attack_ship_macro" zone="player.zone">
<owner exact="faction.player" overridenpc="true"/>
<pilot actor="null"/>
<defence actor="null"/>
<engineer actor="null"/>
<cargo>
<wares list="[ware.fuelcells]">
<fillpercent exact="100"/>
</wares>
</cargo>
<units>
<unit category="unitcategory.defence" mk="2" exact="43"/>
<unit category="unitcategory.defence" mk="4" exact="43"/>
<unit category="unitcategory.defence" mk="6" exact="43"/>
<unit category="unitcategory.welder" mk="1" exact="21"/>
</units>
<drop ref="ship_large_military"/>
<safepos object="player.playership" max="6km" radius="2km"/>
</create_ship>
</actions>
</cue>
</cues>
</mdscript>
Last edited by Ajpav13 on Wed, 2. Sep 15, 04:59, edited 10 times in total.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:13

Creating NPCs on a Ship

1. Copy all the green text in the box below, and paste in the XML document from above (the one you used to create the ship) MAKE SURE you paste it below the ship you just created, at the bottom, in between </create_ship> and </actions>
<find_dock_location name="$Dock" container="" size="tag.dock_p"/>
<create_platform_actor name="$Commander" type="entitytype.commander" dockingbay="$Dock.component" ref="trader_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$DefenceNPC" type="entitytype.defencecontrol" dockingbay="$Dock.component" ref="fighter_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$Engineer" type="entitytype.engineer" dockingbay="$Dock.component" ref="engineer_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<assign_pilot actor="$Commander" object=""/>
<assign_defence_manager actor="$DefenceNPC" object=""/>
<assign_engineer actor="$Engineer" object=""/>
<set_object_commander object="" commander="player.primaryship"/>
<start_script object="$Commander" name="'player.default'"/>
<start_script object="$DefenceNPC" name="'fight.defend.capital'"/>
<start_script object="$Engineer" name="'engineer.ai'"/>
<do_if value="not @md. ">
<set_object_name object="" name="''" />
</do_if>
2. Creating NPCs (Non-Playable-Characters) (in this case, the crew)
<find_dock_location name="$Dock" container="" size="tag.dock_p"/>
<create_platform_actor name="$Commander" type="entitytype.commander" dockingbay="$Dock.component" ref="trader_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
With this we will create each NPC on the Balor's dock.

2a. <find_dock_location name="$Dock" The name you choose (as with all names starting with a $) must be unique within the document. I'm calling this one $Dock.
2b. container="" simply use the unique name you chose for your ship here (the name we came up with in step 6 of the Creating a Ship part). The unique name for my ship is: $pavbalor, I will enter it in like this:container="$pavbalor"
2c. <create_platform_actor name="$Commander" this is a unique name that you must create for the NPC within the XML document. I am using $Commander
2d. dockingbay="$Dock.component" use the unique name you created for the dock location in 2a, DON'T FORGET TO ADD THE ".component" part after, INCLUDING THE PERIOD!
2e. ref="trader_albion_random"> this chooses the NPC's body and the dialogue they will use. You can find different groups for you to use in XRebirth game libraries\characters.xml
2f. <owner exact="faction.player"/> Like in step 9 from Creating a Ship, this determines the faction of the NPCs you are creating on the ship, THE FACTION OF THE NPCs ON A SHIP MUST MATCH THE FACTION OF THE SHIP ITSELF. If you don't do that, your computer can melt down and trigger a nuclear war!!! (ok, maybe not that bad, but just don't do it!)

-Using this format, I have created a Commander, Defense Officer, and Engineer for the ship. All together mine will look like this:
<find_dock_location name="$Dock" container="$pavbalor" size="tag.dock_p"/>
<create_platform_actor name="$Commander" type="entitytype.commander" dockingbay="$Dock.component" ref="trader_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$DefenceNPC" type="entitytype.defencecontrol" dockingbay="$Dock.component" ref="fighter_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$Engineer" type="entitytype.engineer" dockingbay="$Dock.component" ref="engineer_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
3. <set_object_commander object="" commander="player.primaryship"/> This allows you to start the game with the ship (in this case, the balor) being placed in the player's squad. In the quotations of the part object="" place the unique name you chose for your ship in the create ship part above, I chose: $pavbalor, so mine will look like this:
<set_object_commander object="$pavbalor" commander="player.primaryship"/>

To assign the ship to another one you've created, simply replace $pavbalor, in <set_object_commander object="$pavbalor" with the unique XML you created for the ship that will be the follower, and replace player.primaryship in commander="player.primaryship"/> with the unique XML ship name for the commanding ship.

-If you do NOT wish the ships to be a part of any squad, delete the entire line. So to remove the Balor in this example from the Player's squad delete all of this: <set_object_commander object="$pavbalor" commander="player.primaryship"/>

4.
<start_script object="$Commander" name="'player.default'"/>
<start_script object="$DefenceNPC" name="'fight.defend.capital'"/>
<start_script object="$Engineer" name="'engineer.ai'"/>
Tells the newly created NPCs to start doing their jobs. (i.e the Commander will "command", the Defense Officer will "defend", and the Engineering Officer will "engineer stuff"). For now, at this stage there is only one you need to worry about changing.

In <start_script object="$Commander" name="'player.default'"/> , 'player.default' tells the Commander to follow the Skunk. Not very good if you do not have the ship in the same squad as the Skunk.
So you can change it to: 'move.patrol' which tells the Commander to Patrol the zone, or 'move.escort' which tells the Commander to escort his leader in his current squad. DO NOT FORGET THE EXTRA QUOTATION MARKS!!!

5. Changing the name of your ship
<do_if value="not @md.">
<set_object_name object="" name="" />
</do_if>
This allows you to change the name of your newly created ship on start. If you do not want a custom name, simply delete it all.

<do_if value="not @md."> after the period, but before the end quotation mark, enter your ship's unique name, mine is $pavbalor, so mine will look like:<do_if value="not @md.$pavbalor">

<set_object_name object="" within the quotation marks once again enter your ship's unique name, mine is $pavbalor, so mine will look like:<set_object_name object="$pavbalor"

name="" /> Now enter the name you want with additional single quotation marks ' ' surrounding the name you pick - I am naming my ship Enterprise - so mine will look like: name="'Enterprise'" /> DO NOT FORGET THE EXTRA QUOTATION MARKS!!!

After following those above steps, all together mine will look like:
So mine will look like
<do_if value="not @md.$pavbalor">
<set_object_name object="$pavbalor" name="'Enterprise'" />
</do_if>
6. So the entire text I have created for this example in Setup_Gamestarts_Ajpav (including the Balor I first created) will be this:
<?xml version="1.0" encoding="utf-8"?>
<mdscript name="Setup_Gamestarts_Ajpav" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
<cues>
<cue name="Setup_Create_Stuff" module="ajpav_start">
<conditions>
<event_cue_signalled cue="md.Setup.GameStart"/>
</conditions>
<!-- Open up all Jumpgates -->
<actions>
<signal_cue cue="md.Setup.Open_Jumpgates_Lib"/>

<!-- Allows the player to know the factions exist -->
<set_faction_known faction="faction.heartofalbion" known="true"/>
<set_faction_known faction="faction.reivers" known="true"/>

<!-- Allows the now know factions to be seen in the Player Status ui by adding them to the encyclopaedia -->
<add_encyclopedia_entry type="factions" item="faction.heartofalbion.id" />
<add_encyclopedia_entry type="factions" item="faction.reivers.id" />

<!-- Creates a Ship: Balor Size L in the zone the player is in which is defined as "player.zone"-->
<create_ship name="$pavbalor" macro="units_size_l_single_attack_ship_macro" zone="player.zone">
<owner exact="faction.player" overridenpc="true"/>
<pilot actor="null"/>
<defence actor="null"/>
<engineer actor="null"/>
<cargo>
<wares list="[ware.fuelcells]">
<fillpercent exact="100"/>
</wares>
</cargo>
<units>
<unit category="unitcategory.defence" mk="2" exact="43"/>
<unit category="unitcategory.defence" mk="4" exact="43"/>
<unit category="unitcategory.defence" mk="6" exact="43"/>
<unit category="unitcategory.welder" mk="1" exact="21"/>
</units>
<drop ref="ship_large_military"/>
<safepos object="player.playership" max="6km" radius="2km"/>
</create_ship>

<find_dock_location name="$Dock" container="$pavbalor" size="tag.dock_p"/>
<create_platform_actor name="$BalorCommander" type="entitytype.commander" dockingbay="$Dock.component" ref="trader_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$BalorDefenceNPC" type="entitytype.defencecontrol" dockingbay="$Dock.component" ref="fighter_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<create_platform_actor name="$BalorEngineer" type="entitytype.engineer" dockingbay="$Dock.component" ref="engineer_albion_random">
<owner exact="faction.player"/>
</create_platform_actor>
<assign_pilot actor="$BalorCommander" object="$pavbalor"/>
<assign_defence_manager actor="$BalorDefenceNPC" object="$pavbalor"/>
<assign_engineer actor="$BalorEngineer" object="$pavbalor"/>
<set_object_commander object="$pavbalor" commander="player.primaryship"/>
<start_script object="$BalorCommander" name="'player.default'"/>
<start_script object="$BalorDefenceNPC" name="'fight.defend.capital'"/>
<start_script object="$BalorEngineer" name="'engineer.ai'"/>
<do_if value="not @md.$pavbalor">
<set_object_name object="$pavbalor" name="'Enterprise'" />
</do_if>
</actions>
</cue>
</cues>
</mdscript>
7. STOP! Do the following in EXACT ORDER!
Spoiler
Show
7a. Click this link: https://www.youtube.com/watch?v=3GSbJkU9Lmw
7b. Grab that Beer again
7c. Take a drink, take a BIG drink!!!
You now have successfully created a custom game start with a Ship AND a Crew!!!! WELL DONE!!!
Last edited by Ajpav13 on Wed, 2. Sep 15, 05:15, edited 12 times in total.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:25

I am saving this space for stuff to be added to the tutorial

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:26

I am saving this space for stuff to be added to the tutorial

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Mon, 31. Aug 15, 21:27

I am saving this space for stuff to be added to the tutorial - feel free to start your comments after this post. This is all the space I need (I think lol)

Sparky Sparkycorp
Moderator (English)
Moderator (English)
Posts: 8074
Joined: Tue, 30. Mar 04, 12:28
x4

Post by Sparky Sparkycorp » Tue, 1. Sep 15, 20:44

That's a helpful piece of work. I may not be a modder but I appreciate your helping of others. Thanks.

Ajpav13
Posts: 72
Joined: Sun, 16. Aug 15, 05:30

Post by Ajpav13 » Wed, 2. Sep 15, 04:50

"One is glad to be of service" :thumb_up:

I hope it is easy to understand and read for those who are not computer-wizards!

Post Reply

Return to “X Rebirth - Scripts and Modding”