[Tutorial] How to make custom weapons

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

TonyEvans
Posts: 1055
Joined: Sun, 15. Jan 12, 05:53
x4

Post by TonyEvans » Sun, 17. Mar 13, 22:16

I got so far as to copy/pasting the TBullet one. I can't open up TBullet through Text Editor, only debugger. Debugger doesn't allow copy/editing so I'm hitting a wall here. Anyone help out?

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 18. Mar 13, 00:07

Open TBullets with the T File Editor.

TonyEvans
Posts: 1055
Joined: Sun, 15. Jan 12, 05:53
x4

Post by TonyEvans » Mon, 18. Mar 13, 00:20

DrBullwinkle wrote:Open TBullets with the T File Editor.
I tried that. I get error:

"Eror opening file c:\ Program Files
(x86)\Steam\steamapps\common\X3 Terran Conflict\addon\05.cat::addon\types\TBullet.pck:

Interface function OpenFile of plugin T File Editor
(DS.X3E.TFileEditor.MainWindow) [TFileEditor.plugin]threw exception
System.Application Exception:

Error loading TWare files:

File down not exist."


I'm pretty sure it's the only thing that doesn't open for me. TShips and TLasers open with T Editor

Edit: ugh, I think I might've found the problem. Gonna try a fix and see if it sticks

Edit 2: AHAHAHAHA I am so stupid... like really stupid. I had X3 Editor with its session set to the wrong place... I can now open TBullets with Editor.

Sorry to consume anyone's time
Last edited by TonyEvans on Mon, 18. Mar 13, 00:24, edited 1 time in total.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Mon, 18. Mar 13, 00:23

TonyEvans wrote:Error loading TWare files:
Sounds like one of your files is damaged (and/or invalid).

TonyEvans
Posts: 1055
Joined: Sun, 15. Jan 12, 05:53
x4

Post by TonyEvans » Mon, 18. Mar 13, 00:27

DrBullwinkle wrote:
TonyEvans wrote:Error loading TWare files:
Sounds like one of your files is damaged (and/or invalid).
Through random curiosity I clicked "Reload Game Data" (Under options) and it said xxx file didn't exist. Admittedly I used to have a torrent version of X3 TC/AP, so it was saved in a different location than where my now-bought steam version is. I never got around to changing X3 Editor's session location (File -> Sessions -> Manage).

Fortunately now I've both purchased the game and am now able to make my own weapons.

TonyEvans
Posts: 1055
Joined: Sun, 15. Jan 12, 05:53
x4

Post by TonyEvans » Sat, 23. Mar 13, 06:35

So I had my weapons (3 of them) working. The names appeared in-game no problem. After adding a 4th weapon the first 3 now read as Read-Text. I noticed the change before even launching the game. I was in X3 Editor and looking at my previous work (not changing anything) to compare values.

My new 4th weapon has the proper name in-game.

GTXGTP
Posts: 5
Joined: Tue, 24. Feb 15, 22:59

Cust. Weap. not showing in game

Post by GTXGTP » Tue, 24. Feb 15, 23:24

Hello,

I followed the guide at http://forum.egosoft.com/viewtopic.php?t=260490 ...
(It's not very clear,but it's the only one I found via google)

I followed the steps, and have successfully created a new Laser, and a new Bullet. I also modified the Tship, to allow a ship to carry the new weapon(ATF Vidar), and changed the NameID/Name in the L044 file.

However, I'm not sure what to do with the little script thing that is mentioned in the above post?

Also, when I run the game there's a few things wrong... one is the "readtext" thing that's mentioned in the above post... can't seem how to fix it.

Also#2, when I look at the compatible weapons list in the Vidar, it shows my new weapon. But I can't figured out where to go to "buy/get" it?? I have it set to ARGON_LIGHT i believe, but it's nowhere to be found in the universe.

Another thing, the above post doesn't clarify WHERE to put the modded Tships, Tlaser, and Tbullet files other than "merge files.... create cat/dat" etc.... Do I need to create a seperate cat file(14.cat would be the next one in order)? It seems it's almost impossible to determine which L044/Tship/Tlaser/Tbullet in a specific cat actually controls what is in the game, since those 4 files are in various assortments in various cat files. I finally had to resort to modifying EVERY ONE of those 4 files in order to even get it to show up in the game(well, at least in my ship info/comp lasers).


Help? lol... I know thats a lot, and maybe it's been asked/answered before, so I will accept links to such... and beer. :)

Much appreciated in advance.

[moved to correct thread -- DrBullwinkle]

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 25. Feb 15, 00:58

To clarify a few points in the tutorial:

1) Do not open files from the "cat 3 file" as stated in Pre Step #1.
Instead, make sure that your profile is set correctly, then Open from VFS. VFS is the Virtual File System: It will find the file that will be used by the game and will open that. In VFS you will be looking for types\TBullets and types\TLaser.

2) When you open types files in X3Editor, use the TFile Editor.

3) If you follow the advice to extract the files then recombine them into a new .cat file, then be sure to create the correct folder hierarchy inside your new .cat file. For TC, that means simply to create a types folder in your .cat, and put your modified TBullets and TLasers into that folder. (For AP, you would create an addon folder, then create a types folder inside it. So addon\types.)
  • (Creating a new .cat file is not the only way to do it. It probably is the best way, although it is also the most complicated and error-prone way to do it. I'm just sayin'....)


4) Yes, you will want to number your .cat/.dat pair as the next higher two-digit numbered files in your game folder. For TC that is the root X3TC folder. For AP it is X3TC\addon.

5) See Create a Custom Name for Your Ship for better instructions on creating a text file with a new name for your laser. Laser names work the same as ship names; they are on Page 17. The NameID number connects the TLasers entry to the text file.

6) That same tutorial also discusses creating a setup script to load the text file that you just created. The setup script needs only two lines:

Code: Select all

load text: id=<xxxx-L044.xml>
return null


The script *must* be named beginning with "setup.". Lower-case "s".

6a) If you name your text file 0004-L044.xml then you can skip creating a setup script for it. Text files 0001 through 0004 are loaded automatically. Egosoft uses 0001 through 0003 but (as of this writing), 0004 is safe to use in a a mod that you do not intend to distribute.

7) Script files cannot be included in your .cat/.dat file. They must go in your game folder:
X3TC\scripts (for TC)
X3TC\addon\scripts (for AP)

8 ) The text file *can* be included in your .cat file. It needs a different folder:
t (for TC)
addon\t (for AP)


I hope some of that helps. It may seem complicated the first time you do it, but using X3Editor2 is pretty easy when you get the hang of it.

GTXGTP
Posts: 5
Joined: Tue, 24. Feb 15, 22:59

Post by GTXGTP » Wed, 25. Feb 15, 07:43

Dumb question, if I don't want to bother with creating a new .cat, new L044 file, new setup.xxxx.xlm etc files, can I simple add new entries, aka new laser, new bullet, new name in the page 17..... That kind of thing, all in VFS?
Cause I tried the above tips, and still can't find it in game. Maybe I'm messing up the load text script, or something.

I seem to be able to modify things all day long in VFS without having to modify/create new setup.xxxx.xml's, or any files for that matter... Everything seems to be easy,... Make a ship faster, change the name or a weapon, modify bullet damage, etc.... But when I copy/paste/rename and save a "new" weapon, it shows in my ship compatibility in the game, but is nowhere to buy etc.

Is there some, "oh, you modified the VFS games files with a new ____, youjust need to do____ and it will work fine"? Maybe I'm thinking that it should be easier since changing existing items has given me no problems? Lol.

If I DO need to include a new .cat, new xxxx_Lxxx.XML file, setup file, etc... What actually needs to go in them? I've tried every combo I can think of in the editor, SE in game, just can't seem to figure it out.

Thanks.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 25. Feb 15, 07:53

Not a dumb question at all.

Yes, you can. Open from VFS, edit, save to default location, overwrite.

Yes, it is that simple.

Some things to consider:

- I recommend that you backup your game folder before you edit your game files. Just in case.

- If you use Steam, then you will, at minimum, want to turn off Steam's auto-update feature. Otherwise Steam will overwrite your changes.

- Even better, copy your game folder from Steam to somewhere that is easy to edit, such as C:\Games\X3. Then use the no-Steam .exe (AP downloads section of this forum) to launch the game . If you are playing TC, then you can get a non-Steam .exe from the most recent patch.

Any files that you change in your non-Steam copy of X3 will not be changed by Steam. It is important that you launch with a no-Steam .exe if you copied your game folder. If you do not, then Steam will automatically launch the game in the Steam folder (which you did not edit).

GTXGTP
Posts: 5
Joined: Tue, 24. Feb 15, 22:59

Post by GTXGTP » Wed, 25. Feb 15, 08:02

OK good, cause the other way seems like chasing my tail. Lol. If I cared about distributing a mod or something, sure. But I just am interested in playing around.

But like I said, I still have the same issue. I can copy/make new stuff, and they show up in my ship info, but, where on earth do I find them to use them in the game??? I gather from a few posts that it has to do with the subtype,is: Terran_Light, would make it available at a station that sells light class weapons, right? Like, where I'm docked right now, I can buy an empc no problem. But if I build a custom weapon by copying then empc specs, and modifying only the name essentially. Shouldn't it be available at the same station? Same subtype, etc, just different name?

Am I missing something?

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 25. Feb 15, 08:07

GTXGTP wrote:where on earth do I find them to use them in the game?
Your new weapons will most likely appear on some enemy ships. They may drop the lasers if you kill them (and if you are very lucky). Otherwise, they will not appear in the game unless you script them in.

The Cheat Package gives you several easy options:
1) Install the laser onto your ship.
2) Add the (laser) product to an Equipment Dock.
3) Stock the Equipment Dock.

Note that your ship must also be compatible with the new laser type.

GTXGTP
Posts: 5
Joined: Tue, 24. Feb 15, 22:59

Post by GTXGTP » Wed, 25. Feb 15, 08:16

Oh. Lol, well that's unexpected.

Link to cheat package?

What is involved in scripting in my new weapon?

I kind thought that modifying a copied/pasted weapon and rename it would reflect that, since it appears to have been put into the game. In essence I was already modifying the script by editing the values of the bullet and laser files etc. No?

As far as compatibility to my ship, that's the part that works! :) lol. I'm guessing no other ships in the 'verse will be able to possess my weapons unless I edit the Tships, right?

BTW, thanks so much for you help! Been playing this game for a looonngg time and just decided it was time to play around with mods etc.

User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle » Wed, 25. Feb 15, 08:37

The Cheat Package is stickied to the top of this forum.

You can examine its scripts with the in-game Script Editor, in case you want to create your own script. Cheat Package will be the easy way.

You have only modified data so far; not scripts.

Starting points for writing your own scripts:

MSCI Programmer's Handbook

Cycrow's Scripting Guide

GTXGTP
Posts: 5
Joined: Tue, 24. Feb 15, 22:59

Post by GTXGTP » Wed, 25. Feb 15, 08:40

Awesome, thanks again. BTW, this is day 1 of messing with modding the game. Lol!

I will check the info out.

User avatar
DarrenTomlyn
Posts: 205
Joined: Sun, 17. Oct 04, 19:06
x3ap

Post by DarrenTomlyn » Tue, 3. Mar 15, 11:55

Just to add that another way of adding additional weapons/shields into the game, without requiring scripting for individual weapons/stations - though it does require restarting - is to add them as products to stations in the WareTemplate.xml file.

The good thing about this, is that all such NPC stations will then sell the ware without any problems, so long as they're not specially scripted in the map file (many Equipment docks are, unfortunately in X3TC - don't know about AP) - so that will need to be edited, too. (Apart from a few specialist stations I've scripted in, (to sell stuff like Kyon Emitters, and specific shipyard stock), all my stations are read from the WareTemplate file.)

Note: For X3TC, the Disruptor Missile Fab needs to be added to the Ware Template file - it's missing. Unfortunately, some of the other 'missing' stations - (plasma beam/tri-beam cannon forges etc.) cannot be added this way, and must be scripted instead.

The only bad thing, is that your own stations will still need to be scripted (using cheats) - as they do not seem to be able to produce more than one weapon/shield without help. (Maybe it's just me?)

Note: The resources required and the time taken to produce something is directly proportional to its relval. (Whilst testing out potential values, I had a PPC forge making 12 at a time, while only having room to store 8 - and the more types of goods it produces, the less of each it makes per cycle... (50k EC and 33k Meatsteak's for 12 PPC's - as soon as I added in my Large Plasma Cannon (my XL Argon Cannon - mucho expensive), it went down to 3 per cycle)).
Darren Tomlyn

Tune-writer and fiddle-player,

http://www.gamasutra.com/blogs/DarrenTomlyn/3291/

User avatar
Reimu Hakurei
Posts: 1030
Joined: Fri, 28. Aug 09, 05:29
x3tc

Post by Reimu Hakurei » Sat, 27. Jan 18, 05:22

DrBullwinkle wrote:5) See Create a Custom Name for Your Ship for better instructions on creating a text file with a new name for your laser. Laser names work the same as ship names; they are on Page 17. The NameID number connects the TLasers entry to the text file.

6) That same tutorial also discusses creating a setup script to load the text file that you just created. The setup script needs only two lines:

Code: Select all

load text: id=<xxxx-L044.xml>
return null


The script *must* be named beginning with "setup.". Lower-case "s".
I got this far but then would receive an error when attempting to open Tlaser.pck again. There should be an image of it in this post below (I wanted to name the weapon Plasma Lance):

[ external image ]

User avatar
DarrenTomlyn
Posts: 205
Joined: Sun, 17. Oct 04, 19:06
x3ap

Post by DarrenTomlyn » Sun, 28. Jan 18, 13:55

If there's one thing I've learned from creating my own mod - it's that naming things (with the xxxx-Lo44 text file) FIRST, before creating/adding them to the appropriate t-files, makes things an awful lot easier in the long run - (aswell as creating bullets before weapons). (Then I can tinker with them all afterwards).
Darren Tomlyn

Tune-writer and fiddle-player,

http://www.gamasutra.com/blogs/DarrenTomlyn/3291/

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”