I’m adding a new item to my player’s inventory using AddNewItem, but I can’t seem to figure out how to change the name and description dynamically. I wanted to add some information, specific to that instance of the item. Any help on this would be greatly appreciated. I realize that setting those properties only works locally, most likely because they don’t replicate, but why? There’s gotta be some way to get that working on server.
Thanks for the replies! That’s some major stuff. Good thing I hopped into modding when I did or my idea would not be possible I see. I actually am using “CustomItemData” in my PrimalItem. I took a look at “PrimalItem_StartingNote” to see what they did and it makes more sense to me now, but I’m having a new issue now. It seems that no matter what I’ve tried, my CustomItemData of the PrimalItem isn’t set yet when I’m trying to get the item description or set my custom item description string. I’ve tried (given all “Use BP” flags were set to true for each that needed…) “BPPreInitializedItem”, “BPCanUse”, “BPItemBroken”, “BPPostInitializeItem”, and even a custom function fired from elsewhere. The flow I’m looking for is this:
1.) AddNewItem -> Custom Item Data is set. This works perfectly on both server and client.
2.) Set the item description based off of data in my CustomItemData arrays. In my case, it’s an object array, but I’ve tried strings as well, just to see if that might have been the issue.
3.) Profit.
It seems the most reliable way to have an item description be dynamic is in BPGetItemDescription. I was able to get something dynamic that way, then moved it into a variable that I was hoping to be able to set elsewhere, like in “PrimalItem_StartingNote.” Each time I check for the Custom Data, it’s not there though. Don’t worry, I am setting the “Custom Data Name” properly across the board in my “GetCustomItemData” call because it’s working elsewhere, just not when I need the description changed. Where’s the best place to set this custom description variable? I tried replicated and non-replicated as well, for the variable. There was no difference.
Update:
I found out recently that BPGetItemDescription only fires when the PrimalItem is on your hotbar. This is… strange behavior. If I hover over the item in my inventory, the event never fires. Rather, it’s more like the item needs to be moved from its created location (hotbar/inventory) or dropped first before the BPGetItemDescription gets fired properly. To me, this means that there’s some sort of item initialization going on that I need to do as well. Any ideas?
Update 2:
I got it working! Turns out I had to call UpdatedItem after setting the custom data. This properly replicates it (I assume), such that it’s available for use in BPGetItemDescritpion. This is just for those who may be having the same issue as me.
Thanks P0k3r and Mezzow, you guys have really steered me in the right direction.
I’m having a new issue, that only exists on a real server. My previous solution was working fine when simulating Dedicated Server in the ADK, but it seem that in a real-world scenario, it just crashes. I’ve attached the error and my two graphs that are pretty much the problem area. Every time I hover over my item, to get its custom description, it just comes up with this crash. I’m not sure what’s causing it. I added some further checks in my BPPostInitializeItem graph, but that was for naught as well.