[Request] Storage type mod/assign miners to trade tasks.

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

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

ravayen
Posts: 56
Joined: Mon, 25. Jan 16, 02:02
x4

[Request] Storage type mod/assign miners to trade tasks.

Post by ravayen »

so i set up a storage only mining station which works fine, even set the buy/sell orders up to act like a trade station (which amazingly works 'vanilla') buuuuut, the one thing i can't do is set a trader to the station to trade the ore and gases to surrounding areas.
I have set up a miner with autotrade set to buy in 0 sectors but i really want to assign him to the station.

I'm looking for a simple mod to change the storage types of one L freighter per faction to store container/liquid/solid wares just like the xenon S does or a mod that simply lets me assign a mining ship to trade for station (seriously why cant we do that?).
Or hell a mod that simply gives me a blueprint to build the xenon S.

Anyone feel up to the task?
'Coming like a train baby'
'Choo choo'
ravayen
Posts: 56
Joined: Mon, 25. Jan 16, 02:02
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by ravayen »

No-one?
Can anyone tell me if this is a simple task i can do myself?, i've tried looking for tutorials but all of them describe making ships from scratch and include massive amounts of confusing info i don't need for such a small change and i really don't feel like becoming a modding pro just to change one small thing lol.
'Coming like a train baby'
'Choo choo'
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by DeadAirRT »

Just off the top of my head what you need to edit are order.trade.rotuine, trade.find.free, and the station trading script. Not quite as small as you hoped :)
ravayen
Posts: 56
Joined: Mon, 25. Jan 16, 02:02
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by ravayen »

No easy way to simply change storage types on freighters either i'm guessing?
'Coming like a train baby'
'Choo choo'
Mackan
Posts: 143
Joined: Thu, 1. Aug 13, 05:59
xr

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by Mackan »

AFAIK there's nothing in the scripts preventing miners from functioning as station traders. They'll behave exactly as normal transport ships, just with a mineral/gas warelist instead. So if you can get them to be assigned as traders, they'll probably work exactly like you seem to want them to.

Unsure where subordinate assignment restrictions are defined, probably in the UI files? How to mod those is way beyond me though.
DeadAirRT
Posts: 1124
Joined: Fri, 25. Jan 19, 03:26
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by DeadAirRT »

ravayen wrote: Sat, 2. May 20, 09:54 No easy way to simply change storage types on freighters either i'm guessing?
For freighters you should just have to edit assets/units/size/macros iirc
ravayen
Posts: 56
Joined: Mon, 25. Jan 16, 02:02
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by ravayen »

Is this right coz i swear i read all that wrong and i'm not confident i got every little bit right?


<?xml version="1.0" encoding="utf-8"?>
<!--Exported by: nick (192.168.3.120) at 27.11.2018_14-06-11-->
<!-- <macros>
<macro name="storage_tel_l_trans_container_01_b_macro" class="storage">
<component ref="generic_storage" />
<properties>
<identification makerrace="teladi" />
<cargo max="40800" tags="container" />
<hull integrated="1" />
</properties>
</macro>
</macros> -->

<diff>
<replace sel="/macros/macro/properties/cargo/@tags">container liquid solid</replace>
</diff>


Edit:- Yup that works but they don't seem to trade ore etc automatically when assigned to a station so there must be a wares list i have to track down :gruebel: knew this was gonna be more work than it was worth lol.
'Coming like a train baby'
'Choo choo'
teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by teleportationwars »

Mackan wrote: Sat, 2. May 20, 14:04 AFAIK there's nothing in the scripts preventing miners from functioning as station traders. They'll behave exactly as normal transport ships, just with a mineral/gas warelist instead. So if you can get them to be assigned as traders, they'll probably work exactly like you seem to want them to.

Unsure where subordinate assignment restrictions are defined, probably in the UI files? How to mod those is way beyond me though.
While autotrade works fine for liquid transport ships whichever trade script/scripts are in the loop for a liquid trader subordinate of a station need some edits to make this work.
Mackan
Posts: 143
Joined: Thu, 1. Aug 13, 05:59
xr

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by Mackan »

teleportationwars wrote: Sun, 3. May 20, 04:18 While autotrade works fine for liquid transport ships whichever trade script/scripts are in the loop for a liquid trader subordinate of a station need some edits to make this work.
While I don't doubt you, both liquid and solid miners seemed to behave largely as expected as station traders. Made a simple hack that changed miners assigned to station defence into station traders and they seem to happily ferry the appropriate wares? They might not be as well behaved working for factories using mining wares as resources, though. I only tried with trade stations.

aiscripts/order.assign.commander.xml

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<diff>
    <add sel="//aiscript/attention/actions/do_if[@value='$commander.isoperational']/do_if[@value='$assignment']">
        <do_if value="($subordinategroup gt 0) and ((@this.ship.primarypurpose == purpose.mine) and ($assignment == assignment.defence)) and (@$commander.isclass.station)">
            <set_value name="$assignment" exact="assignment.trade" />
            <set_value name="$subordinategroup" exact="0" />
        </do_if>
    </add>
</diff>
teleportationwars
Posts: 158
Joined: Fri, 12. Jul 19, 14:03

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by teleportationwars »

Mackan wrote: Sun, 3. May 20, 17:37
teleportationwars wrote: Sun, 3. May 20, 04:18 While autotrade works fine for liquid transport ships whichever trade script/scripts are in the loop for a liquid trader subordinate of a station need some edits to make this work.
While I don't doubt you, both liquid and solid miners seemed to behave largely as expected as station traders. Made a simple hack that changed miners assigned to station defence into station traders and they seem to happily ferry the appropriate wares? They might not be as well behaved working for factories using mining wares as resources, though. I only tried with trade stations.

aiscripts/order.assign.commander.xml

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<diff>
    <add sel="//aiscript/attention/actions/do_if[@value='$commander.isoperational']/do_if[@value='$assignment']">
        <do_if value="($subordinategroup gt 0) and ((@this.ship.primarypurpose == purpose.mine) and ($assignment == assignment.defence)) and (@$commander.isclass.station)">
            <set_value name="$assignment" exact="assignment.trade" />
            <set_value name="$subordinategroup" exact="0" />
        </do_if>
    </add>
</diff>
Awesome! Don't know what there is to doubt when you went and did as suggested :) . Will test this with XReborn... sometime.
Mackan
Posts: 143
Joined: Thu, 1. Aug 13, 05:59
xr

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by Mackan »

teleportationwars wrote: Sun, 3. May 20, 20:48 Awesome! Don't know what there is to doubt when you went and did as suggested :) . Will test this with XReborn... sometime.
Thought you meant there were potential problems in the trade routine scripts. Took your word for it as I'm too lazy to go through them in-depth. :D

At a quick glance however there are conditions for forcefully converting non-mining miner subordinates into autominers if the commanding station uses liquid/solid wares as resources. A bit dumb, but it's probably there for a reason. Simple trade stations shouldn't have this issue though.
Vectorial1024
Posts: 304
Joined: Mon, 30. Jul 18, 04:16
x4

Re: [Request] Storage type mod/assign miners to trade tasks.

Post by Vectorial1024 »

To whoever modder interested in this:

I know of two ways to implement this.

The first way is modifying the assignment id to trading, as explained a few posts up.

The second way is to use Right Click API to add an extra [Trader >] button in the assignment menu. You may have a look at how I handled adding [Trader >] and [Miner >] buttons when assigning miners to other miners in Civilian Fleets:

https://github.com/Vectorial1024/v1024_ ... fleets.txt
The future awaits.

X4 Foundations mods:
Civilian Fleets: (Obsolete for X4 7.0+) Managing your civilian ships has never been easier.
Station Logistics: Managing your station networks has never been easier.
Market Discovery: Find Black Market Traders; also rerolls them.
Logistics Optimization: Improve your station traders; improve your trade stations!

Return to “X4: Foundations - Scripts and Modding”