[SCR] OK Traders v1.7.1 (04-12-14)

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

emeraldmoonx
Posts: 11
Joined: Wed, 3. Jul 13, 03:21

Post by emeraldmoonx »

Is it possible to get compatibility with scripts that have energy-less jumps? For example I use http://forum.egosoft.com/viewtopic.php?t=223425
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Its not currently supported. It'd be possible, but its not an immediate priority. OK traders uses the game's normal movement scripts which jump based on the ships autojump settings, and so won't invoke 3rd party jump related scripts unless they're integrated into the normal movement scripts. As this typically requires replacing stock scripts with modified versions, there aren't many scripts which directly integrate like this, and instead they simply add player menu commands to hook in the functionality.

However I am considering writing custom movement scripts in order to avoid an interesting design decision in the stock scripts which makes ships freeze up when moving to sectors where there is no jump ingress to itself or surrounding sectors, when autojump is enabled.

Doing so means I'll need to perform my own jumps, but this also provides an opportunity to integrate with any and all 3rd party movement and jump scripts I want to. In particular I'm considering advanced jumpdrive and beacon jump integration for p2p jumping, imbalanced though the combination may be. Energy-less jump script integration could be arranged, though there'd need to be some order of precedence between which 3rd party jump script would be invoked if multiple are present.

But this is a likely to be a long term change if it's made at all.
emeraldmoonx
Posts: 11
Joined: Wed, 3. Jul 13, 03:21

Post by emeraldmoonx »

I see, sounds like a lot of work, just wanted to suggest it. Would help for money since traveling takes forever, and it's expensive early on to afford a jumpdrive non the less to afford energy cells for it.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I'm considering adding configurable equipping functionality, and thought I'd open up the design for feedback as there may be better ideas, and it'd be costly to change once implemented.

I imagine a global equipping config menu as follows:

Code: Select all

-- Shields --------------------------------------
Mode    < Lazy >
-- Lasers ---------------------------------------
Mode    < Lazy >
-- Missiles -------------------------------------
Mode    < Lazy >
Amount  3
-- Tunings --------------------------------------
Type                  Mode                Percent
Engine Tuning         < Imperative >      100
Rudder Optimization   < Imperative >      100
Cargobay Extension    < Lazy >            10
-- Equipment ------------------------------------
Type                  Mode
Jumpdrive             < Imperative >
Triplex Scanner       < Lazy >
Duplex Scanner        < Lazy >
Docking Computer      < Lazy >
Add...
-- Wares ----------------------------------------
Type                  Mode                Amount
Fighter Drone         Lazy                10
Fighter Drone MK2     Lazy                5
Keris                 Lazy                5
Add...
-------------------------------------------------
Reset to defaults
Where Mode:

Imperative - fly and buy at top priority if available within jumprange and affordable. Retain against sale.
Lazy - Buy when docked at a station that sells it, retain against sale.
Retain - Do not buy, but retain against sale if any in cargo bay (not used for equipment, tunings, shields)
Upgrade - Do not buy, but install units of 'get max shield type that can be installed' found in bay, installing anything else occupying the slot.
Ignore - Neither buy nor retain against sale

Notable behaviours:

Shields
- Equipped shields are always preserved regardless of setting
- Algorithm seeks to acquire and install/switch in max units of 'get max shield type that can be installed'

Lasers
- Algorithm will acquire and retain sufficient quantity of all supported lasers to populate all turrets and mainguns, except for tractorbeam and mobile drilling system.

Missiles
- Algorithm will acquire and retain the specified amount of every type of compatible missile

Equipment, wares
Jumpdrive is always top priority out of everything. Lists can added to or removed from. Ignore behaviour has equivalent effect to removing the item from the list.
User avatar
alt3rn1ty
Posts: 3797
Joined: Thu, 26. Jan 06, 19:45
x4

Post by alt3rn1ty »

I'm not sure but I think maybe adding another option there between Imperative and Lazy .. Maybe Imperative 1, and Imperative 2, then Lazy ?

For example Imperative 1 for first priority Traders requirements to make them good traders

And Imperative 2 for items which make them better at surviving

Shields would still fall under imperative 1 ( because without them they are not going to last two minutes so should be high ), Jumpdrive because they are high on the list of improving a traders capabilities to be a trader

But maybe there are a few wares which could fall nicely into Imperative 2 such as ..

Fight Command Software
MDM
Advanced Firewall
Internal Sentry Lasers

And prioritise Mosquito over any other missile ( particularly for AP ) for acquiring.


Would Video Enhancement Goggles fall into any kind of priority these days ?

I dont know if the games AI takes advantage of having the ware installed on a ship these days .. But I do recall mention back in the X3 Reunion days that if you were fitting out a CAG trader, the best way to increase its surviveability ( for that game ) was not to install the following ..
Fight Command Software
Weapons
Missiles
Video Enhancement Goggles ..

So at one time at least Video Enhancement Goggles were considered as hindering the AI when it came to prioritising Flight over Fight when a trader encountered an enemy
User avatar
joelR
Posts: 2008
Joined: Mon, 9. Jul 07, 23:33
x3tc

Post by joelR »

What if they set aside a percentage of their profits and used that for upgrades?
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

The mode setting is intended to separate immediate proactive purchasing from passive equipping while the ship happens to be docked at a place selling that ware. I think I'll rename it like that instead of imperative/lazy. I'm not keen on overloading the setting to confer priority ordering though, and to keep the UI simple I'd be inclined to hardcode an order of equipping such as:
1. Engine tuning
2. Jumpdrive
<refuel>
3. Docking computer
4. Shields
5. Everything else, no particular order.

Missiles are an interesting case. In the ideal world a loadout would be configurable per ship type since missile config differs per ship, but I don't want to go there. Options that I might consider in ascending complexity include:
1. Simply buying a quanity of all compatible missiles (per post)
2. Put a list of all missiles in UI and let player configure quantities of each globally.
3. Buying quantities of 3 types of missile: 1. strongest swarm missile, 2. strongest heatseeker/torpedo, 3. fastest (antimissile)

Afaik video enhancement goggles do nothing.

Yes you generally want to avoid equipping lasers on traders. When the ship has laser strength the attacked signal script has a chance to make the trader turn and attack instead of running to a nearby station.

Setting aside an upgrade funds pool is compelling from an implementation perspective, to guarantee availability of funds exist when upgrading (simply credit player account as necessary before buying). Currently OK's equipping logic just pays from the player or station account, and tests that sufficient funds exist to buy a ware at its max price. If funds are low and lots of traders decide to buy shields this might well be a problem, though I think a degree of common sense can help avoid such situations.

I'm uncomfortable with tracking pots of upgrade cash, outside of the player or station balance:
- Difficult to determine when a ship should stop collecting money, when its fully upgraded, as it might need to drop a drone here and there, and wants to restock quickly rather than build fund from 0.
- When buying wares passively the ship is rarely in a compatible port, and restricting funds reduces the likelyhood the ship will equip
- If ship dies, player loses his cash tracked on the ships variable.
- Unintuitive that funds are siphoned from player profits.
- Player might want to liquidate his asserts, and I don't want to go down a route for having UI for managing these upgrade funds.
- What if an upgrade is 5 million MARS, or 300 million jump beacon? At what rate does trader save?

I'm eager to avoid getting bogged down with these problems, and prefer to rely on the player making sure they have sufficient funds to cover configured upgrades.
User avatar
alt3rn1ty
Posts: 3797
Joined: Thu, 26. Jan 06, 19:45
x4

Post by alt3rn1ty »

:) I looked back at my post afterwards and considered editing out the extra prioritisation stage idea, in case it made you go down a less optimal / heavier script .. Thankfully you are all over such considerations chopping out potential bad coding directions to go.

The only other thing I can think of as a potential for the pilot to prioritise is auto upgrading Cargo Space for traders that still need it ( stock bought ship let loose with OK and not upgraded by the player )

Edit: PS - Sorry I didn't get back to you with a comparison of the 4 Mistrals with OK, and 4 Mistrals with Gnasirators MK3 Improved, I made a naming mistake along the way and lost the plot who was who among all the other traders I have acquired since ( should have noted the registration numbers instead )
dougeye
Posts: 2409
Joined: Sat, 7. Mar 09, 18:29
x3tc

Post by dougeye »

Just about to start using this script instead of CAG as it seems to be everything im looking for without the hassle of CAG!

one question does the command work on TL's?? I use advanced complex hub and would love my TL's to be able to buy / sell wares to large docks :D
I used to list PC parts here, but "the best" will suffice!
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I agree with cargo upgrades being a necessity particularly when using smaller ships as traders. So I'd insert this in the priority order right after jumpdrive, to ensure the ship has enough space to buy other stuff.

In practice when it docks to buy engine tunings it'll buy everything else available at the dock, and 99% of the time it'll have cargo and rudder optimizations there too.

Cargo is an interesting case because because as a rule I buy full cargo upgrades for every ship I buy, except TS class where it's typically not cost effective. Configuring a one size fits all percentage isn't an ideal fit. Not sure the best way to solve that, perhaps 2 cargo extension percentages for non-TS and TS.

Yes the command works on a TL, but note that it's not optimized yet for huge ships.
- Can only trade where it can dock at. In future I'd like to make use of freight drones to have them trade everywhere.
- Only trade 1 type of ware per run - won't make best use of their huge cargo bays.

In my current game I have a fleet of around 30 traders where I bought cheap and cheerful mercury haulers at around 500k for 6000 non-upgraded cargo space and 80 speed. In later game I often wish I could swap them out easily for mistral SF and springblossoms, but it's awkward to decommission them.

Gives me an idea for some sort of decommissioning/upgrade feature, perhaps be able to select either a specific ship or select from all classes of ships currently running OK, and have the selected ship(s):
1. Travel to a shipyard that sells the preferred type of replacement ship
2. Buy that ship and transfer across compatible equipment
3. Enable OK on the target ship with same settings as self
4. Sell self.
User avatar
alt3rn1ty
Posts: 3797
Joined: Thu, 26. Jan 06, 19:45
x4

Post by alt3rn1ty »

Shimrod wrote:Gives me an idea for some sort of decommissioning/upgrade feature, perhaps be able to select either a specific ship or select from all classes of ships currently running OK, and have the selected ship(s):
1. Travel to a shipyard that sells the preferred type of replacement ship
2. Buy that ship and transfer across compatible equipment
3. Enable OK on the target ship with same settings as self
4. Sell self.
Sounds like a good idea too, I dont think you consider experience / training of the pilot in your scripts ( pretty sure because the goal of OK was to get away from the complexity / micro management in CAG / EST / etc ), but maybe if it does become a factor to consider 'preserving' ( even though not player managed ) in future an extra step may be beneficial ? - Insert 4. ..

3. Enable OK on the target ship with same settings as self
4. Transfer Pilot to target ship
5. Sell old ship
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

That sounds doable, copy over or replicate pilot, shallow copy specific local variables. Maybe transfer salvage insurance if they still use that to track trader level, been a long time since I really used those scripts.

Additional ship commands won't get transferred though.
User avatar
alt3rn1ty
Posts: 3797
Joined: Thu, 26. Jan 06, 19:45
x4

Post by alt3rn1ty »

Just recalled something which may help / be useful ..

You probably want to do your own scripts to cover the function, but I remember there was a script in the bonus packs for moving pilot, and just confirmed after a search - here http://www.egosoft.com/support/faq/faq_ ... answer=707

.. Seems like in TC / AP there will already be a script which can be called upon to perform moving the pilot.

At least it will be a pointer to how to go about it if needed.
User avatar
DrBullwinkle
Posts: 5715
Joined: Sat, 17. Dec 11, 01:44
x3tc

Post by DrBullwinkle »

Shimrod wrote: 1. Engine tuning
2. Jumpdrive
<refuel>
3. Docking computer
4. Shields

5. Everything else, no particular order.
Docking computer before shields? Because "manual" docking is a period of high vulnerability?


emeraldmoonx wrote:Is it possible to get compatibility with scripts that have energy-less jumps? For example I use [Free Jump]
Free Jump for AI's
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I don't see the purchasing order as a declaration of what wares are most important to a trader. What is important to me is that the ship equips itself in the shortest time possible.

Docking computers will make the ship instantly dock at 5km (with the next update), and skip a lengthier docking sequence in the active sector. If the ship must equip a docking computer and some shields, then buying the items in that order is faster than doing it the other way around, because shields won't make the ship get from A to B any faster.

The reason I put shields in the list at all is, if the player wants to configure traders to proactively equip the kitchen sink, then I do believe that shields are a high priority to buy first, as in this lengthy tour of equipment docks around the galaxy and pirate bases to equip cargo life support, the chance of getting attacked increases.
dougeye
Posts: 2409
Joined: Sat, 7. Mar 09, 18:29
x3tc

Post by dougeye »

well I have a strange one, using xrm but there is no option to assign a TL a homebase. my plan was to use a TL for stocking up my EQ docks from other docks but when testing I cannot assign a homebase, ive forgotten if this was possible anyways in vanilla?
I used to list PC parts here, but "the best" will suffice!
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

I seem to recall it was possible at one point, but I noticed in XTC I wasn't able to assign a huge ship a homebase either. I don't agree with this particular design decision either, as it can only have negative consequences for players.

You can assign a homebase by adding the TL to a wing, then assigning the wing a homebase. This assigns the TL a hombease. Then remove the TL from the wing and it stays homebased.

I imagine clearing the homebase setting then becomes interesting, since they've hidden that UI too.
littleliliput
Posts: 11
Joined: Thu, 24. Nov 11, 17:51
x3ap

Post by littleliliput »

Is it possible to forbid traders from stocking up on weapons and missiles? They cost a lot and I don't even want my traders to engage in combat.
Shimrod
Posts: 907
Joined: Tue, 18. Feb 03, 01:43
x4

Post by Shimrod »

Config for equipping is planned, but at the moment it's hardcoded.

OK doesn't deliberately buy lasers at the moment, but retains any in the cargo bay that are compatible up to an amount equippable by all turrets. This avoids selling off lasers the player deliberately equipped, but has the side effect that the trader scavenges compatible weapons when trading them.

Missiles and drones do help the ship survive though. OK launches 'best missile' and a quantity of drones at each attacker, while at the same time move/jumping to another sector.
littleliliput
Posts: 11
Joined: Thu, 24. Nov 11, 17:51
x3ap

Post by littleliliput »

Thank you for your reply. Could you please add an option to just sell lasers, not retain them? Can I ask when do you plan on releasing this config?

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