• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/
  • Weve updated the Tripwire Privacy Notice under our Policies to be clearer about our use of customer information to come in line with the EU General Data Protection Regulation (GDPR) rules that come into force today (25th May 2018). The following are highlights of our changes:


    We've incorporated the relevant concepts from the GDPR including joining the EU and Swiss Privacy Shield framework. We've added explanations for why and how Tripwire processes customer data and the types of data that we process, as well as information about your data protection rights.



    For more information about our privacy practices, please review the new Privacy Policy found here: https://tripwireinteractive.com/#/privacy-notice

Modifying the Trader sales list via Unrealscript

Insert Name Here

Active member
Oct 3, 2015
205
57
28
In a recent thread, the Trader sales list was modified via a new archetype. This is fine for gamemodes (which the thread is about), but mutators would need to modify the sales list via code to remain compatible. After Slie mentioned that this could be done by directly manipulating KFGameReplicationInfo.TraderItems.SaleItems, I decided to take a jab at creating code that could easily be inserted into any mutator with minimal modifications necessary.

After some work, I got it to be functional, along with a few modded weapons to demonstrate the code in action. This should work until Tripwire decides to officially add Trader list modification to mutators.

The changes I made are mostly to Support weapons:
  • All ammo costs reduced from 5 to 4 dosh per shell
  • MB500: Starts with 8 more shells and has weight reduced to 4
  • M4: Has 16 more shells both initially and in spare capacity

The mutator also includes a new weapon, the Beretta 93R. It's just the regular 9mm pistol with an 18-round magazine and an extra 3-round burst mode (alt-fire changes fire mode like with Commando weapons).

Downloads: Mutator - Source

For the mutator: Place the .u file in your KFGame/BrewedPC folder and the .int file in your KFGame/Localization/INT folder. Open up the game and enter this in the console:

Code:
open KF-BurningParis?Mutator=TraderTest.TraderTestMut
Start the game as Support.

Some notes on the code:
  • TraderTestMut includes an example of replacing the player's starting weapon as well. Because the original MB500 is removed from the trader sales list, it won't show up in the trader inventory if you have it. (Any MB500 picked up from a weapon pickup will also have this glitch. I didn't think it necessary to fix this just to demonstrate the Trader modification.) Added weapon pickup modification in v2.
  • You don't have to subclass the TraderItemsHelper class. I did this so that it's easier to copy/paste the original class into your mutator's code. The only reason you would want multiple classes is to insert items at different points in code (see below).
  • This only covers the most basic function of having a weapon in the list from the beginning. Modifying the Trader list in other ways (like having certain weapons show up on certain waves or only to certain players) can be done similarly, but would require more code on the mutator author's end.

Old versions:
Spoiler!
 
Last edited:

Insert Name Here

Active member
Oct 3, 2015
205
57
28
I've uploaded a new version. The changes:

  • Fixed a bug that would add a copy of each weapon to the trader list after a level transfer.
  • Some optimizations and extra checks.
  • Now replaces the MB500 in weapon pickups.
  • Added ServerActors compatibility.
Download links are in the OP.