• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

removing traders from the world

3. With Notepad, open the file named "prefabs.xml" and search for "trader_" (without quotes).

This is what you are looking for, disregarding the trader's name, compound position and rotation ;

  <decoration type="model" name="trader_jen" position="278,73,-244" rotation="3" />


Do you have a similar method for removing the vending machines as well? Is there an xml file that contains all the /objects that spawn and you can then delete them in a similar fashion?

 
Do you have a similar method for removing the vending machines as well? Is there an xml file that contains all the /objects that spawn and you can then delete them in a similar fashion?


You would need to remove them from all POIs.

Easiest thing to do (if removing them as a benefit to the player) is just to remove the trader groups for them in the trader file.

<!-- *** POI Drink Vending Machines ID:4 -->
    <trader_info id="4" reset_interval="1" override_buy_markup="3" allow_sell="false" >
        <trader_items>
            <item group="drinkVending" count="4,8"/>
            <item group="drinkSpecialVending" count="4,8"/>
        </trader_items>
    </trader_info>

<!-- *** POI Food/Candy Vending Machines ID:10 -->
    <trader_info id="10" reset_interval="1" override_buy_markup="3" allow_sell="false" >
        <trader_items>
            <item group="foodVending" count="4,8"/>
            <item group="foodCandy" count="4,8"/>
        </trader_items>
    </trader_info>




You can delete the vending machines (they are in the blocks.xml file) but the POIs are still going to try to call them and you will get at least warnings, possibly errors for any POIs that have them.  Removing the trader groups to make them non-beneficial would probably be the easiest thing to do.

 
Last edited by a moderator:
You can delete the vending machines (they are in the blocks.xml file) but the POIs are still going to try to call them and you will get at least warnings, possibly errors for any POIs that have them.  Removing the trader groups to make them non-beneficial would probably be the easiest thing to do.
very cool , thanks.

Is this something I can do in a current saved game or do I have to regen world for this to take effect?

 
Instead of permanently removing blocks/POIs or dealing with regenerating the world, I would propose a relatively simpler approach by just setting traders closed and preventing them from opening again. This would be done by creating a C# mod for the server (or client for singleplayer) by using Harmony to detour TraderArea.SetClosed(World _world, bool _bClosed, bool playSound = false) method and changing the passed _bClosed argument to always be true.

PoC:

using HarmonyLib;
using System.Reflection;

/* .NET Framework 4.5
*
* References:
* - 0Harmony.dll
* - Assembly-CSharp.dll
* - LogLibrary.dll
*/

public class PeskyTrader : IModApi
{
public void InitMod(Mod _modInstance)
{
Harmony harmony = new Harmony(base.GetType().ToString());
harmony.PatchAll(Assembly.GetExecutingAssembly());

Log.Out("[MODS] [PeskyTrader] Loaded!");
}
}

[HarmonyPatch(typeof(TraderArea), "SetClosed")]
class TraderAreaPatch
{
static void Prefix(World _world, ref bool _bClosed, bool playSound = false)
{
_bClosed = true;
}
}



Compiled version (A21): https://drive.google.com/file/d/1Fgp27a_DrV1HU-7NTkYaKaS_lNEBNQts (extract and plop into the mods folder).

 
meganoth said:
You are correct about most of the legalities, but you will have a very hard time proving that 7D2D is not open world apocalypse, survival, crafting and horde defence in a court


There are obviously some people who feel more strongly about this than I do, which is why I think the devs should incorporate some of settings that allow the player to toggle traders and/or vending machines off. Don't get me wrong, I totally understand why many and maybe a greater majority like the aggressive , time-pressured tower defense aspect of the game; that's the type of game that appeals to the crowds - for those that want to search out and join servers with the server browser and play a game where progression can take place in a couple of real life hours or days. Arguably, that type of game sells , appeals to the PUG crowds, makes more $$ and devs need income like the rest of us. I get it. But with a few lines of code, I'm sure, they can incorporate a trader/vendor on/off toggle in the game settings and poof, people that enjoy the survival aspect of the game can play a game more customized to their play style, slower, more methodical, exploratory and with real life friends and family -not feel like they are under the gun and stressed out.

 
BFT2020 said:
Easiest thing to do (if removing them as a benefit to the player) is just to remove the trader groups for them in the trader file.


Hey can you elaborate on which specific lines of the code I need to modify? I tried removing the following lines and the vending machines still seem to be stocking items:

<item group="drinkVending" count="4,8"/>
<item group="drinkSpecialVending" count="4,8"/>

<item group="foodVending" count="4,8"/>
<item group="foodCandy" count="4,8"/>




Am I doing this right?

 
Back
Top