How To Modify TShip Script?

The place to discuss scripting and game modifications for X²: The Threat.

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

Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

How To Modify TShip Script?

Post by Ishvar »

Hi

I have recently returned to playing X2 and I need some help please to make a few tweaks. I have read a lot recently on scripts but still struggle to grasp what to do.

I want to alter ship speed of a Teladi Falcon. I have seen a thread which listed ships details:

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

But how do I access those lines of numbers for ships to alter them? Where are they - in scripts folder or t folder?? Do I need to unpack a pck file to access the numbers? How do I do that please?

Or should I just add a basic script for improved engine tuning? Do I need to save an XML file to do this?

Thanks
User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff »

For this stuff, I use x2editor...I might be able to find out where it is, but I'm sure you can find it (just ask if you can't).

This allows you to change tships.pck (I think) and it's easy to do. I've modified a few ships myself. Just remember to keep backups! The editor works on packed files so it's just like using a normal editor...

(Written from memory as I don't have access to the files on this computer)

edit: Check this thread....http://forum.egosoft.com/viewtopic.php?t=69225
...locating mandolin strings in the middle of Austin.
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

Thanks...I have downloaded the X2 Editor but I cannot get it to work. I keep getting an Error message when attempting to open a PCK file in scripts folder:

"Error loading from file. File contains bad data."

What does this error mean? Do I have to 'unpack' the PCK file? How is that done and how do I get X2 Editor to work?

When I do get this to work how do I save the backups before modifying scripts?

Am I changing XML or PCK files and are the files I need in the t folder or in the scripts folder?

Is there a way to edit scripts in the in game script editor and if so how will I make a back up before messing with those files?

I'm a real noob on this stuff so any step by step help would be fantastic. So far I have spent hours surfing online and looking for answers but cannot edit scripts.
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

Ishvar wrote:I keep getting an Error message when attempting to open a PCK file in scripts folder
X2 Editor doesn't work on scripts, it's for creating mods. That's what you have to do anyway. You need to increase either the speed or the number of engine tunings to get a faster falcon.

You need an add-on to the X2 Editor named X2 Mod Manager (available on the same place you downloaded X2 Editor).
You basically need a mod with the TShips.pck as only file in it. Extract TShips.pck from 04.dat, change the values in TShips.pck and create a new mod.
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

Ah thank you for that! Any ideas where I can download this X2 Mod Manager?

I think I got X2 Editor from http://www.doubleshadow.wz.cz/ but today I cannot get this site to load at all. Anywhere else I can try please?
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

I can't get on the doubleshadow site so downloaded X2 Modder from egosoft. It has an X2Tool.exe which I assume should activate this so I can unpack pck scripts? When I click on XTools a screen flashes very quick then goes and nothing else happens. :?

Getting confused about how I can mod this game. All I want to do is adjust the speed for Falcons in the game - where am I going wrong? HELP PLEASE :cry:
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

X2tool is a command line tool, so you need a DOS-Box: Start->Run... and enter "cmd". This gives you the DOS-Box. Navigate to the directory, where x2tool is located by typing "cd " and the name of the directory.
Then enter

Code: Select all

x2tool -extract-dat 04
and you get a series of new directories in the directory you're in. The file you're interested is types\TShips...
I can't remember if x2tool unpacks the files, so you either have a txt or pck-file. They both can be loaded in X2 Editor. If it's txt, you need an additional program "gzip" to compress to pck.

Edit:
Doubleshadow's site is online again. So get X2 Mod Manager and nothing to worry about :)
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

Thanks again. I have now downloaded X Modder from doubleshadow - both that and X2Tool sound fairly easy to use, but I have not found either very straight forward as a total noob getting errors with them. I almost need someone here to give me complete baby step by step idiot proof instructions :oops:

Now I have read a lot on old forums here I realise I have 2 options:

1) unpack TShip file alter settings and repack (wish it went as smoothly as writing that did :roll: )

2) Write a script to give extra me engine tunings for Playership using the in game Script Editor.

I have decided option 2 will be better - less chance to screw up the game I hope, and also be nice to have a Falcon that is better than the others in the game.

I did find a really helpful thread about writing a script to add engine tunings: http://forum.egosoft.com/viewtopic.php?t=74514
but even that step by step guide lost me in the final bit when it talks about a new line and putting an INSTALL command followed by specifications - how do I add No return variable, ship, amount, ware :?

Has anyone got a basic script for allowing Playership to add engine tunings - a script I can download and just drop into a script folder and use?

Alternatively can someone post here some very detailed, step by step instructions for entering an engine tuning upgrade to Playership in the Scipt Editor (which is about the only program I have got to work ok lol)

Thanks
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

OK I have got to grips with the Script Editor and reverse engineered a script. This is what I have come up with and so far it works to increase speed/rudder. :shock:


Arguments
1: ship , Var/Ship owned by Player , 'Choose Ship'
2: Speed , Number , 'Amount of Engine Tuning'
3: Steer , Number , 'Amount of Rudder Optimisation'
Source Text

001 = $ship -> install $Speed units of Engine Tuning
002 = $ship -> install $Steer units of Rudder Optimisation
003 return null

I'd be grateful if someone who understands scripting could check this script for errors or just confirm it is ok :)

Many thanks
User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi »

Yup, this is ok.

Sorry, I misunderstood your intention. I thought you'd like the falcon to travel faster than the 135 m/s it does. For that, you'd need a mod.
Ishvar
Posts: 9
Joined: Fri, 4. Jan 08, 11:36

Post by Ishvar »

Thank you. You didn't misunderstand btw - it was my original thought to change all falcon's max speed above 135 but in the end (very basic!) scripting seemed easier and much more satisfying when it worked!

I have now made an add money script to generate a few credits:

Arguments
1: Credits , Var/Number , 'Credits'

Code
001 add money to player: $Credits
002 return null

Hopefully this and the above engine tuning script are correct and bug free :?:

They seem to work fine. I am just cautious when I have them in saved games now that they won't bug the game itself at all? I am not that far into the game storyline (although been playing for a long time) and don't want to risk doing anything that could cause a bug and mean a restart from my last unmodified save game.

Return to “X²: The Threat - Scripts and Modding”