Running a BAT file on world creation / from a console command in SP

  • The FTB Forum is now read-only, and is here as an archive. To participate in our community discussions, please join our Discord! https://ftb.team/discord

Henry Link

Forum Addict
Dec 23, 2012
2,601
553
153
USA - East Coast
Not sure what you trying to do. Might be better to give us some more detail about what you are trying to accomplish. What is your long term goal?
 

SerTrollface

New Member
Jul 29, 2019
37
0
0
Not sure what you trying to do. Might be better to give us some more detail about what you are trying to accomplish. What is your long term goal?

I'm making some structures with Recurrent Complex for a modpack. They contain CustomNPCs, which have custom dialogues and quests. Now, customNPCs dialogue, quests, factions and stuff are saved inside the save folder, but the modpack isn't based on a custom map, but on randomly generated structures found in the world. So, on nromally generated maps. New saves, though, have the default customnpcs folder, without my dialogue and quests.

My goal would be to have, anyhow, the customnpcs folder in every new save already containing the various custom quests and dialogue files, without the user needing to go into the minecraft folder to run a bat file that does this (copies my custom customnpcs folder into each save), but instead running that bat each time a world is created.

I already have the .bat file, I only need a way to run it each time a save is created. If there is a way to do so without a bat file (I haven't found any scripting mod that can modify files though), it'd be good too.
 

Henry Link

Forum Addict
Dec 23, 2012
2,601
553
153
USA - East Coast
On a server this would be easy. Just add it to the batch/cmd file used to launch the server. On single player I'm not sure how you could do this unless someone has written a mod. Also, how do you handle adding this stuff as the player travels and generates new terrain? Can you just re-run the batch file?
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
I'm making some structures with Recurrent Complex for a modpack. They contain CustomNPCs, which have custom dialogues and quests. Now, customNPCs dialogue, quests, factions and stuff are saved inside the save folder, but the modpack isn't based on a custom map, but on randomly generated structures found in the world. So, on nromally generated maps. New saves, though, have the default customnpcs folder, without my dialogue and quests.

My goal would be to have, anyhow, the customnpcs folder in every new save already containing the various custom quests and dialogue files, without the user needing to go into the minecraft folder to run a bat file that does this (copies my custom customnpcs folder into each save), but instead running that bat each time a world is created.

I already have the .bat file, I only need a way to run it each time a save is created. If there is a way to do so without a bat file (I haven't found any scripting mod that can modify files though), it'd be good too.
There is a mod that lets users start with pre-generated world each time they make a new world. Maybe you can have this mod use a safe file that only consists of your scripts so the rest of the world gets normally generated?
I forgot the name of this mod though :(
 

SerTrollface

New Member
Jul 29, 2019
37
0
0
On a server this would be easy. Just add it to the batch/cmd file used to launch the server. On single player I'm not sure how you could do this unless someone has written a mod. Also, how do you handle adding this stuff as the player travels and generates new terrain? Can you just re-run the batch file?

The npc that gets generated only contains the filepath to the dialogue/quest (relative to the customnpc folder), so I only need to copy it once per save.

There is a mod that lets users start with pre-generated world each time they make a new world. Maybe you can have this mod use a safe file that only consists of your scripts so the rest of the world gets normally generated?
I forgot the name of this mod though :(

The mod is Lockdown, and I already tried, it crashes if I only put the customnpcs folder in the template.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,801
248
The mod is Lockdown, and I already tried, it crashes if I only put the customnpcs folder in the template.
Maybe that is because certain files are needed before a folder is seen as a world?
I believe the most important one is level.dat unfortunately this is also the file that holds the seed.
Could you test if you can have it working with just the level.dat file and the scripts? if that works it might be able to edit the level.dat file so it will generate a random seed at world creation.
 

SerTrollface

New Member
Jul 29, 2019
37
0
0
Maybe that is because certain files are needed before a folder is seen as a world?
I believe the most important one is level.dat unfortunately this is also the file that holds the seed.
Could you test if you can have it working with just the level.dat file and the scripts? if that works it might be able to edit the level.dat file so it will generate a random seed at world creation.

Tried, it keeps the level.dat seed.