[Discussion] Generic X3TC S&M questions III

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
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Tue, 31. May 16, 16:56

You can add the ship, but I don't think you can get the "ware turns into ship"-mechanism to work.
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!

tearing
Posts: 46
Joined: Mon, 26. Oct 15, 03:20

Post by tearing » Sat, 4. Jun 16, 09:37

the only thing i can do are just changing existing drone eh.
and how the game decide ai ship's loadout?

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

Post by X2-Illuminatus » Sat, 4. Jun 16, 20:12

tearing wrote:the only thing i can do are just changing existing drone eh.
Or you write a script, activated via a command slot or a hotkey, which creates a drone close to the playership and removes the respective "drone ware" from its cargo hold.
tearing wrote:and how the game decide ai ship's loadout?
Depends on the situation: For job ships there's the weapons and equipment tab in the Job editor allowing you to set allowed/forbidden values and define to which percentage values the ships should be equipped. You can also create and specify a config script in the general tab, which you could use to equip a ship. The wares list id will specific, which wares a trading ship will trade.
In some cases the loadout is hardcoded, and works after certain formulas: pick the strongest shields and a certain amount of certain weapons, or the like.
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!

tearing
Posts: 46
Joined: Mon, 26. Oct 15, 03:20

Post by tearing » Wed, 8. Jun 16, 17:54

today i made a new weapon.
after a cup of coffe its work.

now the problem is, i cant see any AI ship using that weapon.
i cant find a way how to make AI ship carry that weapon on job file.

Leonardo Myst
Posts: 20
Joined: Fri, 8. Jul 16, 23:26
x3ap

Post by Leonardo Myst » Sat, 9. Jul 16, 01:40

I was looking at [RESOURCE/TUTORIAL] X3:TC Music Library + Changing the soundtrack as I'm planning to replace all the music files with ship/cockpit noises (engine hum, beeps, clicks, etc.) and I have a question.

I got X3TC&AP on Steam but haven't installed the game yet, as we're in the process of getting a new computer.
Will the above info on changing the music tracks work on a Steam installed version of the game?
Are the music tracks in the same format/directory setting?

And another question... is there a limit to length of each track?
I assume the tracks loop.
But I started with a 40 minute track of an engine hum and added beeps and computer noises.
Should I chop it down into smaller pieces?
Or can I leave it as is?

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

Post by X2-Illuminatus » Sat, 9. Jul 16, 11:30

Yes to the first two questions. I'm not aware of a file length limit, but to be honest I never tried it out with something longer than the usual 3 to 5 minutes.

When modding the Steam version it is a good idea to create a second installation, which is independent from the Steam installation though. That way you won't run into any problems with Steam trying to update or replace any modified files with their originals. To create one, simply copy the whole X3 Terran Conflict Steam folder (which includes the X3AP "addon" directory) to a different place and download and extract the NoSteam.exe files to that location. The one for X3AP can be downloaded here, and while there is no specific one for X3TC, you can simply download the latest non-Steam patch and use the exe file from that one to start the game without Steam.
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!

Leonardo Myst
Posts: 20
Joined: Fri, 8. Jul 16, 23:26
x3ap

Post by Leonardo Myst » Sat, 9. Jul 16, 19:45

Thanks, X2-Illuminatus!
I'll do just that.

Avatar of darkness
Posts: 83
Joined: Tue, 3. Aug 04, 16:28
xr

Post by Avatar of darkness » Fri, 7. Oct 16, 23:59

I ran into a problem with ",910 ,842" and find solution by darkangel666:

http://www.x2thethreat.com/x2/forum/vie ... p?t=380876

Edit t file content


<page id="117">
<t id="2000">{117,910} {117,911}</t>
<t id="2001">{117,910} {117,842}</t>
<t id="2002">{117,957} {117,125}</t>
<t id="2003">{117,957} {117,126}</t>
<t id="2005">{117,841} {117,845}</t>
</page>

<page id="118">
<t id="2000">{118,910} {118,911}</t>
<t id="2001">{118,910} {118,842}</t>
<t id="2002">{118,957} {118,125}</t>
<t id="2003">{118,957} {118,126}</t>
<t id="2005">{118,841} {118,845}</t>
</page>

<page id="119">
<t id="2000">{119,910} {119,911}</t>
<t id="2001">{119,910} {119,842}</t>
<t id="2002">{119,957} {119,125}</t>
<t id="2003">{119,957} {119,126}</t>
<t id="2005">{119,841} {119,845}</t>
</page>



But what files I must change?
A long time ago in a galaxy far, far away...

RobCubed
Posts: 24
Joined: Thu, 21. May 09, 13:17
x4

Post by RobCubed » Tue, 6. Dec 16, 22:36

Question -

How do I save data in the player's save game file?

Example - if I have a script that loads a t file, picks a random entry from a page in it, and then uses it - I want that player's save game to NEVER use that entry again.

Are there any example scripts or guides on how to store data in the player's save game?

Edit: Are global variables saved in the player's save game?

Edit #2: They do. That works. Simple enough.

Edit #2: New question - is there any efficient way to randomly resort a large array?

Edit #2: I'll just try Fisher-Yates, if I only have to run it once on setup it shouldn't be bad at all

More editing, Fisher-Yates worked great. 2500 string list (pulling from a page, leaving room for up to 10k if you want to edit the page file) goes very quickly - no noticeable delay when initializing. Only run on setup obviously, and only once unless you reinit globals.

Code: Select all

$Key.ShipNames = 'rc.ShipNames'
$ShipNames = get global variable: name=$Key.ShipNames
if not $ShipNames
    $ShipNames = read text: page id=8847, from 1 to 10000 to array, include empty=[FALSE]
    $ShipNames.currentIndex = size of array $ShipNames
    $randomizedShipArray = array alloc: size=$ShipNames.currentIndex
    while 0 != $ShipNames.currentIndex
        $randomIndex = random value between 0 and $ShipNames.currentIndex
        dec $ShipNames.currentIndex
        $temporaryShipValue = $ShipNames[$ShipNames.currentIndex]
        $temporaryRandomValue = $ShipNames[$randomIndex]
        $ShipNames[$randomIndex] = $temporaryShipValue
        $ShipNames[$ShipNames.currentIndex] = $temporaryRandomValue
    end
    set global variable: name=$Key.ShipNames value=$ShipNames
end
I know I'm answering my own questions but thought it might help if somebody else has the same one. I hate seeing posts online "Hey how do I do this Edit: Nevermind fixed it" with no solution posted.

hqz
Posts: 37
Joined: Sun, 10. Jul 16, 11:28
x3ap

Post by hqz » Sat, 25. Mar 17, 04:46

I'm trying to set the turret command for a ship through a script but I can't get it to work.

So far I thought this would work (but it doesn't):

Code: Select all

$ship -> call script !turret.command.alpha : turret id=2
What am I doing wrong?
Last edited by hqz on Sat, 25. Mar 17, 16:10, edited 1 time in total.

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

Post by X2-Illuminatus » Sat, 25. Mar 17, 12:53

You need to start turret scripts on either of the tasks from 1 to 6, which are reserved for these specific commands and which represent the turrets 1 to 6.
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!

hqz
Posts: 37
Joined: Sun, 10. Jul 16, 11:28
x3ap

Post by hqz » Sat, 25. Mar 17, 16:12

X2-Illuminatus wrote:You need to start turret scripts on either of the tasks from 1 to 6, which are reserved for these specific commands and which represent the turrets 1 to 6.
Thanks for the quick reply.

Sorry for being such a noob but I'm not sure I understand the answer. Do you mean that I am not using the right ID or is the target of the script the wrong entity?

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

Post by X2-Illuminatus » Sat, 25. Mar 17, 17:16

If you have a look at the code of the script you are calling, you will see that the turret id argument is not passed on to the then following called script !plugin.gz.missile.def.mk3. (Which actually makes the argument quite useless. Not sure what the idea behind that was. I guess it's either a remnant from an old script or a planned feature of some sort, which was not implemented.) The script !plugin.gz.missile.def.mk3 gets the turret id by checking which task it is running on. So in order to run it on turret 2, you have to start it directly on task 2, which isn't possible with the command you are using. There are two "start script on task" commands in the General Commands -> Script Calls section for this.

To learn more about tasks and script calls I suggest having a look at the MSCI Handbook, which, while originally written for X2, is still relevant to the latest X3 games.
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!

hqz
Posts: 37
Joined: Sun, 10. Jul 16, 11:28
x3ap

Post by hqz » Sat, 25. Mar 17, 19:51

X2-Illuminatus wrote:If you have a look at the code of the script you are calling, you will see that the turret id argument is not passed on to the then following called script !plugin.gz.missile.def.mk3. (Which actually makes the argument quite useless. Not sure what the idea behind that was. I guess it's either a remnant from an old script or a planned feature of some sort, which was not implemented.) The script !plugin.gz.missile.def.mk3 gets the turret id by checking which task it is running on. So in order to run it on turret 2, you have to start it directly on task 2, which isn't possible with the command you are using. There are two "start script on task" commands in the General Commands -> Script Calls section for this.

To learn more about tasks and script calls I suggest having a look at the MSCI Handbook, which, while originally written for X2, is still relevant to the latest X3 games.
This is perfect. I just managed to make it work with this info.

Thanks a lot for your help. This community is pretty cool. :)

Reaper507
Posts: 62
Joined: Tue, 5. Aug 14, 00:34

Post by Reaper507 » Sun, 9. Jul 17, 23:25

Hello guys,

changing jobs.txt requires start a new game? What means field "Is Owner Sector"?

User avatar
Aldebaran_Prime
Posts: 1386
Joined: Sat, 20. Feb 10, 17:47
x4

Post by Aldebaran_Prime » Mon, 10. Jul 17, 07:51

Reaper507 wrote:Hello guys,

changing jobs.txt requires start a new game? What means field "Is Owner Sector"?
I just tested a changing of jobs.txt - no it doesn't. But it need several hours (>4) until it worked in my case.

"Is Owner Sector" means, that ships only appear in sectors which have the same race as the job-entry race. Sure - after spawning, they may move into other sectors...

Xe-131
Posts: 64
Joined: Mon, 1. Jun 15, 15:23
x4

Post by Xe-131 » Thu, 24. Aug 17, 21:34

Hi,

I decided against creating a thread as I'm sure this question or similar has been asked a thousand times, but I've started playing around with the galaxy editor and when I try to add sectors that weren't already in the loaded x3_universe (from import patch data, I'm on Litcube's Universe and haven't tried vanilla yet but I have to download it first) I can't see them on the universe map afterwards, nor can I connect gates to them or access them in any way. I can't even change sector names or descriptions.

Is what I'm trying to do beyond the editor's capabilities? If so, could anyone point me in the right direction?

Cheers!

Darth_Wayner
Posts: 33
Joined: Sun, 20. Jan 13, 01:01

Post by Darth_Wayner » Sun, 28. Jan 18, 15:18

I'm trying to write a script similar to "Space Loot Transpoter" that works on Marines. I'm tired of flying around trying to scoop up marines after a failed boarding attempt so I want to put them back into my cargo hold via transporter device.

SLT uses <var> get object class

I can find "Astronaut" under get object class and "space suit" under a <var> get ship class but niether of these seem to work for marines, which show on the sector map as "Astronaut (Marine)". I can't seem to find this object anywhere in the scripting menus.

As a follow-on, I tried alternatively to have the script read the Marine information with "<Var> get marine fighting skill" etc then destroy the flying marine and create a duplicate in my cargo hold. This isn't favorable because I'd lose the marine historical stats such as number of boarding etc, but better than nothing. I can't get this to work either because the scripts doesn't seem to recognize a flying marine the same way it does a Marine in you cargo hold.

Based on oth of these attempts, I can only surmise that a flying marine is a special type of object that I just haven't been able to find in the scripting menus?

Any help would be appreciated!

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

Post by X2-Illuminatus » Sun, 28. Jan 18, 16:57

Are you sure that your code finds the correct astronaut in space, before you perform the class check? Best you post your script code here, so that we can have a look. (Double click on the script file in your "scripts" folder, then post the browser view of your script in code-tags here.)

An object class check for Astronaut should work on any astronaut in space, whether it's a passenger or a marine. To determine whether it really is a marine then, there's the <RetVar/IF> is marine: passenger/astronaut=<Var/Passenger> command. The commands to retrieve the marine skills should work on a marine in a space suit, too.
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!

Darth_Wayner
Posts: 33
Joined: Sun, 20. Jan 13, 01:01

Post by Darth_Wayner » Mon, 29. Jan 18, 03:25

thanks for your help illuminatus, not sure what i was foing wrong, but i got it working now. my last minor hiccup is that i'm trying to get the marine's name. everytime i beam a marine aboard, its name is "Astronaut ( Marine)". im using "<ret/var> get object name" or something similar under general object commands. Is there a command where i can get the marine's actual name name (Leonar Jovi, for example)?

Post Reply

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