• 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/

Code Modified trader items have SelectedItemIndex = 0

Pharrahnox

Grizzled Veteran
Feb 3, 2016
268
71
Cranny mate
I've been using a modified version of Insert Name Here's trader list mutator (link), and it was working fine until v1050. Now all modified entries in the trader's list make you buy a crovel instead of the weapon that you're meant to get. I've been trying to sort this out for days, and have finally tracked down the issue. When you select an item that has been replaced or added, the SelectedItemIndex is always 0. I have tried to look through the code for all of the trader-related classes, and that's how I managed to track down the issue, but now I can't seem to figure out where SelectedItemIndex is actually set when you hover over an item in the trader. I have a feeling that this is probably done in Actionscript. Also, since SetItemsInfo() in KFGFxObject_TraderItems is native, and that is the function used in the mutator to update the trader list, I don't know why there is an issue when highlighting these new or modified entries.

Any help would be greatly appreciated; a particular aspect of my mod hinges entirely on modified weapons.
 
I haven't tried since I made this thread. I had already spent tens of hours on this, and it seems to me like I've hit a dead end - native functions and ActionScript. I was hoping for a dev to reply, but I lost hope in that a while ago too. But hey, if you want to try to figure it out, go for it.

I have mixed code from Insert Name Here's trader mod and Marco's ServerExt, as well as modifying it myself to suit my needs, and that is now working well. Just the usual problem of localisation :(. I will be posting a 'fix' in a sense, in the form of documented source code for my mod when I release it.
 
Upvote 0
Pharrahnox;n2284857 said:
I've been using a modified version of Insert Name Here's trader list mutator (link), and it was working fine until v1050. Now all modified entries in the trader's list make you buy a crovel instead of the weapon that you're meant to get. I've been trying to sort this out for days, and have finally tracked down the issue. When you select an item that has been replaced or added, the SelectedItemIndex is always 0. I have tried to look through the code for all of the trader-related classes, and that's how I managed to track down the issue, but now I can't seem to figure out where SelectedItemIndex is actually set when you hover over an item in the trader. I have a feeling that this is probably done in Actionscript. Also, since SetItemsInfo() in KFGFxObject_TraderItems is native, and that is the function used in the mutator to update the trader list, I don't know why there is an issue when highlighting these new or modified entries.

Any help would be greatly appreciated; a particular aspect of my mod hinges entirely on modified weapons.

I will take a closer look when i get a hours
 
Upvote 0
rossi123 This issue is from two years ago and I have long since found an alternative way of adding custom weapons to the trader. HickDead's Trader Inventory Mutator uses basically the same approach off memory. If you require this functionality check the source code for that mod or simply use that mod. If you were merely trying to help me, then thanks but the issue is already solved.
 
  • Like
Reactions: Freebase
Upvote 0