Add built-in ship software?

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

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

Add built-in ship software?

Post by DarrenTomlyn » Thu, 16. Apr 15, 01:12

Although most of my mod is pretty much finished, now, the one problem I've run into is that the additional ships I've added to the game (and especially to the AI via the map xml file) are not all equipped with built in software - fight command software and triplex scanners in particular.

I'm sure you all can see the problems of having capital ships owned by the Ai/factions that do nothing to defend the sectors they are in, because they cannot be given the requisite commands by the computer controlling them due to not inherently having the software they need... At present, I'm having to add the software and commands manually when I encounter such ships/sectors, but for a map the size of mine, that's definitely cumbersome.

So - is there a particular reason why some ships do not have any built-in software, and how (can?) I fix it?
Darren Tomlyn

Tune-writer and fiddle-player,

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

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Thu, 16. Apr 15, 01:25

arent ai ships using their own scripts independent of the command slots? (these are iirc only required for the Player to start the scripts associated with them)
The Scripts executed by NPCs are iirc defined in the Jobs files which circumvents the command slots completely (btw: why arent you using these for defining AI Ships?)
also adding software wont change the script they are currently executing, so not much sense in adding it afterwards (except you use your own scripts which do have this implemented - the vanilla scripts definietly dont have such a feature) - sole exception would be scanners because they define the Sensor range which is the base for the distance enemies are engaged iirc


its been a few years since i modded TC, but i think your assumptions on this topic are wrong
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

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

Post by DarrenTomlyn » Thu, 16. Apr 15, 01:59

I would have thought that too, except just by adding such software to some ships has then generally made them actually do something - before then they were just sitting there (0m/s) doing nothing...

Whatever the AI scripts do does seem to be affected the by the software the ships have...

Not all ships have been affected by this equally, though, even of the same class (M2). For those that don't do anything, I normally have to take them over and give them both the software & commands, (defend sector), (and give them back), in order to get them to do anything.

Again, I would assume all AI scripts etc. to be based upon the ship class, and yet there are differences between lots of ships of the same class... The only measurable difference that I can see that would cause the problem, is that those that work have the built-in software, and those that don't, don't :p

Adding such software usually fixes the problem, but not always. It would be nice to solve that particular problem first, if possible?

EDIT - Note: Even just taking over the ships and giving them back again to the AI doesn't do much without at least adding such software, so I definitely think it has role to play with AI ships, too.
Darren Tomlyn

Tune-writer and fiddle-player,

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

User avatar
solarahawk
Posts: 257
Joined: Sat, 22. Dec 07, 23:18
x4

Post by solarahawk » Thu, 16. Apr 15, 21:42

Well, I am fairly new to scripting myself, but I am in the middle of a review and update of the Anarkis Pirate Guild/Yaki Armada packages. What I have observed with that system, when a new NPC ship is built, part of the process includes adding the appropriate software to the ship. Serial Kicked did this with a helper script that he called during the Build.Ship routine. The Add.Software script takes the provided ship object as an argument and installs software based on the ship class.

For instance:

Code: Select all

* Basic equippment
= [THIS]-> install 1 units of {Best Buys Locator}
= [THIS]-> install 1 units of {Boost Extension}
= [THIS]-> install 1 units of {Docking Computer}
= [THIS]-> install 1 units of {Combat Command Software MK1}
= [THIS]-> install 1 units of {Jumpdrive}
$rnd = random value from zero to 1
if $rnd == 0
   = [THIS]-> install 1 units of {Triplex Scanner}
else
   = [THIS]-> install 1 units of {Duplex Scanner}
end
= [THIS]-> install 1 units of {Navigation Command Software MK1}
= [THIS]-> install 1 units of {Singularity Engine Time Accelerator}
a set of basic equipment is installed in all ships regardless of ship class, and then if the ship is a fighter class, specific modules are installed:

Code: Select all

* Fighter equippment
if [THIS]-> is of class [Fighter]
$rnd = random value from zero to 1
skip if $rnd == 0
   = [THIS]-> install 1 units of {Explorer Command Software}
= [THIS]-> install 1 units of {Combat Command Software MK2}
= [THIS]-> install 1 units of {Freight Scanner}
$rnd = random value from zero to 1
skip if $rnd == 0
   = [THIS]-> install 1 units of {Patrol Command Software}
$rnd = random value from zero to 1
skip if $rnd == 0
   = [THIS]-> install 1 units of {Transporter Device}
end
So wherever you are creating those ships, you can probably do something similar. Depending on how and why those ships are being generated, leveraging the Jobs system might also be worth considering, as UniTrader suggested.

User avatar
ubuntufreakdragon
Posts: 5195
Joined: Thu, 23. Jun 11, 14:57
x4

Post by ubuntufreakdragon » Thu, 16. Apr 15, 22:02

LOL, this is ... EASY.
to add build in compents to a new ship type:
open the tships with x3editor2's tfileeditor select the ship, the last tab 'Wares' is the one you are searching for, just enter the number of a matching set.

If you need to add wares on spawn add a config.script to the matching JOBS entry.
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

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

Post by DarrenTomlyn » Thu, 16. Apr 15, 22:13

What does it mean by a 'matching set' though? I've looked at that before, but haven't found anything usable - maybe I wasn't looking hard/long enough...

I'll try again...

Got it - warelist 86...

EDIT: Hmm - it appears the ship creator wasn't applying the same settings for each class of ship. Well, it'd be nice if I knew how to create my own warelists... (I'd like one with trade/combat software 1, and one with trade command 1&2.)
Last edited by DarrenTomlyn on Thu, 16. Apr 15, 22:33, edited 1 time in total.
Darren Tomlyn

Tune-writer and fiddle-player,

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

User avatar
ubuntufreakdragon
Posts: 5195
Joined: Thu, 23. Jun 11, 14:57
x4

Post by ubuntufreakdragon » Thu, 16. Apr 15, 22:21

You can also add custom lists by editing the types/Warelists.txt
And if you know another ship using a matching list just look up it's list id.
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

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

Post by DarrenTomlyn » Thu, 16. Apr 15, 22:34

ubuntufreakdragon wrote:You can also add custom lists by editing the types/Warelists.txt
And if you know another ship using a matching list just look up it's list id.
Cool - that's just what I'm looking for, thanks. I'm surprised I hadn't figured all this out before :p
Darren Tomlyn

Tune-writer and fiddle-player,

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

User avatar
solarahawk
Posts: 257
Joined: Sat, 22. Dec 07, 23:18
x4

Post by solarahawk » Thu, 16. Apr 15, 22:53

:roll: I knew I was forgetting something. But that reminded me to ask you about your new AI ships you added. You said you added them via the X3_universe.xml map. You know that adding ships to the map like that are just for the abandoned ships that can be claimed, not active AI ships.

If you are trying to add new ships that are owned by a race/faction and use AI behavior, you have to either add them via a script or via the Jobs file. If these are new ship types modded into the game, then the Tships should be setup to ensure they have the correct wares. For general ship spawns, the Jobs file is the easiest way to set their spawn rate and behavior.

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

Post by DarrenTomlyn » Thu, 16. Apr 15, 23:23

Wrong - combat ships can be added to the map file and given any race owner you like - I know, because it's what I've done. Transport ships, yes, have to be done via the jobs files - combat ships, no.

The AI will automatically take them over if given to a non-player/non-neutral faction.

It appears that the wares (software) they carry also affect/determine their behaviour, too - (and weapons and shields (maybe cargo expansions?) are added automatically, though speed/maneuverability is not) - this is the problem I've been having, as some ships had additional wares, and others did not. (The ships can sometimes be given other wares, too, though what dictates that, I don't know.)

EDIT: As I expected, adding the software via the TShips file fixed the ships that worked once I'd added it manually in-game, and didn't fix those that didn't :p
Darren Tomlyn

Tune-writer and fiddle-player,

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

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Fri, 17. Apr 15, 11:12

Added them to the map is the old way and how it worked in X2.

AI ships that dont have a command, will be given a default one, which is based on the ship class, as well as certain software on the ship.

Adding ships to the map doesn't give them any commands, and relies on this default command.

Adding the ships via jobs will remove the problem, as you can assign the command you want the ship to run, and it shouldn't need any built in wares to do this. The jobs ships also have additional routines for adding wares to ships, via the config scripts

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

Post by DarrenTomlyn » Fri, 17. Apr 15, 12:23

I've never been able to mod the jobs files successfully... Most of the resources I've seen to do so are for AP, not TC...
Darren Tomlyn

Tune-writer and fiddle-player,

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

User avatar
ubuntufreakdragon
Posts: 5195
Joined: Thu, 23. Jun 11, 14:57
x4

Post by ubuntufreakdragon » Fri, 17. Apr 15, 14:03

DarrenTomlyn wrote:I've never been able to mod the jobs files successfully... Most of the resources I've seen to do so are for AP, not TC...
There is no difference between AP and TC regarding the JOBS.
My X3 Mods

XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist

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

Post by DarrenTomlyn » Fri, 17. Apr 15, 15:13

(Let me check again) - I remember what the problem was now: I only have MS Office 2003, and all the ways I can really change everything easily need Office 2010...
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”