Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
October 27, 2021
arrowPress Releases
If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Getting to work on the Trader NPC for Bad Luck Black Cat | Blog 2 (8/10/2021)

by Callum McDermott on 10/11/21 12:37:00 pm

The following blog post, unless otherwise noted, was written by a member of Gamasutra’s community.
The thoughts and opinions expressed are those of the writer and not Gamasutra or its parent company.


To begin with the Game Designers in our project wanted the mouse cursor to hover over the items in the shop and have the details of that item to show up in a description box. Also when hovering they wanted a box where you could increment and reduce the amount of items you could buy with also having the buy/sell button being active when you hovered over an item.

Designers Sketch


Since it was one of the first times that I have worked with widgets I had never really used buttons before. But thankfully Unreal makes it easy for developers to implement and use buttons in a better way than Unity. When setting up the functionality of the Trader NPC I had to make sure to get a reference of the players inventory and add each item (item icon) to a button that had an image component as a child in the widget. I tried to think of an easy way of looping through all items and adding the icons to the buttons but it proved to be harder to try and loop through an array of buttons with even trying a dictionary. So sadly I had to go through and add sorted icons to the buttons images one by one both for selling and buying. in the future I would very much like to come back to this task maybe on a solo project and figure out how this all could have been avoided.

Next challenge was to add the NPC's Inventory to the Trader Widget. First of all I had to create the inventory for the NPC and have items be added to that inventory. I also realized that it would be helpful for the designers if I had a way for them to add certain items they wanted, but also add a price/value to those items. Another programmer recommended that I should use a data table which would make it easy for the designers to add items with values.

Once I had done the data table and repeat the similar steps I had done for the players inventory to show up in the widget, I had to make sure the player was able to leave the shop which was an easy step. However since I was using the AI Behaviour tree for the trader (like how I was using it for the Questing System) I had to make sure it carried on down the tree so when telling the shop you wanted to exit I had to let the Behaviour tree know too. A the Moment the items that you "buy" dont get added to your inventory but hopefully in the next 2 weeks I will have that implemented.

Current Picture of the trader UI


If you would like to take a look at the Alpha build the link is here:

Related Jobs

Iron Galaxy Studios
Iron Galaxy Studios — Chicago, Illinois, United States

Senior Software Engineer
Disbelief — Cambridge, Massachusetts, United States

Junior Programmer
Champlain College
Champlain College — Burlington , Vermont, United States

Assistant Professor of Interaction Design and Immersive Media
Infinity Ward
Infinity Ward — Woodland Hills, California, United States

Senior Multiplayer Design Scripter/Programmer

Loading Comments

loader image