Add built-in ship software?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
Add built-in ship software?
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?
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?
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
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
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
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
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
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.
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
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.
- solarahawk
- Posts: 257
- Joined: Sat, 22. Dec 07, 23:18
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:
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:
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.
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}
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
- ubuntufreakdragon
- Posts: 5195
- Joined: Thu, 23. Jun 11, 14:57
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.
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
XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
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.)
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.
- ubuntufreakdragon
- Posts: 5195
- Joined: Thu, 23. Jun 11, 14:57
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.
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
XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
- solarahawk
- Posts: 257
- Joined: Sat, 22. Dec 07, 23:18
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.
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.
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
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
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
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
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
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06
- ubuntufreakdragon
- Posts: 5195
- Joined: Thu, 23. Jun 11, 14:57
There is no difference between AP and TC regarding the JOBS.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...
My X3 Mods
XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist
XRebirth, things left to patch:
In General; On Firing NPC's; In De Vries; Out Of Zone; And the Antiwishlist
- DarrenTomlyn
- Posts: 205
- Joined: Sun, 17. Oct 04, 19:06