Here I am iterating through the array (my items) and outputting the display name which works correctly. What I cannot seem to figure out is how to hide the current item that is being held and show the new item that the array has shown. I do already do this with the 1-3 keys on the keyboard which looks like this:
I feel like there is a better way with the array to toggle through a set number of items as I do not need a complex inventory system for this. Any input would be appreciated as I have explored some avenues but come to a dead end each time, although I feel like this should be simple.
that blueprint is difficult to read and the comments don’t help as much as they could because they only say the same things that the nodes are doing.
It’s easier to understand if comments explain why a section of nodes do what they do. Like, how does the grouping of nodes contribute to the goal of the event/function?
It is also going to help a lot to compartmentalize the code into functions or custom events, with each compartmentalization being something that can easily be described with just a few words.
Finally, it enhances readability if there is standardization to the way you align wires and nodes. There is a bit written about that here: Allar/ue5-style-guide: An attempt to make Unreal Engine 4 projects more consistent (github.com)
You can do whatever you want of course, but if there is not a consistent style it makes the stuff hard to read, which discourages people from putting as much attention into it as they might otherwise.
More to the direct point of the question, I think you might be able to accomplish your goal with something like this:
One other thing to be aware of, if you are not familiar with using blueprint enumerators, that can also be used to enhance readability as well.
Instead of an integer for an index (which a few months from now, you’ll have to dig around in your code to figure out what it associates with, and you’ll be tired and annoyed by it), you can use an enum which just associates a string with an int, making it human readable.
Then the == operator will be so obvious you’ll hardly need comments at all.
I have looked into enums before when exploring other inventory options but didn’t think I would need one in my case. But I believe you are right and will look into using that as well to save myself a future headache.
Wow that is exactly what I was looking for! Thank you for that! I will mark this as the answer while also taking @BIGTIMEMASTER’s notes for the future. Thank you both.