Weapons modding in TC

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

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

FireLancer
Posts: 79
Joined: Wed, 9. Apr 08, 00:39

Weapons modding in TC

Post by FireLancer »

I want to mod some of the weapons and projectiles however I couldnt find much info on them and theres several aspects I cant work out.
  1. Whats the "Subtype" field in TLaser and TBullets for?In TBullets its always 0 or -1 and in TLaser each weapon seems to have a diffrent value, that appears to be related to the weapons class (eg light,medium,heavy) and origin race in most cases. Im sure this was never here before TC, and could find anything about it with search.
  2. Theres 3 diffrent fields todo with energy.
    • TBullets Energy Used appears to be the amount of energy used per shot
    • TLaser has Energy and Charge rate fields. Seeing as ships have a single laser energy pool which all weapons use, whats the effect of these?
  3. What do the colour fields in TBullets do? I thought it was the projectiles colour but having change a few I didnt see any effect in game?
  4. As I understand it I cannot simply add a new weapon in TC as in the previous games because all 32 weapon "slots" are used.

    However two of those weapons I dont think are used anywhere in the game, SS_LASER_DUMMY1 and SS_LASER_DUMMY2. Is that correct or do they have some special purpose which means I cant replace them with new ones without breaking something somewhere?
  5. I want to change the NPC's choice of weapons (ie not having HEPT on every M6 turret because they can never hit fighters which currently rip M6's to shreds) as well as make them use any weapons I add/change.

    I noticed the job file seems to define some very limited weapon info (it doesnt even seem to have allowed/forbidden boxes for all the weapons in the game...), however that doesnt cover the weapons that are not on that list, the job entries that dont fill out those items, or ship spawned in missions. Is this moddable at all and if so which files do I need to change?
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

The dummy's are apparently used by the Earth Torus LT's, but otherwise by nothing else.

I've used both of these for my own guns in my mod.

NPC ships generally mount the biggest gun they are specified to carry. So if you change that in tships for each one, it will affect what they mount when spawned.
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

1. Galaxy subtype. For Tbullets I have no idea but.. only the matter/anti matter launcher and the concussion impulse generator have a 0 (as opposed to -1) subtype.
For Tlasers, the subtype is a "32bit mask". In short, a ship's ability to use certain lasers, is determined by which of these 32 "weapons groups" it can use. So the subtype tells it which group it is in. (And by waretype volume too).
e.g. Suppose you made 10 new lasers all in the subtype SG_LASER_IRE, then anything that can use an IRE, can also use those other 10 (ware size permitting, i.e. S M L XL). Hence why most tractor capable ships say they can use the repair laser.

2. t.b.h I'm not to sure why energy shows up in both tlasers and tbullets. Firing takes the energy used in bullets, Fire rate is from the tlasers fire rate.
But the tlasers energy and charge rate are a mystery to me.

3. I'm not certain about this either. I had always assumed it was related to the lighting generated by the bullet.

4. As mentioned above, the subtype is now used for "groups" of lasers. So you can have more then 32 lasers. (But ships can only be set to used groups of lasers, e.g. If laser1 and laser2 where both part of the subtype SG_LASER_IRE, then a ship can only be set to use both, or none -volume size permitting) So you can have more then 32. I don't know what the new pseudo max is.

5. The job engine is hard coded, so you can't change that.
However, the job's run scripts, so you could easily modify those to equip a ship with different weapons. Alternatively, you could have a ship that goes through every ship in the entire galaxy (on an interval) and replaces the weapons.


http://www.xwiki.chaos.net.nz/index.php ... e_%28X3%29

http://www.xwiki.chaos.net.nz/index.php ... _file_(X3)
From reading through links in the stickies



Hrm... there really should be a better consolidated sticky for this info...
Last edited by s9ilent on Sun, 7. Jun 09, 08:43, edited 2 times in total.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

Hrm... there really should be a better consolidated sticky for this info...
If you want to write it out and post it on my modding 101 guide thread, I'll add it to the OP as a quote.

We could use that thread to accumulate all manner of modding info.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

I am having a similar challenge. I am trying to modify what weapons the OWPs can/should use. So I added Cluster Flaks and Gauss Cannons.

Now every new OWP gets Gauss Cannons, and that's it. Even though they can use a wide variety of weapons.

I have tried to look at the original scripts, can scrips like these play a part in this: !config.add.wares.few.one, !config.add.wares.few.two, !config.add.wares.much.one, !config.add.wares.much.two, !config.add.wares.one.one, !config.add.wares.one.two ?

A OWP is a ship, but it is not in the Jobs-file. So it must be created from somewhere else. My best guess is it is read from the x3_universe file and recreated again and again. But I can't find any reference there either to what gets installed. The file WareTemplate seems to only apply to stations and factories. I even tried to make a special entry in the WareLists file but that didn't sort it out either....
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

It gets the biggest gun it can mount. Whatever it is. I think thats hardcoded.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

apricotslice wrote:It gets the biggest gun it can mount. Whatever it is. I think thats hardcoded.
Then why does the M2/M1's get a variety? Would setting the type of the OWP to M1 "fool" the engine to equip it accordingly?

Oh, and before, they could use IBL's but they always got CIGs. And IBL is a bigger gun that CIGs.
Last edited by xiriod on Sun, 7. Jun 09, 13:12, edited 1 time in total.
someone else
Posts: 2972
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else »

I was having a similar equipping problem with my mod....

the file that defines "Some" of the choices is the Jobs, but the rest is hardcoded. (Gazz and others tolt me that, I never found a solution)


@Xiriod: May I pont out that the NPC receive VERY LOW ammo for ammo-based weapons? they shoot 10 seconds and then go dead forever.
Gazz scripted a "ammo cheat" to let the NPC have a decent amount of ammo.
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

someone else wrote:@Xiriod: May I pont out that the NPC receive VERY LOW ammo for ammo-based weapons? they shoot 10 seconds and then go dead forever.
Gazz scripted a "ammo cheat" to let the NPC have a decent amount of ammo.

Already installed :) Besides, I am just trying out different configs, perhaps I go for PPCs in the end.
someone else
Posts: 2972
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else »

the "equipping" is another thing that needs badly a smart script....
like AI behaviour
like OOS
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
User avatar
apricotslice
Posts: 14163
Joined: Sun, 16. May 04, 13:01
x4

Post by apricotslice »

xiriod wrote:Then why does the M2/M1's get a variety?
No, it depends on which cockpit definitions they use. M2's have different guns mountable in different cockpits. So you find that several of the turrents cant mount the heavy gun the other turrents use.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

apricotslice wrote:
xiriod wrote:Then why does the M2/M1's get a variety?
No, it depends on which cockpit definitions they use. M2's have different guns mountable in different cockpits. So you find that several of the turrents cant mount the heavy gun the other turrents use.
So, an Argon Colossus then should get IPGs, PPC/IBLs, and CFLAK/FLAKs only? I will go scan some Colossus's :)

If so, I could make some cockpits and vary the OWPs a little. The large OWP has a lot of turrets and coverage, so it won't suffer.

But is the CIG rated as more powerful than the IPG then? Because the OWPs use the Colossus forward turret for all their turrets.


I scanned some Colossus's, and they have a variety of lower weapons as well. Not just the biggest one their turrets can handle.
someone else
Posts: 2972
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else »

have you tried to run multiple times the "install standard weapons" script line?

that was my theory on how the equipping mechanism worked.
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

someone else wrote:have you tried to run multiple times the "install standard weapons" script line?

that was my theory on how the equipping mechanism worked.
I have yet to play with scripts in the editor, and just look at the files outside. Perhaps there could be a script check for when a new OWP is created after it is destroyed and then install standard weapons?

There must be a special rule for OWPs. They are classified as M1's and use the Colossus forward turret as template. But still they default to CIGs once created, originally. But CIG is not the Colossus most powerful forward weapon.
FireLancer
Posts: 79
Joined: Wed, 9. Apr 08, 00:39

Post by FireLancer »

The jobs entries seem to have a config script thats called just after the ship is created, called with no arguments but [THIS] set to the object it spawned.

For jobs mayby a new smart equip script could be provided, to vary the weapons chosen for each ship. I guess the MD stuff can be told to call a script on each of the ships it spawns right?

That should cover most of the AI ships in the game, just those that are created entirly by scripts (eg pirate guild) I guess, those would need changes to each script in question most likly.

As for OWP's what actaully spawns them and handles recreating them?

EDIT: Also looking at the jobs file in X Editor 2 what exactly are the effects of the integer fields on the "Weapons & equipment" tab? I couldnt find anywhere that describe them, and looking through the file I cant see much of a relation between its entries and the ingame effect, exspecially things like "fight skill" and "aggression".
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

I have a hunch that many answers are in the default scripts, but they are 504 in number and a tad tedious to go through although some of them can be excluded by name :)

I wish there was an external script editor, for windows, where you could search for the functions you need. People that script all the time remember what command is where but I have to sift through it all every time ;)
someone else
Posts: 2972
Joined: Sun, 18. Jun 06, 13:37
x3tc

Post by someone else »

@xiriod: bible of scripting

it explains what every command does, and other things.
it is from X2, but most of the script commands are the same, very very very useful.
Trade, Fight, Build, Think, Modify.
Ship Rebalance Mod
OOS Rebalance
Resized Aldrin Big Rock
SIDE/TOP/FRONT Ship Size Comparison
Remember young Padawan: money stolen can be, time cannot.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

someone else wrote:@xiriod: bible of scripting

it explains what every command does, and other things.
it is from X2, but most of the script commands are the same, very very very useful.
Thank you, but wow it is a lot of pages :) I still wish for an external editor though, hehe.

I tried to install default wares, which then defaulted to Gauss Cannon in my setup, this was an Medium OWP. But when the AI creates one, it also puts in some Mass Drivers. Which is strange. For large OWPs it only throws in the Gauss.

I've found out how to find out what compatible lasers, how many bays and turret an object has. But I am searching for a way to install a random amount of compatible wares.
Last edited by xiriod on Sun, 7. Jun 09, 15:54, edited 2 times in total.
FireLancer
Posts: 79
Joined: Wed, 9. Apr 08, 00:39

Post by FireLancer »

Theres an install ware command in trade commands. It will add the specified number of a specific ware to the ship and install them to the first laser/shield bay which is empty and they fit in.

The bay order is top to bottom in the ships weapon menu for weapons (So generally main first, then front turret, etc), order doesnt really matter for shields.
xiriod
Posts: 1131
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by xiriod »

This worked -

Code: Select all

001 $laser = [THIS] -> get compatible laser array: turret= 1
002 $bays = [THIS] -> get number of laser bays
003 [THIS] -> add lasers per value: $bays flags: $laser
004 return null
And created a variable number of guns on the OWP.

Now I need to find a way to tie it on to a search for newly created OWPs :)

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