[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: 20865
Joined: Sun, 2. Apr 06, 16:38

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.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

tearing
Posts: 46
Joined: Mon, 26. Oct 15, 04: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: 20865
Joined: Sun, 2. Apr 06, 16:38

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.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

tearing
Posts: 46
Joined: Mon, 26. Oct 15, 04: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

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: 20865
Joined: Sun, 2. Apr 06, 16:38

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.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

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

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

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: 22
Joined: Thu, 21. May 09, 13:17

Post by RobCubed » Tue, 6. Dec 16, 23: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: 24
Joined: Sun, 10. Jul 16, 11:28

Post by hqz » Sat, 25. Mar 17, 05: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, 17:10, edited 1 time in total.

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

Post by X2-Illuminatus » Sat, 25. Mar 17, 13: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.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

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

Post by hqz » Sat, 25. Mar 17, 17: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: 20865
Joined: Sun, 2. Apr 06, 16:38

Post by X2-Illuminatus » Sat, 25. Mar 17, 18: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.
Besteht Interesse an einem Nopileos-Hörbuch?

Farnhams Legende und Nopileos als E-Books!

"People who think they know everything are a great annoyance to those of us who do." - Isaac Asimov

"If it's not impossible, there must be a way to do it." - Sir Nicholas Winton

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

Post by hqz » Sat, 25. Mar 17, 20: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: 50
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"?

Post Reply

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