Jump to content

Welcome to the Forum!

The best place to exchange builds and ideas! Vote for the best ideas and suggestions here.

Join the Avorion Discord!

Connect with other passionate players and talk about the latest news.
Discord

DLC Avorion Into the Rift Out Now!

Now available on Steam!
Steam

[MOD] Goods Hauler (Automatically buy/sell/move goods!)


Splutty
 Share

Recommended Posts

There is only one problem when you use out of sector production mod: An AI controlled ship would not trigger the oosp production, cause oosp mod is only attached to the player.

Do AI controlled ships even touch anything while the player is not around? I thought Sectors weren't loaded without player or player-owned ship presence.

 

But, good of you to mention this; I didn't realise that OoSP only activates player-owned production chains. Off to researching how to make OoSP universal across the board, it is!

Link to comment
Share on other sites

  • Replies 116
  • Created
  • Last Reply

Top Posters In This Topic

Every player can keep up a specified amount of sectors. How much sectors is defined in server config. In offline games default setting is 500, on servers default setting is 5, but always can be changed by the admin.

 

 

Wich sectors are alive is depending on what you have in these sectors. A ships counts 1, a station 3. The sectors with most points are kept up (up to the maximum sectors per player setting). Thats why you even could have galaxy wide trading routes. But when you send your ship into an offline sector, it will stop. Doing anything.

 

 

I would like to have access to sector activation in Script API  ;D

Link to comment
Share on other sites

  • 3 weeks later...

I missed that you were looking for an update for the beta ^^" sry

I fixed the script (as far as I see) for the 0.15.6 update released yesterday.

Might be that I missed something, so tell me about your results :)

 

The mod works fine while in sector, but the haulers do nothing when you leave the sector...  After the oos update last year I used the mod and it worked fine oos...  What has changed  or am I missing something?

Link to comment
Share on other sites

I have a bug report. Not entirely sure what triggers it, but I'll tell you the outcome.

 

Sometimes Goods Haulers try to do one or both of the following problematic things:

  • Buy more goods than the Cargo Hauler has stock for, usually as simple as 1 over the total amount they could carry.
  • Push more goods to the receiving Station than that Station has space for.

 

Whenever they decide they want to do either, they don't let up and continue to try and perform this behaviour somewhere between 5 and 10 times in a row, which spams both the Console and the main game screen itself full of error messages (Console says something along the lines of "Expected to buy 5 goods but bought only 4", while the game screen shows an error in the typical red "You can't do that" message with a red cross, on the right) every second or so. With multiple Goods Haulers at work in one Sector, this gets very spammy very quickly, but more importantly, your Goods Haulers aren't doing anything, because they load up their Cargo Bays with goods they can now no longer push, because the receiving Station doesn't accept more goods of that type anymore.

 

Is there anything you can do to include some sort of check that wouldn't trigger this behaviour anymore? It's made me steer clear of giving my craft the Goods Hauler orders inside my own Sector, because they keep trying to push Aluminium from my Alu Mine to my Shipyard, which doesn't want it anymore, instead of acting as my handy cargo shuttle between production chains as I intended for them to do.

 

Furthermore, Goods Haulers with cargo already with them will never try and push these items for profit, which I think isn't in the spirit of how this mod operates.

Link to comment
Share on other sites

  • 5 months later...

Fantastic mod!

 

After attempting to set up a supply chain with cargo shuttles and bringing my server to it's knees long before the shuttles (using more shuttles mod) were able to move enough goods I gave this mod a try. Works wonderfully on 0.17.1.

 

Thank You!

 

;D ;D ;D ;)

Link to comment
Share on other sites

Unfortunately my haulers also just "doing nothing..." from time totime when I know they have loads of trades they could make. Sometimes /haulgoods stop;/haulgoods startfixes this but not always. Hopefully this can be resolved?

Link to comment
Share on other sites

I get the following in the log when the hauler "stops working":

 

2018-07-24 20-21-17| error constructing Entity: Entity with index Uuid doesn't exist at

2018-07-24 20-21-17| stack traceback:

2018-07-24 20-21-17|    [C]:-1: in function Entity

2018-07-24 20-21-17|    data/scripts/entity/ai/haulgoods.lua:456: in function haulGoodsMoveToSeller

2018-07-24 20-21-17|    data/scripts/entity/ai/haulgoods.lua:583: in function ?

2018-07-24 20-21-17|

2018-07-24 20-21-17| Execution Context (inner to outer):

2018-07-24 20-21-17| #0: updateServer data/scripts/entity/ai/haulgoods.lua

2018-07-24 20-21-17|

2018-07-24 20-21-17| could not execute function 'updateServer' in '"data/scripts/entity/ai/haulgoods.lua"':

2018-07-24 20-21-17|

2018-07-24 20-21-17| data/scripts/entity/ai/haulgoods.lua:456: attempt to index a nil value

2018-07-24 20-21-17| stack traceback:

2018-07-24 20-21-17|    data/scripts/entity/ai/haulgoods.lua:456: in function 'haulGoodsMoveToSeller'

2018-07-24 20-21-17|    data/scripts/entity/ai/haulgoods.lua:583: in function <data/scripts/entity/ai/haulgoods.lua:547>

2018-07-24 20-21-17|

2018-07-24 20-21-17| Starting thread [stacktrace Sender]...

2018-07-24 20-21-17| Started thread [stacktrace Sender] with id 643

Link to comment
Share on other sites

Hi Rilgar,

 

Unfortunately my haulers also just "doing nothing..." from time totime when I know they have loads of trades they could make. Sometimes /haulgoods stop;/haulgoods startfixes this but not always. Hopefully this can be resolved?

while you are in the sector? It happens when your station is moved, I have had a look at the scripts and might be able to fix that soon . Seems like the code causing the problem is copy&paste from a game-script...

 

I also found some unintended behaviour: The Mod doesn't know how to deal with player-owned trade-stations, semms like buy/sell have to be swapped. I don't know if and how other consumer-stations work.

 

EDIT: Except for that, it also works with the current beta-branch version 0.18.1

Link to comment
Share on other sites

while you are in the sector? It happens when your station is moved, I have had a look at the scripts and might be able to fix that soon . Seems like the code causing the problem is copy&paste from a game-script...

Both while I am in the sector and out. I think. Could just be that they stop shortly after I get back in too though. Haven't tried to compare timestamps on the logs to see at exactly what moment it happens. Happy to  check if it'll help...

 

I can believe the station moved... I tend to bump into the stations quite a bit, esp. when flying the big 15 slot ship. I believe it may also be when their docking get's "interrupted" by NPC traders. I have upwards of 30 NPC traders in the system at any given point. I have a couple times seen them "stuck" on a NPC trader ship... generally have to move them manually, let the trader pass and then restart the haulgoods process.

 

Looking forward to an update. Thanks :)

Link to comment
Share on other sites

Hi Rilgar,

 

I did some extensive testing... Something put one of my stations 1500 km away from its normal position, pushing it back @ 500 m/s a goodshauler-ship still tried docking... -> Movement doesn't break goodshauler.

 

Oosp seems to be broken to me. Restoring the sector from disk stops your goodshaulers (broken, too).

 

The errorlog you posted seems to be a one in a million chance, goodshauler didn't restore any routes. I think that's because it didn't store any routes - sector was saved to disk exactly when there was nothing to save.

Link to comment
Share on other sites

It's throwing an error when trying to concatenate the help and error messages on intialization for some reason, I've been thinking about learning LUA for ages, I guess this is an excuse to monkey with it some and see if I can figure it out.

 

2018-08-05 01-14-01| #0: initialize data/scripts/entity/ai/haulgoods_cmd.lua

2018-08-05 01-14-01|

2018-08-05 01-14-01| could not execute function 'initialize' in '"data/scripts/entity/ai/haulgoods_cmd.lua"':

2018-08-05 01-14-01|

2018-08-05 01-14-01| data/scripts/entity/ai/haulgoods_cmd.lua:12: attempt to concatenate local 'help' (a nil value)

2018-08-05 01-14-01| stack traceback:

2018-08-05 01-14-01|    data/scripts/entity/ai/haulgoods_cmd.lua:12: in function 'haulGoodsCmdSendError'

2018-08-05 01-14-01|    data/scripts/entity/ai/haulgoods_cmd.lua:41: in function <data/scripts/entity/ai/haulgoods_cmd.lua:27>

2018-08-05 01-14-01|

 

Edit: Fixed this by adding an empty string into the argument of the call of haulGoodsCmdSendError at line 4,

then
	haulGoodsCmdSendError(player, "Error: No ship selected.\n","")
	return terminate()
end

And now getting the following error, trying to figure it out, but if anyone has any suggestions, I'd love the help. I've been trying to isolate what about 'flyToDock' that isn't working.

 

 

2018-08-05 04-44-43| #0: updateServer data/scripts/entity/ai/haulgoods.lua

2018-08-05 04-44-43|

2018-08-05 04-44-43| could not execute function 'updateServer' in '"data/scripts/entity/ai/haulgoods.lua"':

2018-08-05 04-44-43|

2018-08-05 04-44-43| data/scripts/entity/ai/haulgoods.lua:370: attempt to call global 'flyToDock' (a nil value)

2018-08-05 04-44-43| stack traceback:

2018-08-05 04-44-43|    data/scripts/entity/ai/haulgoods.lua:370: in function 'haulGoodsMoveToSeller'

2018-08-05 04-44-43|    data/scripts/entity/ai/haulgoods.lua:457: in function <data/scripts/entity/ai/haulgoods.lua:428>

2018-08-05 04-44-43|

 

 

Edit 2: So I downloaded the OOS version, and was getting the same error, and fixed it, it was a namespacing error. ANYWAYS, here's a functioning version for you all

Edit 3: It has trouble with stations that don't always buy/sell the same goods, but I'm happy with it for managing my hub sector's so I don't have to manually move all the stuffs

haulgoodsfixedforbeta182.zip

Link to comment
Share on other sites

  • 4 weeks later...

Thank you guys for keeping this alive. I've been otherwise busy on a lot of things, and don't actively play Avorion at the moment, although I'm sure that will change again in the future :)

 

Glad to see people are still using my mod, even though it's mostly been rewritten by now it looks like.  ;D

Link to comment
Share on other sites

  • 3 weeks later...

I'm trying to run this on a server, and I keep getting an error saying I don't have permission to use this command. Any hope on fixing that? The files that are used have been completely reorganized for modifying files compared to what I'm seeing in the original post, as well, so I don't know if I'm installing it correctly or not.

Link to comment
Share on other sites

I'm trying to run this on a server, and I keep getting an error saying I don't have permission to use this command. Any hope on fixing that? The files that are used have been completely reorganized for modifying files compared to what I'm seeing in the original post, as well, so I don't know if I'm installing it correctly or not.

 

To use this on a server the permission to use the command needs to be added to the default group in the admin.xml

Link to comment
Share on other sites

  • 1 month later...

for version 18.3 if your haulers are getting to stage 3 in the console and just sitting still and not dropping off the goods here a fixed version

 

for those who dont want the haulers to be undocked by the stations

 

 

got to data\scripts\entity\ai\haulgoods.lua and add -- or comment out the 2 lines starting with DockAI.flyAwayFromDock

at line 390	--DockAI.flyAwayFromDock(ship, haulGoodsRoute[1])
and line 423	--DockAI.flyAwayFromDock(ship, haulGoodsRoute[2])	

 

 

 

 

 

Haulgoodsfixed183.zip

Link to comment
Share on other sites

  • 2 months later...
  • 2 weeks later...

Not working at all for me (Using the beta branch).

 

In 1.82 it's stuck in stage 3 .

In 1.83 it's stuck in stage 1, saying he should trade something getting close to the station that sells the goods and never docks. But he is nice and move his ass to let other traders dock when they are close to him lol.

Link to comment
Share on other sites

If someone can assure it still works then i'll try to make an update on it to change the version number and put the files inside a mod directory so it do not mess with the rest of the file and don't interfere with future game update.

 

But it dont seem to work on my game so i don't know if it's worth updating now. If someone can notify me.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...