Killing Floor 2

Killing Floor 2

158 ratings
Custom Trader Inventory
2
   
Award
Favorite
Favorited
Unfavorite
Maps and Mods: Mutators
File Size
Posted
Updated
255.943 KB
Jul 5, 2022 @ 6:11am
Apr 28, 2024 @ 11:05am
26 Change Notes ( view )

Subscribe to download
Custom Trader Inventory

Description


📋 Description
Trader inventory management

✨ Features
  • Add items to trader
  • Remove items from trader
  • Preload weapon models (prevents lag when players buy weapons)
  • Unlock DLC weapons
  • Proper item sorting (by price)
  • Add an unlimited number of items to the trader
  • Players can sell weapons that were removed from the trader inventory

❌ Whitelisted?
No. This mod is not whitelisted and will de-rank your server. Any XP earned will not be saved.

🎮 Usage (single player)
  1. Subscribe to this mutator.
  2. Create a file (*):
    C:\Users\<username>\Documents\My Games\KillingFloor2\KFGame\Config\KFCTI.ini
    with content:
    [CTI.CTI] Version=0
  3. Launch KF2.
  4. Open console (~) and start any map with the mutator (this will generate the default KFCTI.ini content):
    open KF-BioticsLab?Mutator=CTI.Mut
  5. Close the game and configure the mutator (see ⚙️ Setup (KFCTI.ini) below).
  6. Launch KF2 again, open the console, and start the game:
    KF-BioticsLab?Game=KFGameContent.KFGameInfo_Survival?Difficulty=3?GameLength=2?Mutator=CTI.Mut
    (replace the map and set/add parameters you need).

🖥️ Usage (server)
Note: If this is unclear, first read: Dedicated Server Guide (KF2 wiki)[wiki.killingfloor2.com]
  1. Open PCServer-KFEngine.ini / LinuxServer-KFEngine.ini.
  2. Find [IpDrv.TcpNetDriver] section and ensure line exists (add if missing):
    DownloadManagers=OnlineSubsystemSteamworks.SteamWorkshopDownload
    (If there are several DownloadManagers then the line above should be the first)
  3. Add the following string to the [OnlineSubsystemSteamworks.KFWorkshopSteamworks] section (create one if it doesn't exist):
    ServerSubscribedWorkshopItems=2830826239
  4. Start server and wait for mutator download.
  5. When the download is complete, stop the server.
  6. Create a file (*):
    <kf2-server>\KFGame\Config\KFCTI.ini
    with content:
    [CTI.CTI] Version=0
  7. Add mutator to server start parameters:
    ?Mutator=CTI.Mut
    and start the server (this will generate the default KFCTI.ini content).
  8. Stop the server and configure the mutator (see ⚙️ Setup (KFCTI.ini) below).
  9. Start the server.

🐞 (*) Buggy config initialization
This mutator (like many others) relies on UnrealScript's default values (0 for int type) to detect first-time use and generate a config.
However, the game contains a bug that initializes unset values to random data, which can lead to incorrect settings or missing configs.

As a workaround, I recommend explicitly setting Version=0 in the config during the first initialization.

Unfortunately, I can't fix this issue because it's a game engine problem (not the mutator's fault).

⚙️ Setup (KFCTI.ini)
  • bDisableItemLimitCheck: The original game does not support more than 256 trader items: exceeding this limit causes issues. If this problem is solved (for example, if you are using a mutator that has already fixed this problem or by enabling bApplyPatch) then it can be set bDisableItemLimitCheck=True to remove the limit, otherwise it is better to leave it False.

  • Set bApplyPatch=True to fix some base classes of the game: this fixes problems when adding more than 256 items to a trader and will allow players to sell weapons that have been removed from trader inventory. Note that enabling this parameter replaces the following game classes: KFAutoPurchaseHelper, KFInventoryManager, KFGFxMenu_Trader, KFGFxObject_TraderItems. There may be compatibility issues with mutators that also replace them.

  • Set bPreloadContent=True to load weapon models in advance and have no lags when someone buys weapons. In some cases (usually if there is a lot of custom content), enabling preload may cause models to disappear. It is recommended to test how this setting affects the game for your server configuration and then decide whether to enable preloading or not.

  • Set bOfficialWeaponsList=True to have an auto-updated list of all official weapons in the config (for a convenient copy-paste) or leave it False if you want a clean config without unnecessary things.

  • Set UnlockDLC to customize DLC weapon unlocks. Here are the possible values:
    • False - disable DLC unlock.
    • ReplaceFilter - changes the trader filter allowing you to buy original DLC weapons without restrictions, unlocks future DLCs as well (no need to update this mutator). However, it replaces the KFGFxMoviePlayer_Manager class so it may not be compatible with mods that also replace it.
    • ReplaceWeapons - replaces DLC weapons with their unlocked variants. Compatible with any mods, but may require a CTI update after the release of new DLC weapons.
    • True or Auto - selects the most appropriate option automatically. Recommend putting CTI.Mut last in the mutator load queue if you use this.

  • Use [CTI.RemoveItems] to remove items from the trader inventory.
    example: Item=KFGame.KFWeapDef_Mac10 will remove MAC10 from sale.

  • Set bALL=True if you want to remove all items (can be useful if you want to set the entire sale list in the [CTI.AddItems] section yourself).
  • Set bHRG=True to remove HRG items.
  • Set bDLC=True to remove DLC items.

  • Use [CTI.AddItems] to add items to the trader inventory.
    example: Item=WeaponPackExt.KFWeapDef_XM25 will add XM25 to sale.

📌 Notes
  • If you need an empty list anywhere (for example, you don't want to delete trader weapons), leave at least one line there:
    Item=
    This is necessary to explicitly initialize the list (because of the bug mentioned above) to avoid initialization with incorrect values.
  • This mutator does not include custom weapons. You must have the required weapon packs in your subscriptions to be able to add them to the trader.
  • If you use this mutator to add weapons, avoid enabling mutators from weapon packs (having them in subscriptions is enough).

🌍 Credits
Translators:
Other credits:
  • The cat on the cover is Meawbin (original character by Cotton Valent[x.com]).

☑️ Status: Completed
✔️ The mutator works with the current version of the game (v1150) and I have implemented everything I planned.
⛔️ Development has stopped: I no longer have the time or motivation to maintain this mod. No further updates or bug fixes are planned.

📜 Sources
https://github.com/GenZmeY/KF2-CustomTraderInventory (GPL-3.0-or-later)
161 Comments
Sauron Cat Sep 18 @ 7:36am 
Sorry, I didn't mean to insinuate that your botched your code.

It's a clean install and I delete all the leftover files inside and outside the game folder before installing again.

I manage to make it work, so it doesn't really matter on my side.

If someone else get this problem for whatever reason, they have a workaround.
GenZmeY  [author] Sep 18 @ 7:22am 
I can't say for sure since I don't know what's going on on your computer, but this warning could indicate you're using an older (different?) version of CTI that doesn't yet have the CTI.Mut class. Previously, CTI only had CTI.CTIMut and no CTI.Mut

You might want to clear your cache and carefully check your subscriptions - maybe amogus is in there xD

Another CTI could have gotten into your cache even without your explicit action. For example, if you were playing on a server that uses a different version, the client automatically downloads the mutators used on the server

CTI is open-source, so anyone can make a modified version of CTI and use it on their servers. KF2 is pretty straightforward and simply takes the first mod with the right name, so if you have different CTIs in your cache at the same time, you can't be sure you're using the right one
Sauron Cat Sep 18 @ 6:25am 
I tried all the solution other than that and it was the only way I manage to make the file because otherwise the game log said that :

Warning: Warning, Failed to load 'Class CTI.Mut`': Failed to find object 'Class CTI.Mut`'
GenZmeY  [author] Sep 11 @ 11:12am 
CTI.CTIMut is an alias [github.com] for CTI.Mut, they work exactly the same and are not related to creating a config

The only reliable way to generate a config is to create a file with a zero version inside, as described in the manual (it's up to date)
Sauron Cat Sep 9 @ 2:49pm 
For those having a problem making it generate the config

You should use "open KF-BioticsLab?Mutator=CTI.CTIMut"

Instead of "open KF-BioticsLab?Mutator=CTI.Mut"

Most likely, he didn't update the instruction.
GenZmeY  [author] May 21 @ 12:29am 
Hey, this always happens if you have more than 256 trader items in total, the game does not work correctly in this case

This is fixed with bApplyPatch=True in the CTI config, or you can reduce the number of trader items

Before using bApplyPatch, read its description, its use may cause incompatibility with other mods
ClutchNZ May 20 @ 3:45pm 
hi @GenZmeY, having a bug with CTI, when you buy weapons from trader it buy's other things? any fix for this?
∀ℳΞ¡ƧΞɲþɘɼ Apr 26 @ 1:42am 
Thanks @GenZmeY for the explanation. Not sure how to proceed with the problem, but I will test some things. I have a weapon pack on the server which has a modified version of the sentinel, but I'm not currently using it...
elbotellas888 Apr 25 @ 2:22pm 
esta puta mierda no funciona
Gangsta Skeleton Apr 20 @ 3:50pm 
Do I have to create the Custom Folder and name it KFCTI.ini? because I did that, and it doesn't seem to work, I couldn't find the [CTI.CTI] and Version=0 part neither so I created custom folders and named them that, and I couldn't go further, idk what the setup stuff means, is there a video or something to help?