Galaxy Editor...

The place to discuss scripting and game modifications for X³: Reunion.

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

Bulska
Posts: 34
Joined: Mon, 19. Feb 07, 17:02
x3

Post by Bulska »

Wait, everything goes excactly as you said now... thanks but I want to name my sector xD Its now called: [string 7:1021106]

Naming it would be the thing I need to know, then I can make my own Universe :D


EDIT:
Thanks to you, I've made this view when exitting the North Gate (only gate so far)
http://img180.imageshack.us/img180/622/ ... torot1.png
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

That looks very nice, and is showing you have the potential to make some nice looking galaxy's.

Nameing your sector.

For this you are now going to have to work on an xml file, this file will contain the sector name and also the sector description, you can write this file with notepad, but you must remember to change its type to xml afterwards.

Code: Select all

<?xml version="1.0" encoding="utf-8" ?>
<language id="44">
<page id="7" title="Boardcomp. Sectornames" descr="" voice="yes">
 <t id="1021106">sector name here</t>
</page>
<page id="19" title="Sectordescription" descr="">
 <t id="1031106">sector description here</t>
</page>
You can just copy and paste that code above and with a change to the sector name and desciption it will work, but i noticed in one your image's, it looks like you have added more than one sector. The following is a breakdown of the code and what it is for, this way you will know what you need to do to get the other sector names to show.

Code: Select all

 <?xml version="1.0" encoding="utf-8" ?>
<language id="44">
this is always need at the top of this type of file, the top line, i think, tells the engine how the script is encoded.
The second line tells the engine what language the script is for, if your language is not English then the number 44 will need to be changed for your language id.

Code: Select all

<page id="7" title="Boardcomp. Sectornames" descr="" voice="yes">
This is the page id, which is page 7.

If you look at your string you will notice the number 7 before the sector number.

Code: Select all

 <t id="1021106">sector name here</t>
this line is the number that you get from the galaxy editer, the "id=1021106" tells the engine that sector 1021106 is called (your sector name)

Code: Select all

<t id="1030101">sector description here</t>
this tells the engine what information to place against the sector when you are in the in-game galaxy map, if you look at it closely you will notice the only difference is the number 3.

That puts the information you need into a viewable format for the game, what you will now need is a name for the file, these typea of file always use numbers, not words.

In the second post of the link below you will see a list of numbers.
http://forum.egosoft.com/viewtopic.php?t=96340

All these numbers are already used, and the majority of them are for scripts, if you want to run scripts with your game dont use a number which is already listed.

Now the nubers you see are all 4 digit numbers, that is because you will need to place your language id number before your 4 digit number.

IE....44xxxx

That should be all you need for that file.

Now you need a way to tell the game to load the language file, otherwise the information will show as readtext errors.
I dont do much scripting, so i will tell you the way i do it, if there is an easier way i'm sure one of the scripters will say.

The below HAS to be wrote using the in game script editer.

I write a simple al plugin which tells the game to load the text you need.

Code: Select all

$page.id=(4 digit number of text id)
load text:id = page.id
set global variable:name (name of this plugin) value (4 diigit number)
return null
 
If for example your 4 digit number is 4656 and you call the script al.plugin.mygalaxy then the script would look like this.

Code: Select all

$page.id=4656
load text:id = page.id
set global variable:name $plugin.mygalaxy value 4656
return null
 
and this would be saved as "al.plugin.mygalaxy"
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

Ty for this tutorial DIGSIN!
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

As you guys were talking about this galaxy editor, I've been playing a bit with it and I created a few new sectors. I linked them with gates in DS editor, checked the links in X3 editor and it's working fine.

But now my question is: why, on the galaxy map in the x3 galaxy editor I cannot see the new sectors? I can enter them with the ship or check them in the sector map, but they doesn't appear on the galaxy map...
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

Nho wrote:But now my question is: why, on the galaxy map in the x3 galaxy editor I cannot see the new sectors? I can enter them with the ship or check them in the sector map, but they doesn't appear on the galaxy map...
Nice to see there is more than one person following this thread and prepared to give the galaxy editing a try.

The reason you cant see the white boxes on the universe map is due to not yet working on the 00749.bod file. I will go into this file for both of you, but it will probably be the last item, the only reason being is it is one of the hardest things to learn and get correct. For this bod file it will also mean extracting the x3 cat.
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

How are you guys getting along with this?

Any questions on what has been said so far, are you ready for the next step?
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

Sure! Haven't had a lot of time lately, but I did create 4 new sectors with gates, factories, sector name and description, sun & planets... I event tried the galaxy.initplayer something to make a new start point. Must have done some mistake somewhere tho, this last thing isnt working.

But I'm ready for the next step :p
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

For your next step we will do the player init script then.

These are simple scripts which can start to become complicated if your not careful. Not long ago i did one 1250 lines long :shock: yours will only be short so dont panic.


This will have to be wrote within X3 script engine.
(from a XFP custom start, with slight changes it can be made to work for you)

You will need to name this script galaxy.(your galaxy name).initplayership
Make sure you place the exact name of your map as the galaxy name in the title, if your galaxy is called 'MyGal' and you place 'mygal' it wont work.

Code: Select all

001   $sec = get sector from universe index: x=1, y=1
002   $plshp =  create ship: type=Viper Mk2 owner=Player addto=$sec x=100 y=100 z=100
003    = $plshp -> install -99 units of Cargo bay extension
004    $pc = $plshp -> get max upgrades for upgrade Cargo bay extension
005    = $plshp  -> install $pc units of Cargo bay extension
006    = $plshp -> install -99 units of Engine Tuning
007    $pe = $plshp -> get max upgrades for upgrade Engine Tuning
008    = $plshp  -> install $re units of Engine Tuning
009    = $plshp -> install -99 units of Rudder Optimisation
010    $pr = $plshp -> get max upgrades for upgrade Rudder Optimisation
011    = $plshp -> install $pr units of Rudder Optimisation
012   = $plshp -> install 2 units of Alpha Particle Accelerator Cannon
013   = $plshp -> install 1 units of Jumpdrive
014   = $plshp -> install 1 units of Duplex Scanner
015   return $plshp
Breakdown

Code: Select all

001   $sec = get sector from universe index: x=1, y=1
This will tell the game which sector you wish to start in, all you will need to do is change the 'x' and 'y' values.

Code: Select all

$plshp =  create ship: type=Viper Mk2 owner=Player addto=$sec x=100 y=100 z=100
The type of ship you want and the exact place to spawn it within the sector.
The owner tag you will find as Julian within the script editer, 'addto=$sec' is the sector you chose in the first line 'x,y and z' is the sector position.

Code: Select all

003    = $plshp -> install -99 units of Cargo bay extension
004    $pc = $plshp -> get max upgrades for upgrade Cargo bay extension
005    = $plshp  -> install $pc units of Cargo bay extension
The above 3 lines will install to your ship the full amount of cargo bay extensions allowed.
The first line will remove any extensions already on the ship.
The second line will find out how many extensions the ship can have.
The third line will install the maximum extensions.

You could just use the third line on it's own (with adjustments) but when doing so with engine and rudder tunnings it may give you more than the ship should have.

For the above three lines.
You will notice this.

Code: Select all

$pc
All this does is set a varible for the engine to hold the number it is getting for later use.

As you see here, if the maximum cargo is 30 units it will install 30 ($pc) units of cargo bay.

Code: Select all

005    = $plshp  -> install $pc units of Cargo bay extension
The following lines, which are all virtually identical install the items you wish on your ship, things like trade/fight commands, scanners, weapons, etc

Code: Select all

012   = $plshp -> install 2 units of Alpha Particle Accelerator Cannon
You will notice at the begining of the above line

Code: Select all

= $plshp -> install 
In the scipt engine what you see is 'variable = variable ->install', etc
For the first variable, scroll down and click on no return variable, unless you are finding and installing the maximum cargo, engine and rudder as in lines 4, 7 and 10.

If you wish to install more items to your ship, place them between lines 14 and 15, if you wish to place items, such as missiles, onto your ship, then use the 'add ware' instruction rather than the 'install' instruction.

That will give you your starting ship to begin with, you can actually have more than one ship in our fleet when you start, you can also change your notoriety with the races, name your ship. The list is probably endless, the obnky thing i havent found yet is how to tell it to make me a cup of tea, which i will have to do myself now.:P

Your not far from completing this now.
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

Yes! It's working. I got now a new start point with an upgraded ship, a commercial fleet, some M5's, a few working factories and a lot negative diplomatic relations :p

I couldn't find a way to create a working factory just with the command "create station etc". I think it's kind of weird that you have to add product, ingredients (how do you call those in english again? :oops: ) and specify that it's producing and trading (here i copied an other script). Or is there an other way around to make a working factory?

Anyway, thanks again DIGSIN. What are left for me to do now is making the new sectors appear on the galaxy map and, maybe, change player name - I thought this would be easy to do but... I bet it's not)
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

First, You cant change the name of the player, you can name your ship though.

I'm not sure on how to add stations to the galaxy via script.

You can add player stations to the galaxy via the galaxy editer, just choose Julian as player race. For the wares, if you want the station to use the wares Egosoft has intended all you will need to do is add default wares, there are a few exeptions to this, for instance the SPP's, they spawn with the crystals as a secondary resource.

If you wish you could set up the station to use whichever resources you want and produce whatever ware you want. It all depends on how realistic you want to be.

You are 2 steps away from getting this complete now.

Before we can start on the white boxes we need to get the info in a position where we can easily check on the changes which will be made in the 749.bod(white boxes).

Now its time to make a basic mod.

You will need to unpack some of Egosoft's cat files as there is a few files which will be needed within them.

You have already downloaded the tools you need to do this.

If you start up Double shadows mod manager you will see an image of a Black cat, this is what we need to unpack or extract the files we need and then create a mini mod so we can continue.

You can just place a folder on the desktop and call it my mod, or something which you can remember. This is probably the best way for you at the moment, and how i will take this next part.

If you open the cat 8 with the mod manager you will see i list of all the files which are contained within it, 'Jobs'. As you start looking for the file you will notice items which are seperated with \
The "\" just tells the game to open the folder, eg 'types\jobs.txt'

What we need from this cat is 'types\jobs.txt', you can either extraxt the file using the extract button at the top of the program, or drag and drop the file. Drag and drop will be quicker as we dont need anything else from this cat.

Whist this cat is open we need one more file, this is the 749.bod which will allow you to put the white boxes in the universe map. You will find this named "objects\cut\00749.bod", a drag and drop agin will do.

Next you need to open cat 7, from this we need 'jobswings.txt, again you will see this named as "types\jobswings.txt", once again a simple drag and drop will get the file for you.

You now have the latest versions of the files we need.

First you need to rename the jobs and jobswings file, these are the files which will put other ships into your galaxy and make it look alive.
The only thing you need to do is add the name of your galaxy to the filename.

So jobs.txt will become jobs.(galaxy name).txt
jobswings.txt will become jobswings.(galaxy name).txt
Notice the dot between jobs and the galaxy name and again before the txt.

these two files need to go into a folder named 'types'

Now to make a cat which we can start to use.

In Doubleshadows mod manager select a new cat and name the cat the same as you galaxy.

Place into this cat the folder called types with the jobs and jobswings txt's.
You will notice a box appear, if the files are inside the types folder leave the top box blank, if they are not in the folder then you will need to type 'types\' into the box, there is another box with 'compress files' wrote at the side select from the drop down window 'Check compression filter'. This will compress the files to the requirment the game will need.

Keep the 749.bod file out of here for the moment as we will work on that tomorrow when i will make a post on how to add your sector boxes to it.
You can have a look at this with notepad if you wish but dont add anything yet and dont be put off with how it looks, The 749 bod is difficult to work with, but only untill you understand how it works, then it is fairly easy.
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

Working on the 00749.bod

When you first look at the bod file in notepad all you can see lines like this

Code: Select all

P 2; B 1004; N 1004;  // idx 2
{ 0x2002;  75000; 5000; 0;  0.000000; 0.000000; 0.000000; 0.000000;  -1; 1; } // 0
Breakdown

'P 2 and idx 2', these are basically the line numbers for the code above, as you add more lines you will need to increase this number by 1, so if this was the last line in the bod file 'P 2 and idx 2' would become 'P 3 and idx 3'

'B 1004; N 1004;' this is the sector which the box is going to be associated with, looking at the code you will think that it belongs to sector 10,04 (x,y), this is not true.

This box will appear for sector 9,3.

While working on these boxes you need to remember that x3 will always remove 1 from the number before placing it.

If you saw 'B 101; N 0101' in the file, you would find it is actually Kingdoms end sector number 0,0.

Did you notice the loss of a digit in the number tagged with B?
If your sector x co-ord is less than 10 you will not need to put the first 0 in, you will however always have to put the full 4 digit co-ordinates in the number following the N.

{ 0x2002; 75000; 5000; 0; 0.000000; 0.000000; 0.000000; 0.000000; -1; 1; }
The only part of this we need to work with is '75000; 5000; 0;' this is the co-ords for the white box in x,y,z, this will tell x3 where on your in-game universe map to place the white box.
x is the left to right co-ord
y is the up and down co-ord
z is what gives the impression of a 3D map.(in and out)

I have no idea what the rest of the code is for, so it will probably be best to leave it alone for the time being, unless of course you wish to xperiment with it.

Now the problem you will be facing is what numbers to place in the position for x,y and z.
the easiest way is to search through the 749 bod file for a sector which is at the side of your sector.

If your sector is located at 10,09(in game) then you would want to find the information for the sectors at 9,9 (10,10 in the bod file) form this you could get the 'y' co-ordinate for your sector.
Next you would need to find the information for sector 10,8 (11,09 in the bod file) from this you can get the 'x' co-ordinate. This will place a box roughly in the correct place, after checking in game you will be able to adjust these numbers to fine tune the position of the box.

For the z co-ordinates you could get the information from any of the other sectors and again adjust it to the position you want, the reason it is set to 0 in the example above is due to us wanting a flat map for the XFP mod.

The last thing i can say on this part of the bod file is you may see

Code: Select all

 Class [Box, GEOMOBJECT_CLASS_ID]
This tells you that this code is associated with the white boxes for the in game map.

Now while flying through the gates and opening new parts of the galaxy X3 then puts lines on the map showing how the gates connect.

This is the code for the connection lines.

Code: Select all

P 32; B 8040904; N 08040904;
{ 0x2002; 43706; 8208; 1952; 0.034601; -0.380136; 0.068352; -0.922402; -1; -1; } // 0
Breakdown

P 32 the line number and will need increasing by 1.

B 8040904; N 08040904;
The sector co-ords, but with a difference, these are the cords for which sectors connect, this one will put a line between sectors 7,3 and 8,3 (remember we have to increse the number by one while working in the bod file)
It is set up much the same as the white box, where in the 'B' you will not need to put the first 0 in.

43706; 8208; 1952; Once again the x,y,z co-ords, this time though it is set up to place the white line to the center of the right hand side of the box.

you may also see

Code: Select all

 [Editable Mesh, GEOMOBJECT_CLASS_ID]
associated with this type of line, this just tells x3 that it will be a line rather than a box.

One other thing you can do with this file is add a line
\new sector
this will not be read by x3 and will allow you to quickly find the new sector information that you are working on. Anything which is wrote after the \ will not be read unless it is the start of a new line.

That will place your white boxes and lines into the in game galaxy map, i would suggest just placing the white boxes you need first, check in game that they are in the correct places before adding the connection lines otherwise if the boxes are in the wrong position you will have more code to keep adjusting.

Once you have finished the work on this file you will need to place it inside the cat for your mod.
This file needs to go inside a folder named 'cuts' which is inside a folder named 'objects'
So when putting it in the cat you will have objects\cut\00749.bod

let me know when you have this completed or if you have any problems.
Last edited by DIGSIN on Sun, 11. Mar 07, 11:59, edited 1 time in total.
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

Hello DIGSIN

There are a few things I'm not sure about for the last step

I opened my 00749 and add a line at the end of the page. So it looks like this:

(last line)
Thu Sep 07 16:21:18 2006/ Node 03160317 Class [Editable Mesh, GEOMOBJECT_CLASS_ID] P 709; B 3160317; N 03160317; { 0x2002; -6483; -114188; 20641; 0.371398; -0.562870; -0.471691; 0.678738; -1; -1; } // 0
(my sector)
Mon Sep 26 20:53:40 2005/ Node 1002 Class [Box, GEOMOBJECT_CLASS_ID] P 710; B 1002; N 1002; { 0x2002; 63283; 26546; 2010; 0.000000; 0.000000; 0.000000; 0.000000; -1; -1; } // 0

So here "P710" because last one was "p709".

Node... I just put my sector's coords here.

B & N, my sector coords (it is 9;1 in game - north of Patriarch's Retreat)

X coord 63283 (same as patriarch's retreat) and Y 26546 (same as Family Zein).

I haven't change the date... It's probably irrevelant, right?
I put my 00749 with my jobs and jobwings (objects\cuts\00749) and use the mod as a false patch. It is working for the 2 jobs files, I got ships flying around in game.
So I guessed my line comes at the end of the page (not caring if it is a BOX or a EDITABLE MESH just before). If not, what value should I put for "P"?
In your last post you are talking about the "idx" wich should be the same value as the "P". Mmh... I dont see this idx value in my 00749.bod.

ATM I dont get the white box in game. What have I done wrong?

Thanks for your patience DIGSIN :)
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

Looking at the code you have there your P,B and N numbers are correct.

Dont worry too much about the idx number if it is not on any of the other entries as this would appear depending on which tool has extracted it.

You have the GEO box and Editable meshes on your which i dont see with mine.

The date wont matter.

Everything looks correct.

It is possible that the x and y numbers need some adjustment, it looks like you are working with the normal egosoft 3d map, which makes it slightly difficult to track down the rouge box.

What you could do is go into the galaxy editer and on the universe map keep going around the sector boxes untill you find a box which, when trying to move from it keeps you there. You will notice you wont move from the box but the sector co-ords/name in the top right hand box (the one with the sector description) will change, or you can send the map to me and i will track down where the box has gone to for you.

If you want to send it use my msn address and just mark it as X3 map so i dont think it is spam.
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

I've find out what was wrong, I had my 00749 file saved in "cuts" instead of "cut". It is now working perfectly!
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

Good to hear it is working correctly now.

Sorry about the cuts that was my fault as i had typed cuts instead of cut :oops:

Last question, is this mod for your own personal use or are you hoping to release it to the community?
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

Well, it comes with some BG, but it is just a new start for my own use. Maybe when/if I solve all the little problems I still got here I will release it for the community. But I doubt it will interest a lot of people :P You see, I dont like to begin with just a discoverer and 100 credits, so this mod gives me 3 sectors with a few basic factories, a small merchant fleet for my own internal commerce, and a sealed with bad reputation universe. So it's mostly combat oriented, at least for the beginning. I have no idea if this mod is playable in a long term tho...

But if you are just curious, I can send it to you.

It isnt bug free tho. I've noticed for example that some of my gates have an orientation that seem to change depending on the use I make of them. Just flying through is correct, but if I use "Ring of fire" on them, the ring is perpendicular instead of parrallel to the gate. But in the newly created sectors only.

Also I need to study those jobs and jobwings files because some behavior doesn't quite correspond to the little BG of my mod. And maybe I would like to add some civilian ships - if this is possible, I doubt that tho - because the player is a "new race", a Split family that have been in war with all other Split families and have become independant. So having player's family civilians flying around would add to the feeling of just beeing the military and commercial part of a clan...

Oh, about the "cuts", I think the spelling was automatically given by DS editor
DIGSIN
Posts: 538
Joined: Fri, 28. Oct 05, 12:37
x4

Post by DIGSIN »

When you are ready i would suggest giving it a try for release, you may be surprised at how many players will play it, just for something different.

If you do wish to release it, it wiould be a good idea to redo the al plugin, the one which loads your text page, otherwise it will always be read for anyone else's games, even if they are not playong the mod.

Code: Select all

001   load text: id=(text number)
002   return null
In a script called 'setup.cm.language' should work.

Or just adding the 'read text' entry to the top of your player init script may work aswell, i think it may depend on how big your text script is though as i have had problems with a large text script niot fully loading.

Anyway keep working on your bugs, as you will eventually crack them, and if you need to get hold off me and i dont answer for a few days give me a shout at the XFP forums.

If your interested in making more maps, or even working on a much larger map from scratch, we are always looking for map builders at the XFP, there are only two of us there :cry:

Bulska...are you still working on this?
Nho
Posts: 180
Joined: Fri, 24. Feb 06, 18:19
x3

Post by Nho »

XFP huh? I would gladly say yes but I have really little free time
Thraxwhirl
Posts: 683
Joined: Fri, 17. Feb 06, 20:54
x3ap

Post by Thraxwhirl »

I'm so glad I've this tutorial. It's brilliant, and making changes to the Galaxy map is pretty easy thanks to you guys...

...but I'm having a problem.

I can't SAVE any changes I make. Any idea why?

I'm running XFP of course, and the Galaxy Editor is definitely loading the XFP map when I select "x_universe", but it isn't saving it. There doesn't even appear to be a "Save Map" feature anywhere that I can find. :?

Am I missing something really obvious here?

Can anyone help?

Many thanks.
Thraxwhirl
Posts: 683
Joined: Fri, 17. Feb 06, 20:54
x3ap

Post by Thraxwhirl »

Ooh, hang on.

Think I've cracked it.

The x_universe.xml file is the game's default one, which it stores in the X3 Reunion/Maps foler, isn't it? Now, it seems that if I "Export to X3_Universe", I then simply have to delete the map in the Mod's .cat file, and "add" from the game's X3_universe file. :)

Certainly, the changes are now showing up in Doubleshadow's Galaxy Editor, which is what matters.

But it leaves me with one important question:

What about XFP's .dat file? Will there be a map that needs replacing in there too?

I don't seem to be able to load .dat files. With .cat ones, I just double-click them, and it opens a window with the list of all the subfolders within the .cat...

...but I can't seem to find how to get .dats to open the same way. :?

Return to “X³: Reunion - Scripts and Modding”