[SCRIPT] Weapons Dealer - v2.01 - 23/10/2007

The place to discuss scripting and game modifications for X³: Reunion.

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

xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

[SCRIPT] Weapons Dealer - v2.01 - 23/10/2007

Post by xxbluedragonxx »

Script: Weapons Dealer
Version: 2.00

Text File used: 7484
Command Slot used: <t id="435">COMMAND_TYPE_TRADE_35</t> - Weapons Trader
Text Page used: 7484

Download: plugin.weaponsdealer.spk


Description
Weapons Dealer is an addon for the Trade Command Mk 3 software. The weapons dealer will trade in large quantities of missiles, shields and lasers. This includes Tractor Beams and Mobile Drilling Systems. The trader will be able to sell any amount of cargo, so long as a suitable dock is available. This is achieved by selling wares to select Equipment Docks who will buy the extra stock.


If no homebase is assigned, the dealer will operate in Free Trade mode, buying and selling weapons much like a UT. Except the pilot is now no longer limited to sell a small number of weapons. For example the pilot can buy out a fab and sell all the stock much faster than a normal UT pilot.

In Free Trade mode the dealer first tries to sell to at least two docks close to the fab, which want the ware and keep it available for other buyers. After this the dealer sells to a dock which will buy all of the rest of his stock.

If a homebase is assigned behaviour is changed depending on what the homebase is. If it is one of your fabs producing weapons, the dealer will work for the fab, selling wares to the nearest EQ dock that will buy everything. The pilot is careful to leave 50% of maximum storage in stock only selling the excess.

If a homebase does not produce weapons the dealer will go into Free Trade mode but use the funds available at the homebase. This is how you can control the funds the dealer will use in Free Trade mode.

Setting the homebase Trade with Other Races to "No" will cause the dealer to stop selling and go on standy after completing the current run.

* The pilot can go to a training course to reach the top level for a small fee if you don't have a level 25 pilot. If the ship has no pilot a level 1 pilot is provided and the option to go on the training course is presented.

Requirements
Trade Command Mk 3
Jumpdrive enabled ship that can dock at weapons fabs.

Useage
From the Trade menu of a ship select "Start weapons trader..."

If the ship has a jump drive the trader will start weapons trading. If the pilot is not level 25 you'll get offered a training course to level up.

Assigning a homebase which does not produce weapons makes the dealer use the funds available at base and roam the universe buying and selling weapons.

Assigning a homebase that produces weapons will make the dealer work for that fab/complex. The dealer will sell wares but always leave 50% of the maximum store amount in stock. This is in case you need it! Wares are sold when stock is above 95% or when the ship cargo bay can be filled, whichever comes first. Either way half the total maximum cargo will be left in stock.

You can use any jump drive enabled ship which can dock at regular factories and limit how much money the dealer uses. However, as with conventional manual weapons trading this trader works ideally with a fully mapped universe, a TS class ship and plenty of money!


Notes
* The dealer will buy up to 12 drones in one go if none are in the cargo bay

* Deploys any drones and tries to jump out if attacked.

* Energy cells for the jumpdrive are purchased as needed. Maximum fuel tank is 20% of the total ship cargo space.

* Currently the pilot will not conduct damage repairs or any upgrades. The upgrades are left to the player to decide. I felt this was a better option so the player retains control over the cargo bay size. I will probably add in damage repair in the next version.

* Pilot will go on standby if funds drop below 5,000 credits and continue when more than that is available.

* Pilot will also go on standby if working for your fab and there is not yet enough stock to sell. Trading continues when there is enough stock available. You'll always have 50% of maximum left in case you need it.



Changelog
v2.01 - 23/10/2007
Small bugfix. If the trader is working for a fab the ware price is not needed.

v2.00 - 20/10/2007
Added support for home bases.
Removed v1.00 startup costs.
Restructured scripts and code to use my own.

v1.00 - 18/10/2007
Initial beta release




Next versions?
Optimise and tidy the code some more. Improved error detection and handling.

Add in support for PHQ and player docks.

Add in support for other ships to be used as a home base. For example using a TL as a base of operations.

Configurable minimum stock levels.

Custom ranks (possibly!)

...more things :?
Last edited by xxbluedragonxx on Tue, 23. Oct 07, 17:42, edited 10 times in total.
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

I made some big changes. Now you only need a level 25 UT pilot. If you don't have one or don't want to use an existing pilot you are given the option to buy a fully trained pilot for a small fee. The weapons dealer will make huge profits so it is well worth the fee. If you already have a level 25 UT then it doesn't cost anything at all :)

You can also use a lower level pilot and train him up for a small fee. This has the bonus that you can use this pilot as a level 25 UT pilot as well ;)

I've added home base support. At the moment it is only for factories so you can control the amount of money that is used.

A very powerful feature is if you set one of your weapon complexes/factories as a homebase - the dealer will sell your wares to the nearest EQ dock that will buy everything in one go. This means no more manually selling large amounts of wares to an EQ dock! Just set the home base, start the weapons trader and let him do all the work.

I removed the costs which were in the beta 1 so if you used that version just let me know and I can make a small script which will refund the startup money.

Please report problems and suggestions are welcome as well :) Enjoy!
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

Nobody is interested in this? :? It is my first script so I would appreciate some feedback and it will help find bugs and improvements :)
whiteknight1234
Posts: 62
Joined: Thu, 21. Oct 04, 21:47
x3

Post by whiteknight1234 »

hiya dragon, I did want to try this out, but cant get it to uncompress, it mentions a problem uncompressing the 'weaponsdealer.refuel.pck'.

I am not sure exactlyy what te problem is, and whether other peps are having the same issue.

but is sounds like a really good script :) .

Thx WK
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

Can you let me know which version of Cycrow's Installer you have? I used version 2.12 to create the spk. Also it's X3 with newest patch?

If you still have a problem using the newest Plugin Manager I can recreate the spk minus some compression.
whiteknight1234
Posts: 62
Joined: Thu, 21. Oct 04, 21:47
x3

Post by whiteknight1234 »

hiya again bluey, thats the version i got ...2.12. :D

hope that helps

WK
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

Hello! That is strange. I used Doubleshadow's Modmanager 0.0.3 to compress the files before adding them to the package. Maybe that has some problem.

I remade the spk but without compressing the files this time. It should work fine, just redownload and try again :)

p.s. I'll probably rename the script at some point to avoid confusion with Stevio's Weapon Dealer fab script. That's something completely different!
whiteknight1234
Posts: 62
Joined: Thu, 21. Oct 04, 21:47
x3

Post by whiteknight1234 »

hiya, that did the trick, now to check it out :D

WK
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

I made a small fix so if the dealer is working for your fab he will disregard the price. This is because EQ docks only buy at a fixed price anyway.

This means if you only want the weapons trader to sell your wares you can set your selling price to average or above average and nobody else will buy from your fab. Since the dealer doesn't need to know your selling price he can be controlled by turning Trade with Other Races to Yes/No.

This means you can pick and choose which weapons to sell to other races. Just set price low enough and Trade with Other Races to Yes and other races can buy from you. Set the price to average or above and they won't buy, but your dealer will still sell. Set Trade with Other Races to No and he won't sell.
Yanaran
Posts: 12
Joined: Thu, 20. Mar 08, 14:14

Post by Yanaran »

Hey bluedragon, I've been looking for something that does exactly what your script says it will do, Universe Trade but only in the expensive stuff (ie weapons and such).

I downloaded it and gave it a try, but it seems like selling missiles isn't working properly. Weapons and shields work fine, it buys everything at one place, then sells to EQ docks that stock them and then dumps the rest at a dock that doesn't stock. However with missiles it only sells to the first place that stocks those missiles, and then it flies off and buys something else, leaving plenty of missiles in the cargo hold.

It still works for a while until it gets to smaller missiles that really fill up your cargo hold, then I have to stop it and sell all the missiles manually to clear it out. Do you have any idea what could be wrong and maybe a fix? :)
kevso
Posts: 57
Joined: Fri, 10. Jun 05, 17:14
x3tc

Post by kevso »

Hi There xxbluedragonxx,
this looks very interesting is the script compatible with XTM?

Kevso :)
Radeghast
Posts: 25
Joined: Wed, 19. May 04, 20:50
x3

Post by Radeghast »

Hiya

I've also been trying this script out, seemed to be going OK but I lost a trader the other night because he for some reason jumped into a Xenon sector. They aren't tryiing to deal with Xenon stations as well are they :?:

Actually I'm not 100% sure if he jumped directly to this sector or moved to it from an adjacent one.

Rad
Radeghast
Posts: 25
Joined: Wed, 19. May 04, 20:50
x3

Post by Radeghast »

Just lost another UT this time I tried the Navigation Override software on him and I got a message in my log that the trader was on his way to Xenon Sector 472 (Same sector as I lost the last one) and the override was kicking in.

:cry:

Oh well easy come easy go!
xxbluedragonxx
Posts: 375
Joined: Wed, 29. Aug 07, 13:08

Post by xxbluedragonxx »

Hi sorry it has taken me a long time to respond. I have been busy with earth sector activities (real life!).

It's been a long time since I looked at X3 and scripts but I'll try to remember what I can :lol: I'm not sure what the small missiles problem might be. I did not encounter that problem while testing.

The UTs flying through a Xenon sector - they should not be trying to trade with Xenon stations. It's possible the route involved took it through a Xenon sector?

XTM - I have never had XTM installed so can not say if this is compatible or not, sorry.

At the moment I can't do anything because of real life pressures but if I get some time I will look into this. I don't even have X3 installed for now :(
mrowka
Posts: 128
Joined: Tue, 30. Jun 09, 19:50
x4

Post by mrowka »

Hello dunno if your still working on this mod but it works with XTM
As for problems that are above i got the same, it look i.e. WD buys 7 missless from factory then he go to the dock but dock can buy only 4 missles so when he cant sell all of them in 1 round he blocks and flys around with "Fly to sector" job, no specific sector name but he dont sell anything after than just flying.
Now from what i seen you can sell unlimited stuff to docks not sure if its a bug but i.e. dock can buy 4 misslless and you got 7 so you sell 4 missless but they vanish from dock leaving empty slots for another sale.
So you can make in script to check avalible space for a ware in a dock then sell the max passible ware of a dock max space for this ware and recheck again if its empty then sell again and if its full and i got just a bug trader could go to another dock.
Alternative you could make docks to buy larger ammount of weapons/unlimited or make special stations like armory that would buy weapons in greater or unlimited ammout.

Anyways greate mod :)

Return to “X³: Reunion - Scripts and Modding”