[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

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”