[MOD] Auto Trade Agents

The place to discuss scripting and game modifications for X Rebirth.

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

Post Reply
PaulP
Posts: 185
Joined: Tue, 18. Nov 08, 01:50
x4

[MOD] Auto Trade Agents

Post by PaulP » Mon, 29. Feb 16, 07:01

This simple extension will automatically give you trade agents at stations. Upon entering a new system, any stations there that are on good terms (0 or above relation) will announce their presence and immediately begin sending you trade updates.

Download it here auto_agent.zip download

It's also on the Steam Workshop as Auto Trade Agents.

Here's the code for it, if anyone just wants to see how it works

Code: Select all

<?xml version="1.0" encoding="iso-8859-1" ?>
<mdscript name="auto_agent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="AutoAgent" instantiate="false" namespace="this">
      <conditions>
        <check_any>
          <event_object_changed_zone object="player.primaryship"/>
          <event_player_created />
          <event_cue_signalled cue="md.Setup.GameStart" />
        </check_any>
      </conditions>
      <actions>   
        <find_station groupname="$allstations" space="player.zone" multiple="true" />
        <do_all exact="$allstations.count" counter="$i">
          <do_if value="not $allstations.{$i}.hastradesubscription and $allstations.{$i}.relationto.{player.primaryship} ge 0.0">
            <set_known object="$allstations.{$i}" known="true" />
            <add_trade_subscription object="$allstations.{$i}"/>
          </do_if>
        </do_all>
        <reset_cue cue="this" />
      </actions>
    </cue>
  </cues>
</mdscript>

Scoob
Posts: 6858
Joined: Thu, 27. Feb 03, 23:28
x4

Post by Scoob » Mon, 29. Feb 16, 14:22

Cool, I might try this! Thanks for creating it.

Scoob.

eMYNOCK
Moderator (DevNet)
Moderator (DevNet)
Posts: 2041
Joined: Thu, 21. Aug 03, 10:37
x4

Post by eMYNOCK » Tue, 8. Mar 16, 17:45

Cheers,

i will simply copy'n'paste what i already wrote in Steam.
...
i would suggest to increase the minimum relation to +5.

Not too hard to get +5 (you can do this with one or two small talks or by killing Masstraffic) and it is a bit more believable that the Faction trusts you enough to Broadcast their Trade Offers to Friendlies.
...
...
i've just noticed that your Script places Trade Agents on the Home of Light Highway Stations and Trade Centers.

You should probably restrict it to place Agents on Stations with Docks and / or functional Trade Ports.
...
Regards


Edit:

Cheers again,

without too much words... i've reworked your code together with Yorrikvander a bit.

The Result is this here:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<mdscript xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="auto_agent" xsi:noNamespaceSchemaLocation="md.xsd">
  <cues>
    <cue name="AutoAgent" instantiate="false" namespace="this">
      <conditions>
        <check_any>
          <event_object_changed_zone object="player.primaryship"/>
          <event_player_created/>
          <event_cue_signalled cue="md.Setup.GameStart"/>
        </check_any>
      </conditions>
      <actions>
        <find_station name="$allstations" space="player.zone" multiple="true"/>
         <do_all exact="$allstations.count" counter="$i">
          <set_known object="$allstations.{$i}" known="true" />
           <do_if value="not $allstations.{$i}.hastradesubscription and not ($allstations.{$i}.name=={20102,6001}) and $allstations.{$i}.relationto.{player.primaryship} ge 0.0032">
            <find_tradeoffer_parking_slot object="$allstations.{$i}" includeoccupied="true" name="$parkingpossible" check="true"/>
             <do_if value="$parkingpossible">
              <add_trade_subscription object="$allstations.{$i}" />
             </do_if>
           </do_if>
         </do_all>
        <reset_cue cue="this"/>
      </actions>
    </cue>
  </cues>
</mdscript>
Changes are, Stations without Trade Ports were ignored.
(That means Reiver Waystations, Teladi Dens, HoL Highway Stations)

Additionally Factions that are below +5 Reputation are ignored too.
(and $allstations.{$i}.relationto.{player.primaryship} ge 0.0032")

Regards again
For my Steam Workshop, klick below:
Image

Nago
Posts: 5
Joined: Tue, 15. Mar 16, 13:41

Post by Nago » Tue, 15. Mar 16, 15:36

Thanks for this nice work !
This should really be posted in the mod list : http://forum.egosoft.com/viewtopic.php?t=370788

flatbush71
Posts: 58
Joined: Wed, 12. Jan 11, 13:55

Re: [MOD] Auto Trade Agents

Post by flatbush71 » Sat, 1. Jun 19, 04:33

How do you get this to work guys ?

Buck
(The old & sick fool)

EDIT: Nevermind, it works great !!

Post Reply

Return to “X Rebirth - Scripts and Modding”