[AL] [18.04.2011] Operating Costs [3.1.4]

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

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

[AL] [18.04.2011] Operating Costs [3.1.4]

Post by Cadvan » Tue, 15. Jun 10, 04:22

german thread

Operating Costs


I was wondering for some time (and others as well) that there are no runnig cost's in X. You build a station and don't look after it any more: It earns money or not, but never looses it. To change this I've written this plugin.

It adds to all station owned by player running costs.
If you cannot pay them any more you get a warning 1 time. Haven't you transfered the missing funds within 5 minutes the factorys stop producing. On deactivatet stations you can still trade, but the missing maintenance will let the station slowly decompose.
Naturely you can deactivate stations on your own if you want.
Ships without Homebase will get paid from player-account. If you don't have enough money at hand you will get a message too and will have 10 Minutes to get the missing funds.
Deactivated ships will not decompose, but the won't run anny commands.


Costs are only applied with running al-plugin

Every factory has to be paid depending on there products and production factor.

Costs each hour and production factor ar as following:
Mines = 500 Credits
Level 1 food farms= 500 Credits
Level 2 food factorys= 1.000 Credits
Technology factorys = 2000 Credits
Energy power plants = 3000 Credits
Schield production = 7000 Credits
Rocket factorys = 10000 Credits
Weapon forges = 10000 Credits

Complex hub's
Complex hubs needs 1000 credits for each hour and conected station.
Big complexes has more traffic within there tubes. So there is more maintenance needed and logistic personel.
Cause of this complexes with more than 25 station needs double the payment.
(You can change this within the t-file. More about this in part t-file)

Trading Stations, Equipment docks, Xenon hub and Headquarters are paid for from the listed wares. They need 1000 credits each ware and 1000 credits for station itself.

Costs for Ships are basing on there generators.
For 1 generator to generate 1MW of energy for 1 houryou need gas with costs of 1 credit.
Little ships (M5, M4, M3, TS, TP) are compact build and have only 1 generator.
Big ships (M6, M8, TM) have 5 generators.
Huge ships (M7, M2, M1, TL) have 10 generators.
Reduced need of energy while docked are compensated by demurrages.
Ships docked at own stations or carrier need only half costs.
All generators on ship are equal sized. The energy output is listed in ship details – shieldgenerator.
Count of generators for shipclass can be set in t-file.
So for example an argon M5 discoverer operating costs are 100 credits each hour.

Deaktivated stations

Deactivatet Stations don't need funds any more, but they don't produce anything and decompose with time.
Cause the main energy from station is switched of the shields are collapsing after 1 hour and the station becomes target for spacewaste, miniasteroids and even spaceflys. So with time the hull breaks apart (5% from actual Hull points each hour)
Deactivated stations will also deactivate all of their ships.
A reactivated station starts up there generators, shields start to reload and all ships of station will get reactivated.
With deactivated plugin a station will only stop production and deactivate one time its ships if using station management.
(Cause of problems with other scripts you can switch of the deactivating of shield within t-file)

Deactivated ships

Availible even with deactivated plugin.
Deactivated ships will dock automaticly at next station. Huge ships will stay in space whereever they are.
There they switch off their generators, so no more costs are running. Cause of this they won't even start automaticly as long as they are deactivated.
Deactivated ships will have their status added to ship name and deactivate their owned ships.
For deactivated ships the risk to get stolen will increase with time as long as theyre not docked at carriers.
Ships with a deactivated homebase (carrier or station) can not get activated
Automaticly deactivated ships will continue their commands after activation, if activation was automaticly too.

Station management

Station management is a tool to controll and interact with your stations. It is still availible if plugin is deactivated.

Management shows you all stations from complex or sector, added with informations about status and possible running repairs.
Assistant evaluates data from your stations in sector or whole company depending on choosen filter.
He is still apperentice of management, so he needs some more time, esspecially for company-data.
Statistic departement shows you how much money each station has consumed so far. It takes running costs and repairs into account.
Accounts will show you the costs of station.
Overall costs include all costs from repair, operating costs for station and ships and – in case of complex hub – connected stations wich are paid so far.
Operating costs station are the costs for wages and maintenance for station paid so far. (not repair)
Last paid for station shows you how much you paid last time for maintenance and wages. Here you can see how much your station spends each hour for itself.
Operating costs ships and Last paid for ships are the same, only for ships.

After choosing a station you can change it's status to 'out of service' or 'in operation'. For factorys you have even the option to announce station-wide holidays. You can start an inspection too.
Workers will leave for holiday and production comes to a halt while station holiday, ships will even sent to holiday (get deactivated). But a small group of maintenance-workers stay back and maintenances shields and structur of station. So these station will not decompose and have halfed operating costs. You can restart ships or add activated ships to a station with holidays.
You can call a repair-team if station is in operation even too.
This team will repair your station within some time (5% of hullpoints each 10 minutes).
The payment for repair needs to get paid beforehand and get payed from player account.
The costs are based on price for a new station, percent of damage and in case of complex hubs on kits build in.
Last but not least the station management keeps the contact to commercial agents from pilot union.


Within the t-file you can adjust the plugin.
An english game uses the file 7011-L044.xml

The first part (0-32) holds the base prices depending on there main type. Not all numbers are used
Attention: Changes within this part needs you to deactivate the plugin for around 10 minutes or they won't get taken.

The second part from id 100 on you can set some factors for different parts.
Up to now there are only the factors for big complexes and count of generators for ships stored.
Id 100 sets the minimum stations needed to define a big complex. Id 101 holds the multiplier to increase the costs, id 102 the divisor to decrease them for big complexes. You should never set them below 1!
The used formula is
(baseprice*station count*mulitplier)/divisor
For example:
(1000*32*2)/1 = 64.000 credits each hour
Id 150 to 152 stores the count for gereators for ship classes (little, big and huge)
If you set them to 0 you can deactivate the costs for ships.

Within the third part there are known issues with other scripts addressed which cannot get solved within this plugin.
Currently known is only a shield bug.
If 2 scripts interact with station shielding in different manner it can happen that reactivatet stations wont get shields – or deactivatet stations don't start to decompose.
If this happens set id 200 to 1 (standart is 0). If you made this station shields will get ignored and stay active. Station will still decompose.

Download and installation

Download: Operating costs

Download ZIP-file and unpack it in your X3TC directory.
Your Game will automaticly set to modified


If you have last used a Version before beta 1.2 you need to deactivate this plugin for around 10 minutes. After this you can restart it. If your latest used version is beta 1.2 or above you don't need this any more.


You can start or stop this plugin whenever you want within the artificial life settings.
After installation its deactivatet.
Station management is usable even if plugin is deactivated. A deactivatet plugin means you can still stop production, but stations don't need funds or decompose. Even repair is still full functional.
Ships can get activated or deactivated even if plugin ist deactivated.
And the connection with Lucike's CAG is still working.

Last words

Special thanks to UniTrader for his help within chat.
Every modder can use this plugin within his projekt freely. I only ask to get mentioned.


15.06.2010 - beta 1.0
+first release

15.06.2010 - beta 1.1
+added costs for complex hubs

16.06.2010 - beta 1.2
+added costs for docks
+added repair script for stations
+automatic restart after updates added (works only after upgrading from at least betra 1.2)
+t-file reworked for more compatibility with mods

17.06.2010 - beta 1.2.1
+optical rework on station management, added status

19.06.2010 – 2.0
- end of beta
- increased costs for complex hubs and docks
+ added calculation for big complexes
+ added reame (german and english)
+ switch to prevent shield bug build in (scriptcollision)

21.06.2010 – 2.0.1
+ added sector and universe to station management

21.06.2010 - 2.0.2
- sector listed ki-stations - repaired

22.06.2010 – 2.1
+ Station management reworked
+ added statistics

23.06.2010 – 2.2
+ added station holidays for factorys

30.06.2010 – 3.0
+added costs for ships
+added command to activate or deactivate ships
+Accounts added to station management

09.07.2010 – 3.1
+ deactivated ship can get stolen after 25h
+ deactivated ships can directly get reactivatet, no more waiting time
+ for stations with less then 50% hull you will get an offer to sell them once

12.07.2010 – 3.1.1
+ Ships docked at carrier cannot get stolen any more
+ Ships docked at own station or carrier only needs half costs
+ code-optimized

20.07.2010 – 3.1.2
- ESC now close Station management

11.08.2010 – 3.1.3
- repaired bug in station management - account
- repaired bug with building complexes

18.04.2011 – 3.1.4
- repaired bug with loosing shields after building complex
- added station inspection to station mangement


T-File 7011
Pageid 7011

Used libary:
lib.hu.get.hub from Huefte
Last edited by Cadvan on Mon, 18. Apr 11, 16:52, edited 22 times in total.

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Tue, 15. Jun 10, 04:24


Some examples of calculation:

1 wheat farm m earns around. 9.600 credits/hour while operating costs are 1000 credits/hour.
(500 baseprice * production factor 2)

3 Rhime factorys l earn each hour around 153.000 credits.
As single stations the needs 15.000 credits all together each hour
(1000 baseprice * production factor 5 * 3 stations)
Within a complex there get 3000credits/hour added on costs
(1000 baseprice * 3 stations)

1 trading station with 8 wares listed. income cannot seen, running costs are 9000 credits each hour ( (8 wares + 1 station) * baseprice 1000 )

1 argon discoverer has a shield generator of 100MW and 1 Generator
100*1=100 credits/hour

1 argon Mammouth (TL) has a shield generator of 3300MW and 10 generators
3300*10=33000 credits/hour


Decomposing of a station with 800.000 hullpoints needs 118 Hours.
a complex hub with its 500.000 points survives 109 hours after deactivating.
a station with 2.250.000 hullpoints can manage 138 hours until destruction.
So stations have after deactivating at least 4,5 days until destruction.
(Factorys have - as far as i know - between 750.000 (mines) and 5.000.000 (crystall fab) hullpoints.

Xenon hub cannot get destroyed. and station within complexes will live as long as the complex hub is still alive.


Cause of different wishes for big complexes i have build it adjustable.
standart is that costs for complexes with more than 25 station gets doubled.
For this there are the id's 40, 41 and 42.
Standart 25,2,1 (x*2/1 = x*2 )
If you are using 25,1,2 the costs get halfed above 25 stations ( x*1/2= x/2)
And with 25,3,2 they will increase 50% from 25 stations on. (x*3/2 = x*1,5)

ids 150,151 and 152 holds the count for generators of shipclasses little, big and huge.
if you set them to 0 you can even ste the costs for every ship to 0

side effect

You can even now block a station from trading.
Let ships from you dock at every docking port of a station and deaktivate these ships. they cannot undock, so other traders will idle in front of station and cannot dock.
Last edited by Cadvan on Wed, 30. Jun 10, 18:43, edited 3 times in total.

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Tue, 15. Jun 10, 09:14

Your English is fine.

Your download link needs to be repaired. In both the German forum and here.

I'll try this. Looks very good, great idea!

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Tue, 15. Jun 10, 12:37

thanks :oops:

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Tue, 15. Jun 10, 22:10


Version beta 1.1

Now Copmplexhubs has costs for there own.
These are currently 500 credits for each conected station.

A single wheat farm m makes 9.600 credits each hour and needs 1.000 credits operating costs.
10 free wheat farms also 96.000 and 10.000

These 10 wheat farms conected in 1 Complex now will make 96.000 credits and needs 15.000 credits operating costs.

For Update you need to deaktivate the pluginn and wait 10 minutes. after update and waiting time you can restart the plugin.
Until the end of beta i will change it so you can update without stopping the plugin. I hope i will find the way to do so.

User avatar
Posts: 371
Joined: Fri, 18. Mar 05, 16:26

Post by Locksley » Wed, 16. Jun 10, 00:20

Nice. Was thinking of doing something like this with the MD but I haven't gotten very far in XML and MD scripting (and I am playing Oblivion - and it hate me, bloody mess, nothing is working as it should).

You mentioned workers. Is there any interaction with workers? Like you know how many are working, striking. Not that I like micro-management in absurdum but some stats is fun :D

Onhold..... time time....

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Wed, 16. Jun 10, 05:41

workers are only stpry behind kosts. no interaction.

effectively only pay or the station won't run. sorry

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Wed, 16. Jun 10, 07:57

It seems to be working as advertised for me. Great idea.

The possibilities are endless with where you can take this script. How many workers are hired results in how productive the station is, for example.

User avatar
Posts: 486
Joined: Mon, 3. May 10, 20:30

Post by Nafensoriel » Wed, 16. Jun 10, 07:58

Operations costs should reduce after a certain point in large complexes(say 10+ stations). Just like larger stores and warehouses eventually you reach a saturation point for labor where adding a new employee will not have the same production increasing effect as it did originally. A progressive reduction might be more realistic for megaplexes. Also harmonized resources reduce costs as well. For example a completely self sustaining complex would need less overall resources because it would not only produce it's own energy but also the majority of its own food needs.

If someone made a Hull Plating/paneling station to buy it might also be kinda interesting to see if it could be turned into a native consumption need to keep stations hulls repaired instead of purely spending credits.
(tossing out sleep induced ideas. Great idea btw I like the added realism)
"A Tradition is only as good as it's ability to change." Nael

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Wed, 16. Jun 10, 14:50


to increase the output of a station is - as far as i know - hardcoded.
Its even impossible to get the production multiplier of a station with script commands. (ok, there is a work around for this, but no direkt way)

Normaly i would agree with you. Normaly i would build complexes the way that each station is build within another, so that they "really" have only one warehouse etc.
But in X we have a lot of single stations connected with tubes.
surely, you can buy your resources cheaper cause of the demand, but all the other factors aren'T changed within great complexes. Cause they are still single stations wich are only connected with tubes instead of freighters.

In German forum they are asking to increase the cost for big complexes. Cause you have to send more and more wares through the same, old, small tubes. -> more traffic inside tubes, more maintenance needed.
And even each single stations has to do more work. The need to send more wares through wich are needed on other factorys.

At this moment i think this is (cause of the Game logic) more realistic then decrease.

Today i will look to reorganise the t-file so the mod-kompatibility is increased.
I will integrate a check for updates, so that this time will be the last time you have to stop the plugin for update purposes.
And i will include the Docks ( Trading station, Equipment dock, Heatquarter, Xenon hub - 500 credits each listet ware + 500 credits station)
lets see how far i will get :)

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Wed, 16. Jun 10, 20:16


Version beta 1.2 is out now

+ Rearranged t-file for better mod-compatibility: if a mod uses other main types in producing stations this plugin can handle it now
+ added automatic restart after update: works only for updates from beta 1.2 to above. so this time you still need to deaktivate the plugin and wait 10 minutes.
+ added costs for docks: now all station types are working within this plugin. costs are made from listet tradeable wares (each 500 credits) and station (even 500 credits to)
So a dock with 32 wares listet needs 16500 credits each hour.
+added repair script. with station management command you can start a repair task for your station now. The costs depends on cost for station, percent of damage and in case of complexhubs on stations inside complex= building parts for complexes.
every 10 minutes the station getb 5% hull back. after a maximum of 3h20 minutes a station is completely repaired.
Repair works only on aktive station and will get paid from player account.

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Thu, 17. Jun 10, 18:32


beta 1.2.1

Reworked the outfir of Station Management.
Now you have every time to choose the station - even if its only one.
In choice-menu you can see the status of your Stations. Out of service, in operation, repair underway,
close it with escape won't start any command on your station.

im thinking about killing the stations at then end of decomposing. up to now they stop decomposing at 2000 hullpoints.
If you don't say annything against it i will build it in the next days.
whats your opinions about the costs?

If nobody says anything about it i will leave beta until 25. and see if i can send it in for superbox.

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Fri, 18. Jun 10, 01:02

OK, all very scary. It works. Too well...

I see one problem, but I think there's an answer.

Some of us use Sector Takeover by Trickmov, http://forum.egosoft.com/viewtopic.php?t=243791

Great script. But you use basically non money making Trading Stations to hold onto sectors that you've claimed. With your script, these stations now need money; otherwise, they do stop functioning, the shields start to diminish, and the station falls apart. Wow. Scary.

But having taken over at least fifteen sectors, keeping money in those Trading Stations is something that has to be watched.

I'm trying to use this: http://forum.egosoft.com/viewtopic.php?t=252398 to try to maintain funds in all of my stations, so that salaries get paid. (It's not working so far, not sure why...)

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Fri, 18. Jun 10, 03:53

I think I found a bug.

In a few of my trading stations, which I use to "capture" sectors, I let the station run out of money. Workers went on strike. Shields went down to -270000.

I added money, reactivated the station, attempted repairs, was told they were not needed, and waited a few hours. In the info area, shields are at 100%, but, there are NO blue bars in the My Property section. In Info, shields are still at -270000 kj, but it says (100%).

Using Cycrow's cheat script to rebuild hull and shields does not change the blue bars. They're gone.

It appears that numerically, percentage wise, shields are fine, but integer wise, they are gone, which is reflected in the blue bar images.

They don't seem to be coming back....

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Fri, 18. Jun 10, 11:02

hi russbo

thanks for your report. but strangely i cannot find annything. i'Ve tried a argon trading station and it works fine on my end.

normaly a trading station has 15 2gj shields equiped.
the script get this right

after deaktivating the script removes 15 2 gj-shields, so shield should be 0.
later it starts to rot away.

i reactivatet the station and it had again 15 2 gj shields -> total of 30.000 shield max.

after reactivating it needs time to rebuild the shields, they arent at full power from start.-> blue bar will build up with time.

i even could start repair. i got the message that tehy took arond 33k for repairs (only 5%) and startet repairs.

Do you have any mod or something installed wich are changing something on trading stations?
how did you build the stations? normaly buy at shipyard and build with ego-command from tl? (or fcc, there i know it works too)

Edit asks:
how many shield power does the trading station in question have normaly?
how many hull points does it have normaly?
Last edited by Cadvan on Fri, 18. Jun 10, 11:15, edited 1 time in total.

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Fri, 18. Jun 10, 11:07

OK, got around that issue by reloading, filling up station with credits, and restarting your script. Not sure why it did that. But despite having fifteen million credits in some of these trading stations (that do nothing but secure a sector), they deactivate, and decompose, on their own.

My PHQ also deactivated, despite having 100 million credits.

Also, with over sixty products in my PHQ, the cost is going to be prohibitive. I understand your rationale though.

Awesome idea. It's acting funny at times.

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Fri, 18. Jun 10, 11:33

shields are sometimes problematic.
docks have 2gj shields, factorys 1gj shields.
if scripts dont get this right the shielding will definetly act strange.
and if more than 1 scripts is interacting with the shielding of stations it will get complicated.
so if you can tell me anything about your trading stations wich act funny i can probably defeat this problem.

player headquater get deactivatet automaticly even with 100.000.000 credits in it?
60 wares means costs of 30500 credits each hour. 100 million should be sufficient :?

player headquarter is some problem at my end: i never had one in TC so far so i cannot test this script on it - and scriptet headquartes doesn't work correct :-S

Posts: 862
Joined: Sat, 12. Nov 05, 21:53

Post by russbo » Fri, 18. Jun 10, 19:36

Using this: http://forum.egosoft.com/viewtopic.php?t=252398 to maintain funds in stations. Five million each. Not sure if this is the reason why some trading stations "run out of money" in the eyes of your script. I will try managing it without script for a while and see what happens.

Hull degradation works fine.

I think your operation costs are good. Repair costs may be too low.

Overall, this is great. Adds much needed realism to stations. But this shield problem has to be investigated. I think it might have to do with that Station manager script; I'll play with it

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Fri, 18. Jun 10, 22:30

I think repair costs are fine.
To repair 100% of station the needed funds are equal to buy a new one.

Regarding shield problems.
while at work i thought about it. The only think i can think about is that one of other scripts you are using are interacting with station shields to.
and in this case it has to be broken.
Station shields don't have regular shield bays. each script has to store what they do with the shields. so 2 scripts working in different ways with the shields can not work.
All i can do alone is to prevent shields to fall to deep.

So i thought of an other solution:
In t-file there will be a switch to turn shild deaktivating on or off.
In case of shield problems you can set it to any other value and the stations won't loose the shields, but loose hull from the first hour. Thats the best i can do so far.

Today i will address in this way other problems to (big komplexes cheaper - more expensive: wehat now??)

The problem with the funds i cannot recreate too. im taking the funds direktly from station account. Maybe its the mentioned script. Don'T know what it does.

so i'll be back later with update.

User avatar
Posts: 2927
Joined: Sun, 14. Mar 04, 05:05

Post by Cadvan » Sat, 19. Jun 10, 02:26


19.06.2010 – 2.0

- end of beta
no bugs are found except the shield bug from russbo. and this one apperas to be script collision.

- increased costs for complex hubs and docks
ife calculated a bit. now each ware and station costs 1000 credits
You need to deactivate and reaktivate the plugin if you want to use this new value, otherwise your complexes and docks still calculate with 500 credits as base price.

+ added calculation for big complexes
big complexes now doubles the needed cash.
this you can adjust in tfile. (even turn around)

+ added reame (german and english)
nothing to say about this

+ switch to prevent shield bug build in (scriptcollision)
i'Ve found no other way than this one to prevent stations to be without shields.
stations don't have regular shield bays, you can even install 1.000 2gj shields in each factory. - or even -200 2 gj shields.

if you want that complexes with more than 10 stations need less cash to run you need to set some values in t-file

<t id="40">10</t> <- for 10 stations
<t id="41">9</t>
<t id="42">10</t> <- with these two values you decrease the needed costs by 10%

10 stations costs normal 10.000 credits. with this values
10.000*9/10= 9.000 credits.


to prevent your trading stations stranding without shields you should change the t id 75 to
<t id="75">1</t>

Post Reply

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