[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
Mokunen
Posts: 31
Joined: Fri, 24. May 13, 01:42
x4

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

Post by Mokunen » Mon, 31. May 21, 20:33

I have a question regarding modding ettiquette:

I'm reworking (well, nearly a complete rewrite by now) "Capture Stations" by Nividium, originally just for personal use but it's come to the point where I feel it's actually polished enough that I could eventually publish it for the community to use. However, Nividium didn't specify any permissions in their mod's thread, and they also don't seem to be in the permission index thread. I don't think I can ask them directly either, as the date of their last login was nine years ago.

Should I assume that this means I should not publish anything that is derivative of Nividium's works?

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, 31. May 21, 22:07

I suggest you release your reworked / updated script, mention Nividium as the creator of the original script and link back to the original script topic.

Even if he hasn't been online in a while, best to also write him a PM about your updated version.
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!

Mokunen
Posts: 31
Joined: Fri, 24. May 13, 01:42
x4

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

Post by Mokunen » Thu, 3. Jun 21, 03:29

X2-Illuminatus wrote:
Mon, 31. May 21, 22:07
I suggest you release your reworked / updated script, mention Nividium as the creator of the original script and link back to the original script topic.

Even if he hasn't been online in a while, best to also write him a PM about your updated version.
Thank you, I will do that!

Meanwhile I ran into some confusing behaviour while trying to make my main script be able to run both from a hotkey and an autopilot command. As a command, the script lets you choose (via sector map interface) the target station which is then passed as the single argument to the script, "target.station". I imagined that when running from a hotkey instead of a command, this argument would be null, and so I could catch that and make the script use the player's aim/target. Instead, it's getting a very specific value (1732) that doesn't seem to change regardless of what ship or sector I'm in, or what I'm targeting, or what is in my cargohold... where is this ghost argument value coming from?

Heusmann
Posts: 2
Joined: Sat, 13. Oct 18, 11:54

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

Post by Heusmann » Sat, 5. Jun 21, 12:39

Hello, recently I have been messing around with changing wares and equipment sold in docks.
However, I've ran into a problem. I wanted to increase the capacity of Nividium in the NMMC HQ but I can't find where that information would be stored.

So, just to reiterate, I am asking how to change the capacity of NPC docks, not player owned stations.

Thanks in advance!

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, 5. Jun 21, 15:34

There's no way to increase that size if you're playing X3TC afaik. In X3AP the addon\types\globals file should have a storage modifier for NPC docks. Use VFS of the X3 Editor 2 to get the latest version of that file.
Mokunen wrote:
Thu, 3. Jun 21, 03:29
Meanwhile I ran into some confusing behaviour while trying to make my main script be able to run both from a hotkey and an autopilot command. As a command, the script lets you choose (via sector map interface) the target station which is then passed as the single argument to the script, "target.station". I imagined that when running from a hotkey instead of a command, this argument would be null, and so I could catch that and make the script use the player's aim/target. Instead, it's getting a very specific value (1732) that doesn't seem to change regardless of what ship or sector I'm in, or what I'm targeting, or what is in my cargohold... where is this ghost argument value coming from?
If I had to guess, I would say it's an internal number representing the position of the hotkey in the control profiles file.
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!

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, 5. Jun 21, 16:57

Mokunen wrote:
Thu, 3. Jun 21, 03:29
X2-Illuminatus wrote:
Mon, 31. May 21, 22:07
I suggest you release your reworked / updated script, mention Nividium as the creator of the original script and link back to the original script topic.

Even if he hasn't been online in a while, best to also write him a PM about your updated version.
Thank you, I will do that!

Meanwhile I ran into some confusing behaviour while trying to make my main script be able to run both from a hotkey and an autopilot command. As a command, the script lets you choose (via sector map interface) the target station which is then passed as the single argument to the script, "target.station". I imagined that when running from a hotkey instead of a command, this argument would be null, and so I could catch that and make the script use the player's aim/target. Instead, it's getting a very specific value (1732) that doesn't seem to change regardless of what ship or sector I'm in, or what I'm targeting, or what is in my cargohold... where is this ghost argument value coming from?
The value is the ID of the Hotkey being called

you could either have a separate hotkey script that then calls your command script with either null, or the tracking aim.
or you could simply check the datatype of the value.
either

Code: Select all

if is datatype [ $target.station ] == DATATYPE_INT
  $target.station = get player tracking aim
end
or

Code: Select all

if not $target.station -> exists
  $target.station = get player tracking aim
end
Just remember, that the tracking aim can also be null if you have nothing targetted

Mokunen
Posts: 31
Joined: Fri, 24. May 13, 01:42
x4

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

Post by Mokunen » Sun, 6. Jun 21, 12:23

X2-Illuminatus wrote:
Sat, 5. Jun 21, 15:34
If I had to guess, I would say it's an internal number representing the position of the hotkey in the control profiles file.
Cycrow wrote:
Sat, 5. Jun 21, 16:57
The value is the ID of the Hotkey being called

you could either have a separate hotkey script that then calls your command script with either null, or the tracking aim.
or you could simply check the datatype of the value.
Ah, so it's the hotkey :D that makes sense, thanks to you both! And yes, in the meanwhile I was checking the datatype (but as != DATATYPE_STATION) while I worked on the rest of the script, but I was worried it might be a flimsy correction. Good too know it will be safe.
Cycrow wrote:
Sat, 5. Jun 21, 16:57
Just remember, that the tracking aim can also be null if you have nothing targetted
I actually ran into that later when I introduced a menu to let the player choose the target station if their tracking aim was invalid when called as a hotkey: the player escaping out of the menu also returns null, so I had to check datatype a second time and assume the script should be terminated there if it was still not a station datatype.

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 » Sun, 6. Jun 21, 12:31

if you are expecting an object, then using the $obj -> is exists, command will generally be better than checking datatypes

if the object needs to be a certain class, like a station, then using $obj -> is of class [STATION]

this is because if the object is destroyed, the datatype will still be the same, but the object no longer exists

checking the datatype is better for when you looking for INT's or STRING's, or if the variable could be of different types, that you will need to handle separately

X-Fighter
Posts: 6
Joined: Wed, 6. Nov 02, 20:31
x4

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

Post by X-Fighter » Fri, 9. Jul 21, 00:53

Is there any way to sell damaged (or any) ships to shipyards programmatically?

I could not find any existing mod or script or example of how to actually sell ships within a script.

I figured that since the player can pick and sell ships, there has to be a way to do that with a script as well.

I'm hesitant to reverse engineer the price of the ship myself based on it's components and reputation and whatnot and then just destroy the ship and hand me the money because that feels just wrong.

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 » Fri, 9. Jul 21, 16:01

in TC/AP the only way is to compute the price yourself.

script commands for those only exist in FL

X-Fighter
Posts: 6
Joined: Wed, 6. Nov 02, 20:31
x4

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

Post by X-Fighter » Fri, 9. Jul 21, 17:43

Cycrow wrote:
Fri, 9. Jul 21, 16:01
in TC/AP the only way is to compute the price yourself.

script commands for those only exist in FL
Too bad I'm 100h deep into my first X3LU game and there is probably no chance to use FL as a basis for LU

michael86
Posts: 29
Joined: Tue, 8. Jun 21, 17:52
x3ap

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

Post by michael86 » Mon, 28. Mar 22, 03:10

In MD files, can I combine <check_any> and <check_all>?
for example a <check_any> inside a <check_all> node or two <check_all> within a <check_any> node?

User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 11740
Joined: Fri, 21. May 04, 17:15
x4

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

Post by Ketraar » Mon, 28. Mar 22, 12:18

In general yes, but will depend greatly what is being checked

Code: Select all

<check_all>
  <check_any>
    <check_value value="this.value1" exact="1"/>
    <check_value value="this.value2" exact="1"/>
  </check_any>
  <check_value value="this.value3" exact="1"/>
</check_all>
So either of value1 or value2 being 1 needs to be true AND value 3 always has to be true.

Code: Select all

<check_any>
  <check_all>
    <check_value value="this.value1" exact="1"/>
    <check_value value="this.value2" exact="1"/>
  </check_all>
  <check_value value="this.value3" exact="1"/>
</check_any>
Here either value1 AND value2 are 1 OR value3 is 1 to trigger conditions.

While possible, this needs to be thought out carefully, more so if events are used in combination. Hope this made sense.

MFG

Ketraar
Image

michael86
Posts: 29
Joined: Tue, 8. Jun 21, 17:52
x3ap

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

Post by michael86 » Mon, 28. Mar 22, 18:57

Thank you.
Your first example would be equal to if ((a || b) && (c)) and the second to if ((a && b) || (c)), correct?
Then I assume, that here will work too.

Code: Select all

<check_all>
  <check_all>
    <check_value value="this.value1" exact="1"/>
    <check_value value="this.value2" exact="1"/>
  </check_all>
  <check_any>
    <check_all>
      <check_value value="this.value3" exact="1"/>
      <check_value value="this.value4" exact="1"/>
    </check_all>
    <check_all>
      <check_value value="this.value5" exact="1"/>
      <check_value value="this.value6" exact="1"/>
    </check_all>
  </check_any>
</check_all>

User avatar
Ketraar
EGOSOFT
EGOSOFT
Posts: 11740
Joined: Fri, 21. May 04, 17:15
x4

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

Post by Ketraar » Mon, 28. Mar 22, 19:35

Sure but you would not need to add an additional chack_all within the check_all, its already given.

Code: Select all

<check_all>
    <check_value value="this.value1" exact="1"/>
    <check_value value="this.value2" exact="1"/>
  <check_any>
    <check_all>
      <check_value value="this.value3" exact="1"/>
      <check_value value="this.value4" exact="1"/>
    </check_all>
    <check_all>
      <check_value value="this.value5" exact="1"/>
      <check_value value="this.value6" exact="1"/>
    </check_all>
  </check_any>
</check_all>
It would then look like this without the redundant check_all.

MFG

Ketraar
Image

FriendlyFirePhoenix
Posts: 90
Joined: Tue, 14. Feb 17, 10:06
x3ap

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

Post by FriendlyFirePhoenix » Thu, 26. Jan 23, 03:47

I've been working on an AL plugin that colours the names of ships and stations according to race.

So for example Argon Freight Transporter becomes \033BArgon\033X Freight Transporter.

I've been using [SIGNAL_CHANGESECTOR] to fire a script as ships are spawned and applying a local variable so the name is only changed once.

Generally it works pretty well, but I've discovered that [SIGNAL_CHANGESECTOR] isn't fired when a ship is spawned through the "create ship" command with a station as the "addto" parameter. I need to account for this for mods which create ships this way such as Pirate Guild. I tried catching ships spawning in stations with [SIGNAL_DOCKED] but that doesn't fire either.

Is there any command or workaround I'm missing that could catch these ships as they're created? Or am I just going to have to check for them on a timer? I imagine I could catch them with [SIGNAL_REQUESTUNDOCK] so they at least get their name changed as they're leaving. It's not ideal but I'm not sure what else is available.

Any help much appreciated!
I made a couple of X3 mods | Colour By Race | True Relations

TresCom
Posts: 1
Joined: Sat, 4. Feb 23, 01:14

Recently Installed X3 collection from Steam.

Post by TresCom » Sat, 4. Feb 23, 01:35

Hello I have recently begun playing pc games after not playing really at all for about 14 years. Tried some new games, but have found my way back to X3 which I loved.

However I am not enjoying the grind to get back to where I want to be in gameplay.

Do the cheats package work for Steam games, and I am a bit rusty... And could use some help with them as well. (where does Steam even keep the game files?!?)

Any help or info would be greatly appreciated. Thanks in advance!

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, 4. Feb 23, 10:41

Yes, the cheat package works on Steam games. The default location for games on Steam is C:\Program Files\Steam\steamapps\common. But you can also right-click on your game in your library, select "Properties" --> "Local Files" --> "Browse" to open the explorer path to the specific game.
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!

Whisperer
Posts: 119
Joined: Sun, 14. Nov 10, 19:02
x3tc

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

Post by Whisperer » Tue, 21. Mar 23, 13:13

    Good day everyone. After several years i started playing X3TC again and finished several plots (including the Goner’s). I now want to be able to script a ship that’s able to repair and board.

    I have managed to create a script that spawns a fully fitted Vidar with repair lasers in the sector that i’m in (with the help of Roguey’s scripting tutorial). How ever, i’m not able to create the marines that i want on my ship. I know i can select the option to add 5 marines from the ware option, but those are always all random and low level. I want the ship to have 5 high level marines.

    After a lot of reading i found out that i have to first create passengers on my ship, so i did. But now i see there are two ways to convert them in to marines, but both ways to convert them don’t seem to work. The two codes look like this:

    First code is this
    038 = $ship -> create passenger in ship: name=null race=null voice=null face=null
    039 $ship create marine from passenger: fighting=99 hacking=99 mechanical=99 engineering=99
    040 return null

    Second code is this
    038 = $ship -> create passenger in ship: name=null race=null voice=null face=null
    039 $ship -> train passenger to marine
    040 $ship -> set marine skill: fighting=99
    041 $ship -> set marine skill: hacking=99
    042 $ship -> set marine skill: engineering= 99
    043 $ship -> set marine skill: mechanical= 99
    044 return null

    In both cases i would assume the code spawns a passenger wich gets converted to a marine,… How ever, in both cases the passenger gets spawned in the ship, but despite the Vidar being able to hold 5 marines, the ship fails to convert them in to marines with a nearly max skill.

    What am i missing here that prevents the ship from spawning with a marine (and also do i have to code each marine sepperately)?

    (edit: unfortunatly i’m not able to figgure out all the code in the scripts and find my way to the workings of marines and training. This is my first time coding, and i’m realy not that computer savvy to go beyond anything but the most basic steps)

    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 » Tue, 21. Mar 23, 15:26

    you are trying to convert the ship into a marine, you need to be converting the passenger. The passenger and ship are separate objects.

    use the return value from the create passenger routine instead

    Code: Select all

    $passenger = $ship -> create passenger in ship...
    $passenger -> create marine from passenger..
    
    
    $passenger -> train passenger to marine
    

    Post Reply

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