Ship-Naming Mod [Help wanted]

The place to discuss scripting and game modifications for X4: Foundations.

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

Buckey
Posts: 8
Joined: Mon, 31. Dec 18, 00:58
x4

Ship-Naming Mod [Help wanted]

Post by Buckey »

Alright...decided to try something smaller than my previous idea for my first mod.

So, regular AI ships are named like "TEL Hull Parts Trader (678-YOP)" right? Indicates what they trade, their role, and their "registry" I guess. It's my understanding that the registry numbers can't be changed...which is fine. What I want to is change the beginning.

I want the AI to have custom names pulled from a randomly generated list.

For example, that TEL trader might look like "Joyous Profits - TEL Trader (678-YOP)" instead. Sort of like the Arcadian Endeavor or other uniquely-named NPC ships.

I think those names are related to the jobs.xml file, which I located after unpacking cat8. I know how to create the extension folder and my content.xml, and I believe I need an md folder. But after that, I am lost.

How would I go about scripting and making a mod to do the following:

1). Every AI ship receives a name pulled from a list.
2). These names are faction based, so for example Teladi would get different themed names than Paranid.
3). Names are also applied on game start and when new ships are built.
User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 13477
Joined: Sun, 15. Feb 04, 20:12
x4

Re: Ship-Naming Mod [Help wanted]

Post by euclid »

It's a little tricky ;-)

Names are read from the corresponding (language) text files when defining a job. Although your intuition is correct (it happens in the jobs.xml) the tricky part is 2-fold: You'll need add rather long (you don't want to run out of names) list of race-specific names to the text file (or create a new one) and you would need to do that for each language unless you restrict your mod to EN only. Then you'll need to code a script that changes the name reference in the jobs.xml depending on the race the ship is associated with.

There is an alternative but it''s not that easy to code, too. Thanks to the command "set_object_name" you can rename almost everything. Hence you could code a script (either an XML that runs every hour or an MD that triggers on a new ship) that checks the ships and rename them in a race-specific random (that's, again, the difficult part) way.

Hope that helps.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786
Buckey
Posts: 8
Joined: Mon, 31. Dec 18, 00:58
x4

Re: Ship-Naming Mod [Help wanted]

Post by Buckey »

euclid wrote: Tue, 17. Dec 24, 18:36 It's a little tricky ;-)

Names are read from the corresponding (language) text files when defining a job. Although your intuition is correct (it happens in the jobs.xml) the tricky part is 2-fold: You'll need add rather long (you don't want to run out of names) list of race-specific names to the text file (or create a new one) and you would need to do that for each language unless you restrict your mod to EN only. Then you'll need to code a script that changes the name reference in the jobs.xml depending on the race the ship is associated with.

There is an alternative but it''s not that easy to code, too. Thanks to the command "set_object_name" you can rename almost everything. Hence you could code a script (either an XML that runs every hour or an MD that triggers on a new ship) that checks the ships and rename them in a race-specific random (that's, again, the difficult part) way.

Hope that helps.

Cheers Euclid
Thank you for the response! Are you able to help me figure out how to write and apply the scripts? I have a list of names generated for Teladi (decided to test them first before trying other factions). I have 2,000 names ready and will probably add more if needed, but how do I go about applying these in the two methods you suggested? I assume the first method you listed would be easier, but open to both.

Return to “X4: Foundations - Scripts and Modding”