Devious Posted January 27, 2017 Share Posted January 27, 2017 I like the idea for everyone to start in the same sector, but with the meteorites being non-renewable this can turn out pretty ugly. I have already a few players who need to spend a lot of time and jumps before finding iron, if it would be possible to respawn the nodes there would be no need to set the server up so that everyone spawns in their own sector. Not sure if it's possible to do it automatically for the starting sector but being able to input sector coordinates to respawn could work. Link to comment Share on other sites More sharing options...
BAMcSH_ Posted January 30, 2017 Share Posted January 30, 2017 Hey there! I made something that I think fits what you're looking for. This script, when attached to a Sector, causes any destroyed asteroids with resources to respawn as a new random asteroid with resources befitting the Sector sometime within mintime and maxtime, as defined in the script. I attached it to every sector by adding Sector():addScript("data/scripts/sector/resourcerespawn.lua") after the Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") in all of the sector generation functions. If you wanted it to only run in the start sector, I'm not certain where the best place would be to add it in the scripts, but you could run it manually via the chat at that point by just manually executing /run Sector():addScript("data/scripts/sector/resourcerespawn.lua") The one drawback here is that the script won't spawn new resources (I tried that first, determining fitting positions was a nightmare, not to mention I wouldn't really know if things intersected), so you have to get it running on the sector before anyone mines it. All your players will need the script also I believe, I'm not really sure, this has been a learning experience. EDIT: I forgot to mention, place the script in data/scripts/sector as seen in the function calls. EDIT 2: Fixed a problem with script. I actually made this script the same day you made this post, but the forum wouldn't allow me to complete registration on my primary email, so I finally ended up doing another registration with a gmail. resourcerespawn.lua Link to comment Share on other sites More sharing options...
Kane Hart Posted January 31, 2017 Share Posted January 31, 2017 If you are still around Bam I suggest moving this into its own thread. It's useful for a lot of people and needs to be correctly seen :) Link to comment Share on other sites More sharing options...
BAMcSH_ Posted January 31, 2017 Share Posted January 31, 2017 Thanks, I'll probably do that soon. I have a couple other ideas I'm fleshing out and then I will likely start a thread for all my scripts. Link to comment Share on other sites More sharing options...
SpaceAce Posted February 2, 2017 Share Posted February 2, 2017 thanks for the mod running it from chat works ok but in which .LUA file and where in the file do i place the Sector():addScript("data/scripts/sector/resourcerespawn.lua") command so i can get resources spawning in all sectors. or can i just toss it in any where in the .LUA file as long as its in the file? Link to comment Share on other sites More sharing options...
BAMcSH_ Posted February 3, 2017 Share Posted February 3, 2017 There are sector generation scripts in the scripts/sectors directory. If you want resources to respawn in every sector, you can find the line where the events script is added in each of those sector generation script files and paste the line to add my script to the sector there. Link to comment Share on other sites More sharing options...
SpaceAce Posted February 4, 2017 Share Posted February 4, 2017 Thanks for the help could u put up a example for me or pic? Link to comment Share on other sites More sharing options...
BAMcSH_ Posted February 4, 2017 Share Posted February 4, 2017 Certainly! Here's an example, this is where I placed the function to add the script in one of the sector generator scripts, asteroidfield.lua: When I did this I actually just did a blanket search/replace for the entire directory using Notepad++, but the easy objective is to look for that other line where the events script is added and stick the line to add my script right after. Link to comment Share on other sites More sharing options...
Linkfish Posted February 4, 2017 Share Posted February 4, 2017 Hi, People on my server have been asking for this as well. However, I'd only want to spawn the resources in the starting sector, not everywhere in the universe. I'm no coding wizard but what would happen if I'd fill out the sector location inside the parameters? E.g. Sector(415:-8) :addScript("data"/scripts/sector/resourcerespawn.lua") Not sure if that works, but otherwise I don't see why there's parameters to begin with. Anyone who's tried this / got that working at all? Thanks! Link to comment Share on other sites More sharing options...
SpaceAce Posted February 5, 2017 Share Posted February 5, 2017 Huge help BAM thanks a ton appreciate it! Link to comment Share on other sites More sharing options...
BAMcSH_ Posted February 5, 2017 Share Posted February 5, 2017 Heya Linkfish. If you load into the game and do it through chat, the script will persist indefinitely. So if you only have one starting sector then it's just a one-time set and forget for the server. As far as noted in the scripting docs, the Sector() constructor does not accept any arguments, so it can only return the sector that the current script is running in I believe. EDIT: I guess I should mention, now that I think about it, there is an obvious solution here. The startsector.lua script gets run on player faction owned sectors only, so whether you only have one of them or multiple, adding the call in only that script will cause resources to respawn in all start sectors. Link to comment Share on other sites More sharing options...
kurikaktus Posted February 8, 2017 Share Posted February 8, 2017 So if you only have one starting sector then it's just a one-time set and forget for the server. Does this mean even after you close the server, you dont need to run the script again? Link to comment Share on other sites More sharing options...
Scrollen Posted February 8, 2017 Share Posted February 8, 2017 Is there a way to do this as a blanket script instead of by sector or would it cause a problem in sectors with no resources? Link to comment Share on other sites More sharing options...
Devious Posted February 10, 2017 Author Share Posted February 10, 2017 Thank you for making this, haven't been able to fully test it but have installed it on our server :) Link to comment Share on other sites More sharing options...
priestkatten Posted February 10, 2017 Share Posted February 10, 2017 Hi there, i added the line Sector():addScript("data/scripts/sector/resourcerespawn.lua") after this line Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") Is the mod running automatically in the background? Or is something missing? Tested it in a existing "hosted Multiplayer Game", but no ressources spawns :( dont nothing know about modding/scripting :( Link to comment Share on other sites More sharing options...
Devious Posted February 12, 2017 Author Share Posted February 12, 2017 Did you add the actual script to your files? Check your logs for any errors, that should give more information. Link to comment Share on other sites More sharing options...
priestkatten Posted February 13, 2017 Share Posted February 13, 2017 I added the line in "asteroidfield.lua", and files? should i add it in more files than that? For other Mods i can find *.lua files, here is nothing necessary? Link to comment Share on other sites More sharing options...
krusty Posted February 14, 2017 Share Posted February 14, 2017 edited because i lied. thanks for this =) Link to comment Share on other sites More sharing options...
sbire Posted March 8, 2017 Share Posted March 8, 2017 hi, thx for that script. i added the line; Sector():addScript("data/scripts/sector/resourcerespawn.lua") below the line Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") in every file which have that last line; ~#data/scripts/sectors#grep -r -i 'pirateattack.lua' ./ ./piratestation.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./piratefight.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonewormhole.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./colony.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonetrader.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./containerfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./asteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./asteroidfieldminer.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./miningfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonescrapyard.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./cultists.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./loneconsumer.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./factoryfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./smallasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./wreckageasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./pirateasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./stationwreckage.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./loneshipyard.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./gates.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./functionalwreckage.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonetradingpost.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./wreckagefield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ~#data/scripts/sectors#grep -r -i 'resourcerespawn.lua' ./ ./piratestation.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./piratefight.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonewormhole.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./colony.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonetrader.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./containerfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./asteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./asteroidfieldminer.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./miningfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonescrapyard.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./factoryfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./smallasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./wreckageasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./pirateasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./stationwreckage.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./loneshipyard.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./gates.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./functionalwreckage.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonetradingpost.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./wreckagefield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") i lowered the respawn time on server to min 10.0 and max 20.0 to test that script. does a server restart and a start with a new galaxy. but it doesn't work. then i copied the file to my client; no result, too. i'm running a dedicated public server with ubuntu server. DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" NAME="Ubuntu" VERSION="16.04.2 LTS (Xenial Xerus)" Link to comment Share on other sites More sharing options...
GhoStalker Posted March 10, 2017 Share Posted March 10, 2017 hi, thx for that script. i added the line; Sector():addScript("data/scripts/sector/resourcerespawn.lua") below the line Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") in every file which have that last line; ~#data/scripts/sectors#grep -r -i 'pirateattack.lua' ./ ./piratestation.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./piratefight.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonewormhole.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./colony.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonetrader.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./containerfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./asteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./asteroidfieldminer.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./miningfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonescrapyard.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./cultists.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./loneconsumer.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./factoryfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./smallasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./wreckageasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./pirateasteroidfield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./stationwreckage.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./loneshipyard.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./gates.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./functionalwreckage.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./lonetradingpost.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ./wreckagefield.lua: Sector():addScript("data/scripts/sector/events.lua", "events/pirateattack.lua") ~#data/scripts/sectors#grep -r -i 'resourcerespawn.lua' ./ ./piratestation.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./piratefight.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonewormhole.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./colony.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonetrader.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./containerfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./asteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./asteroidfieldminer.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./miningfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonescrapyard.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./factoryfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./smallasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./wreckageasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./pirateasteroidfield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./stationwreckage.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./loneshipyard.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./gates.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./functionalwreckage.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./lonetradingpost.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") ./wreckagefield.lua: Sector():addScript("data/scripts/sector/resourcerespawn.lua") i lowered the respawn time on server to min 10.0 and max 20.0 to test that script. does a server restart and a start with a new galaxy. but it doesn't work. then i copied the file to my client; no result, too. i'm running a dedicated public server with ubuntu server. DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS" NAME="Ubuntu" VERSION="16.04.2 LTS (Xenial Xerus)" I'm having the same issue as you. I am looking to hook the sector entered event then use that to add the script. I don't know if it's the correct way, or if it will work... Link to comment Share on other sites More sharing options...
sbire Posted March 12, 2017 Share Posted March 12, 2017 i tried to run the script as admin, once. /run Sector():addScript("data/scripts/sector/resourcerespawn.lua") i doesn't see any renewed ore. Link to comment Share on other sites More sharing options...
salmack Posted December 15, 2017 Share Posted December 15, 2017 I placed the file in the correct location. I run the command and it errors that if can not locate the file. I change the / to \ and run it again and it then errors that it cant find data(-28.11)criptsesourcerespawn.lua yes its missing the s and r Link to comment Share on other sites More sharing options...
Dirtyredz Posted December 15, 2017 Share Posted December 15, 2017 Just use my regen asteroids mod http://www.avorion.net/forum/index.php/topic,3055.0.html You can use /regen start in any sector to turn the sector into a regenerating asteroids sector. Do it in your start sector and problem fixed. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now