[Discussion] Generic X3TC S&M questions III

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

Post Reply
Clanf
Posts: 2
Joined: Thu, 11. Jul 19, 16:04
x3ap

Re: [Discussion] Generic X3TC S&M questions III

Post by Clanf » Sat, 13. Jul 19, 18:02

question about director\start.xml - when setting relations, what does mutual="1" exactly do? isn't relations are mutual already or is it something different? i just don't get it and it really hunting me

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

Re: [Discussion] Generic X3TC S&M questions III

Post by Cycrow » Sat, 13. Jul 19, 19:33

Every race has a relation with every other race. The player race you see is how the other races see the player. You can also set how you see the other races in the global command console. Mutual will set the relation both ways. So without mutual, you change the argon and boron relations, it'll change how argon see the boron, but not how the boron will see the argon.

Clanf
Posts: 2
Joined: Thu, 11. Jul 19, 16:04
x3ap

Re: [Discussion] Generic X3TC S&M questions III

Post by Clanf » Sun, 14. Jul 19, 00:03

hm, i think i got it now, its just having separate relations for two races to each other threw me off, you would think "mutual" should be on by default, otherwise there is kinda no point in setting it half way

User avatar
Hairless-Ape
Posts: 313
Joined: Wed, 6. Nov 02, 20:31
xr

Script Reloading

Post by Hairless-Ape » Sat, 10. Aug 19, 03:53

Noob here,


So I modified a script in the /addon/Scripts folder.. new version, and some simple text changes, nothing affecting the logic..
When I load my saved game, and then go into the Script Editor and look at the list of Scripts and their versions, it's showing me the OLD script.
I tried clearing script caches and a few other things, but it seems stuck on V1 of that script no matter how I change it.

How do you force the game to use a new version of a script ?

Thank you,

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Re: [Discussion] Generic X3TC S&M questions III

Post by X2-Illuminatus » Sat, 10. Aug 19, 17:41

Is the old script file still present in the "addon\scripts" folder but in a .pck format? If so, the game gives precedence to it. If you edit a .pck script file using the script editor, it does not change the .pck-file but rather creates an .xml copy of it.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
Hairless-Ape
Posts: 313
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [Discussion] Generic X3TC S&M questions III

Post by Hairless-Ape » Sun, 11. Aug 19, 15:38

The script is viewtopic.php?t=383317 by Sebbi08.
It is composed of 2 xml files, both in the /addon/scripts folder.
I think it replaces the normal Mayhem's Cmd.SatellitesMonitoring.Reap.Go command.

When I put them in there, the game seemed to pick them up fine. However, if I make even a simple version number change and reload a saved game, the script editor in-game still thinks it's at V1. If I use the in-game script editor, it does change it properly, and I find the game modifies the actual XML file when I quit. It just doesn't seem to pick up any changes I might make outside the game. I'm doing something wrong. Thanks for the help.

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Re: [Discussion] Generic X3TC S&M questions III

Post by X2-Illuminatus » Sun, 11. Aug 19, 15:57

How do you do these changes "outside the game"?

MSCI xml script files (in comparison to MD files) are not designed to be edited in anything but the in-game or a dedicated external Script Editor (like the one from mr.bear). The somewhat readable part at the top of a script file (if you open it in a plain xml or text editor) is just the text meant for the browser view of the script - doubleclicking on a script file in the "scripts" folder or any other folder where the x2script.xsl is present, opens the browser with a readable view of the script code. The actual code, however, is placed between the codearray-tags.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

User avatar
Hairless-Ape
Posts: 313
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [Discussion] Generic X3TC S&M questions III

Post by Hairless-Ape » Sun, 11. Aug 19, 22:09

The dedicated external script editor does present a nice Code editing window, devoid of any of the XML Tags present in the raw XML file, but the XML file itself is text and you can open it with a text editor and edit the lines between the codearray-tags as you say. It's just difficult. I did open the XML file in Visual studio AS a binary file to ensure there was no hidden binary information in the file, and sure enough, it's just plain XML text all the way through.

I edited the XML file with Notepad++, and yes, it was painful to look at..

My problem with X-Studio 1.8 at present, is that it doesn't seem to recognize all the commands in this script.
I.E. a call to "display info box: ...." shows up in the X-Studio window as "<Unrecognised Command>". There are several others that it doesn't recognize.
I used the XRCatTool to extract all the cat files to a new folder, but not quite sure how to reference it from within the editor. In X4, it has an "/md/md.xsd" file you can reference in an editor, but I don't see this for X3. The x2script.xsl is just for formatting xml in a readable way, and not for resolving library methods/functions.. at least not that I know of.

I'm fairly certain I changed a benign part of the script using Notepad++ and doing a file compare, I can see only that one simple change and the changed version number.. But it won't load it up the revised script when I load up X3. I'm mainly concerned about the mechanics of why it isn't reloading my script and what I need to do to force it to reload it.. The editor issue is one I would love to solve, but I don't actually think that will change the re-loading issue I'm having.

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

Re: [Discussion] Generic X3TC S&M questions III

Post by Cycrow » Mon, 12. Aug 19, 11:12

For the version number, you must change it in both parts of the file. Its near the top in the readable part, and in the codearray.

The actual script itself needs to be changed in the codearray.

As for the unrecognized commands, these were new commands that have been added since X-Studio, you can add custom commands like the new missing ones. I seem to remember someone posting a file with these in

Crackajacka87
Posts: 9
Joined: Sat, 22. Jun 19, 14:50
x3ap

Re: [Discussion] Generic X3TC S&M questions III

Post by Crackajacka87 » Sat, 24. Aug 19, 11:39

So I'm a complete noob here but I'm trying to look into ways to set races to actually invade other races and conquer sectors but looking through other scripts that has this feature initiated in I cant seem to find any script that shows how it is done or activated... Now I'm not going to directly copy these scripts as they were meant to work for their version of the game but to take inspiration and understanding of how to implement something familiar myself.

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [Discussion] Generic X3TC S&M questions III

Post by Joubarbe » Sun, 25. Aug 19, 20:41

Uhhh, you know that's a big feature right? You don't write that in two lines of code... To make everything believable and gameplay-wise interesting will take dozens of scripts (Mayhem has 500). Why don't you download a script that does it for you?

Crackajacka87
Posts: 9
Joined: Sat, 22. Jun 19, 14:50
x3ap

Re: [Discussion] Generic X3TC S&M questions III

Post by Crackajacka87 » Mon, 26. Aug 19, 18:00

Because of compatibility issues... I was hoping to add in a script or 2 with just the invasion mechanic but if it's too much for a beginner then maybe I should give up and chew down something a little more easier than jumping straight into the deep end lol

User avatar
Joubarbe
Posts: 4796
Joined: Tue, 31. Oct 06, 12:11
xr

Re: [Discussion] Generic X3TC S&M questions III

Post by Joubarbe » Mon, 26. Aug 19, 18:45

STO is propably the most known script on that subject. But it's only about you, as a player, taking over sectors.
I've started Mayhem 4 years ago with about the same project as you. "Just an invasion script" :)

If you have specific questions don't hesitate to create new threads. I think the easier way to make a generic invasion script would be to take existing ships (Military ones for instance) and make them go to a random sector and destroy all stations. But then you would have to rebuild everything in some way.

Xaritscin
Posts: 7
Joined: Fri, 11. Sep 20, 03:19

Re: [Discussion] Generic X3TC S&M questions III

Post by Xaritscin » Sat, 12. Sep 20, 16:35

im considering to start modding my game or at least meddle around with the mod i downloaded to see if i can fix/add more stuff to it. but i have some questions:

1. what is the most up to date tool for modding X3? (including AP)

2. the mod i use has its files on the TC folder, so AP uses it as a base when loading but of course certain features are out like the Stock Exchange or the ships added in that expansion. if i were to re-enable that content i would have to edit the mod files in order to port them to the AP folder?

3. is it possible to mod the game to add extra stats to ships? i was considering making a mod that adds Armor as a possible third stat the same way Shield is added (bought as a ware, shows on the tooltip and does stuff).

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Re: [Discussion] Generic X3TC S&M questions III

Post by X2-Illuminatus » Sun, 13. Sep 20, 14:14

1. It depends on what you mean with modding:
  • If it's just installing scripts & mods, then the Plugin Manager.
  • If it's actually changing game files, then the X3 Editor 2 for extraction, repacking and editing of types and similar game files. Notepad++ for simple edits of txt and xml files is also worth installing.
  • For changing or creating ship / station models you will need a dedicated 3d model program like 3dsmax or Gmax.
  • For scripting (MSCI), next to the ingame script editor, there's an external script editor, X-Studio, by mrbear. For writing Mission Director scripts any xml editor which can read the director schemas will do.
2. If you're modding X3AP, you should always start with a clean X3TC installation as a base for X3AP. If you want to use an X3TC mod in X3AP, then you will have to adjust its files accordingly. That is unless X3AP already uses those files from X3TC.

3. I don't think so.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Xaritscin
Posts: 7
Joined: Fri, 11. Sep 20, 03:19

Re: [Discussion] Generic X3TC S&M questions III

Post by Xaritscin » Mon, 14. Sep 20, 04:35

i see, well in this case im trying to find a way to port Xtended to Albion Prelude, as in, moving all the Cats, folders and scripts into the Addon folder rather than modifying the root folder. already learned how to extract the Cats, use X3 Editor and X Studio but im getting a bit lost on how the modding structure operates:

1. regarding Fake Patching:

does the game have a way to figure out which files replace others in the hierarchy? for example i have 3 Cats i have renamed to Cat 5, 6 and 7; Cat 6 has a "types" folder which containes all the pack files with the vital changes like ships, weapons, shields, bullets, etc... at the same time Cat 7 also has a "types" folder but it only contains a few of the same files (with different changes i suppose). if i understand this right the last Cat is considered the uppermost in the hierarchy so, does the game understand that only those files inside Cat 7 types override the ones in Cat 6 or how does it work?

2. regarding TShips:

i organized a list on notepad to catalogue the entities on TShips for vanilla AP and the mods im going to merge based on name and ID. editing the contents seem to be relatively easy on X3 Editor but when looking directly to the file using text editor it seems there's no apparent organization to the code lines. for example i was reading the top part which is supposed to be all the registered entities under Argon but right after the TS variations im seeing stuff like Drones in the lines. is there a tool for visualizing the content of that file and actually add more lines to it at the same time?

and also, does TShips affect the navigation controls of the entities? when reading the Xtended mod thread someone reported a ship was bugging out on terms of navigation (ship rolled when ordered to turn), i want to fix stuff like that too but dont know where to look at it

3. regarding Custom Weapon Compatibility:

i looked for some tutorials about making new weapons and i kind of get it but im left wondering something, for those cases when a mod adds new weapons is there an additional file that has to be changed for ships to use it? for example Xtended added several weapons to flesh out racial weapon doctrines and they probably edited both the TC and the mod specific ships so they can use the weaponry. if i were to port the mod to Albion Prelude in order to enable the AP ships along with adding stuff from Cadius Xtra Ships Pack i would have to edit additional files related to those ships so they can use the new weaponry? (this pertains both to main weapons, turrets and missiles)

4. regarding the launcher:

i noticed mods can edit stuff in the launcher, where can i edit that? like showing the name of my mod or fixing errors on the launcher text after installing a mod

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

Re: [Discussion] Generic X3TC S&M questions III

Post by Cycrow » Mon, 14. Sep 20, 13:56

Xaritscin wrote:
Mon, 14. Sep 20, 04:35
1. regarding Fake Patching:

does the game have a way to figure out which files replace others in the hierarchy? for example i have 3 Cats i have renamed to Cat 5, 6 and 7; Cat 6 has a "types" folder which containes all the pack files with the vital changes like ships, weapons, shields, bullets, etc... at the same time Cat 7 also has a "types" folder but it only contains a few of the same files (with different changes i suppose). if i understand this right the last Cat is considered the uppermost in the hierarchy so, does the game understand that only those files inside Cat 7 types override the ones in Cat 6 or how does it work?
The game will load each file from the latest cat file. So if you have file1 and file2 in 6, and file2 in 7, then it will load file1 from 6 and file2 from 7.
Effectically any files in the later cat files will overright those in the previous, but they only need to contain the files that have changed, not all of them.

Xaritscin wrote:
Mon, 14. Sep 20, 04:35
2. regarding TShips:

i organized a list on notepad to catalogue the entities on TShips for vanilla AP and the mods im going to merge based on name and ID. editing the contents seem to be relatively easy on X3 Editor but when looking directly to the file using text editor it seems there's no apparent organization to the code lines. for example i was reading the top part which is supposed to be all the registered entities under Argon but right after the TS variations im seeing stuff like Drones in the lines. is there a tool for visualizing the content of that file and actually add more lines to it at the same time?
The tool to add lines is also the X3 Editor, that will read the TShips file, display its contents and allow you to make changing, including adding new entries.
if you want to copy entries from one file to another, then this gets abit more complicated. Generally you want to add any entries at the end of the file.
The file isn't organised by race, new ships are always added at the end of the file, so the order is simply based on when they were added.
The game references the ships in the fiel based on their position, so any scripts that directly reference ships will no longer work correctly if you add those ships in a different place.
Xaritscin wrote:
Mon, 14. Sep 20, 04:35
and also, does TShips affect the navigation controls of the entities? when reading the Xtended mod thread someone reported a ship was bugging out on terms of navigation (ship rolled when ordered to turn), i want to fix stuff like that too but dont know where to look at it
TShips does specify things like speed, turning speed, etc. Which can effect the movement. But the actual ship movement is not connected to TShips.
Xaritscin wrote:
Mon, 14. Sep 20, 04:35
3. regarding Custom Weapon Compatibility:

i looked for some tutorials about making new weapons and i kind of get it but im left wondering something, for those cases when a mod adds new weapons is there an additional file that has to be changed for ships to use it? for example Xtended added several weapons to flesh out racial weapon doctrines and they probably edited both the TC and the mod specific ships so they can use the weaponry. if i were to port the mod to Albion Prelude in order to enable the AP ships along with adding stuff from Cadius Xtra Ships Pack i would have to edit additional files related to those ships so they can use the new weaponry? (this pertains both to main weapons, turrets and missiles)
The ship comparability is in 2 separate files, TShips for the main guns, and TCockpits for each of the turrets. This is based on a bitmask of the weapons. So you can only have 32 individual weapon groups, but any number of weapons can be added per group. Comparability is done per group
Xaritscin wrote:
Mon, 14. Sep 20, 04:35
4. regarding the launcher:

i noticed mods can edit stuff in the launcher, where can i edit that? like showing the name of my mod or fixing errors on the launcher text after installing a mod
all the text in the game, including the launcher is read from the text files, mainly 0001 and the launcher from 0002. Editing the launcher one will allow you to change all the text

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Re: [Discussion] Generic X3TC S&M questions III

Post by X2-Illuminatus » Mon, 14. Sep 20, 21:18

Xaritscin wrote:
Mon, 14. Sep 20, 04:35
i see, well in this case im trying to find a way to port Xtended to Albion Prelude
There is already an experimental X3AP version for the X-Tended mod, see the post by Killjaeden here.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Xaritscin
Posts: 7
Joined: Fri, 11. Sep 20, 03:19

Re: [Discussion] Generic X3TC S&M questions III

Post by Xaritscin » Tue, 15. Sep 20, 04:03

X2-Illuminatus wrote:
Mon, 14. Sep 20, 21:18
Xaritscin wrote:
Mon, 14. Sep 20, 04:35
i see, well in this case im trying to find a way to port Xtended to Albion Prelude
There is already an experimental X3AP version for the X-Tended mod, see the post by Killjaeden here.
i know, i tried the mod first, but that was a prototype and no one is working on the mod anymore AFAIK. i want to make a fork of it that works directly on Albion Prelude instead of requiring to edit the TC folder. im also planning on expanding beyond just porting it but need to get this done first

terodil
Posts: 149
Joined: Sat, 12. Aug 17, 22:13
x4

Re: [Discussion] Generic X3TC S&M questions III

Post by terodil » Tue, 15. Dec 20, 23:28

Hi! I have a little question regarding the X3 script garbage collector. Is there anything I need to consider when working with (nested) arrays? In my current script I have quite a few of them and I don't want to risk savegame bloat with multiple invocations of the same script. So...

1. is a script finishing enough to clean up all the memory it claimed for variables/arrays?
2. reassigning pointers to arrays ($array = [0, 1, 2, 3]; ... ; $array = [5, 6, 7]): does the old array end up in the garbage bin, or is it doomed to forever wander the astral plane?
3. do I need to/can I push it there with assignments like $array = null?
3. do I (additionally?) need to resize arrays to 0 to be sure everything is gone?
4. how does the above translate into a situation with nested arrays? Do I need to walk through every 'level' before removing the higher one, or is simply removing the top sufficient?
5. anything else?

Thanks a lot,
T.
My X3 mods: Ship Autoclaimer - Ship Services - Friendlier War Sectors - in development: Logistics Centre

Post Reply

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