Thx for the vid. I would maybe change one thing tho. Do the addition to an empty slot on the first branch (1:46) instead making a new loop for it ( 6:59 )? if slot has item: - proceed with other checks - else add it up and break
we only make 1 loop though? there isn't a 2nd loop that gets added. we simply check inside the 1 loop for each slot if it is empty, or if it has a matching item. if all slots fail both checks, we know that the inventory is full and can return that as feedback. if it either finds an empty slot or a slot with the same item, it adds it, stops the loop and the return value will indicate that the item was successfully added
12:43 It works for me up to this point but when I click "add XY" nothing happens. (I started with a blank project, the component is added to an actor class which will be the 2D-Main-Char, the "Items" are not Rocks but Chars and have no Mesh but instead a 2D-Papersprite and will work like Stickers in a Sticker Album). It works when I select them manually on one of the 16 slots. So I guess something with the targeting (self) is wrong? Can you help? 🙂
whatever is in the item here isn't really relevant for this function. either the add rock function or the add item function itself must have a mistake in it
@@thegamedevcave YESSSS FOUND THE MISTAKE!!! I didn't connect the initial Execution line xDD 🙈 Now it works and I'm fascinated, I've been adding and removing Items now for like 15 mins straight xDDD PS: And great, looking forward to the chest! I will try to make use of it as a random drop and then evolve it into a random drop that the player gets passively every so often.
it's a rerouting node. you can add one by just pulling off any other node and searching for reroute, I believe the shortcut for adding one on an existing line is ctrl+click but it's such muscle memory for me that i am not 100% on that XD
@@thegamedevcave Thanks! The reroute node worked for me (didn't understand it right in the video =)) and I somehow managed to pulled one off by ctrl+clicking but it only worked once so I need to butterfinger it a bit more :D Thanks alot! :D
Great tutorial. I opted for a data table system because of item instantiation. When you edit a data asset, that changes the value for every data asset, meaning something like an ammo value for a weapon will not work with dynamically instances items. Will there be a solution to this issue in future videos?
with this system you don't edit the data assets themselves. The data assets are used as read only object in this system, things like the amount of ammo you have is stores in the inventory slot instead. The same way I imagine you have to do with data tables, since those as a whole are read only assets too (you can't dynamically write to them). if you get a lot more complex with your items (giving them meta data like enchantments and stuff) you can add an extra object to the inventory slot struct that can hold arbitrary data. But this series doesn't get in that deep.
@@thegamedevcave Yeah, I ended up creating an item struct with a string map for unique attributes and using it in a data table as a read only template.
@@MyBroWithValorant that's a pretty good workaround! do be mindful that reading (specifically comparing) strings is a pretty costly operation to do though. I doubt it's the kind of thing you'll have to do every frame/ multiple times a frame. if you set it all up in a clever way you'll probably only have to read from it every once in a while so it won't be a problem :) still, good to be mindful!
jo chief got a question. well its all working fine and i really like your tutorial series. the problem is, the item i chose is not showing up but i did the add item and also checked the add function 100 times. u have a clue what it could be?
@@RevolverShotif you haven’t figured it out yet, I had the same issue. I had the set array element connected to true instead of false in the “add item” function. It should be false. After fixing that it works fine.
it makes some of the math later easier when merging together stacks and buying items from shops. It's not exactly optimal but it's also a very simple operation to doing it a number of times (unless you're stacking millions of items) won't actually matter and those systems become a lot less painful to program as a result. ideally, what you probably want is a simple "Add X: function as well as the "add 1" function that we have now though.
Thx for the vid. I would maybe change one thing tho. Do the addition to an empty slot on the first branch (1:46) instead making a new loop for it ( 6:59 )?
if slot has item:
- proceed with other checks
- else add it up and break
we only make 1 loop though? there isn't a 2nd loop that gets added. we simply check inside the 1 loop for each slot if it is empty, or if it has a matching item. if all slots fail both checks, we know that the inventory is full and can return that as feedback. if it either finds an empty slot or a slot with the same item, it adds it, stops the loop and the return value will indicate that the item was successfully added
You explained very well! Are there any way to break for each loop by going from end to start with that long line :D It really disturbs me out..
12:43 It works for me up to this point but when I click "add XY" nothing happens. (I started with a blank project, the component is added to an actor class which will be the 2D-Main-Char, the "Items" are not Rocks but Chars and have no Mesh but instead a 2D-Papersprite and will work like Stickers in a Sticker Album). It works when I select them manually on one of the 16 slots. So I guess something with the targeting (self) is wrong? Can you help? 🙂
whatever is in the item here isn't really relevant for this function. either the add rock function or the add item function itself must have a mistake in it
@@thegamedevcave Allright thanks I'll go through it again step-by-step 🙂
@@thegamedevcave And the fact that the component is attached to a simple pawn shouldn't matter either, right?
@@BanXxX69 yeah the component works on any actor, later in the course we even put it in a basic normal actor to make a chest :)
@@thegamedevcave YESSSS FOUND THE MISTAKE!!! I didn't connect the initial Execution line xDD 🙈 Now it works and I'm fascinated, I've been adding and removing Items now for like 15 mins straight xDDD PS: And great, looking forward to the chest! I will try to make use of it as a random drop and then evolve it into a random drop that the player gets passively every so often.
05:20 how did you add this node to make the white line go around?
it's a rerouting node. you can add one by just pulling off any other node and searching for reroute, I believe the shortcut for adding one on an existing line is ctrl+click but it's such muscle memory for me that i am not 100% on that XD
@@thegamedevcave Thanks! The reroute node worked for me (didn't understand it right in the video =)) and I somehow managed to pulled one off by ctrl+clicking but it only worked once so I need to butterfinger it a bit more :D Thanks alot! :D
Great tutorial. I opted for a data table system because of item instantiation. When you edit a data asset, that changes the value for every data asset, meaning something like an ammo value for a weapon will not work with dynamically instances items. Will there be a solution to this issue in future videos?
with this system you don't edit the data assets themselves. The data assets are used as read only object in this system, things like the amount of ammo you have is stores in the inventory slot instead. The same way I imagine you have to do with data tables, since those as a whole are read only assets too (you can't dynamically write to them).
if you get a lot more complex with your items (giving them meta data like enchantments and stuff) you can add an extra object to the inventory slot struct that can hold arbitrary data. But this series doesn't get in that deep.
@@thegamedevcave Yeah, I ended up creating an item struct with a string map for unique attributes and using it in a data table as a read only template.
@@MyBroWithValorant that's a pretty good workaround! do be mindful that reading (specifically comparing) strings is a pretty costly operation to do though. I doubt it's the kind of thing you'll have to do every frame/ multiple times a frame. if you set it all up in a clever way you'll probably only have to read from it every once in a while so it won't be a problem :) still, good to be mindful!
jo chief got a question. well its all working fine and i really like your tutorial series. the problem is, the item i chose is not showing up but i did the add item and also checked the add function 100 times. u have a clue what it could be?
strange issue, i'm not sure what's happening there but it sounds like your add item function might be running inside of a for loop or something maybe?
@@thegamedevcave i dunno :O
@@RevolverShotif you haven’t figured it out yet, I had the same issue. I had the set array element connected to true instead of false in the “add item” function. It should be false. After fixing that it works fine.
When adding the item to the inventory, why didn't you just get the total quantity of the items instead of adding the items one by one?
it makes some of the math later easier when merging together stacks and buying items from shops. It's not exactly optimal but it's also a very simple operation to doing it a number of times (unless you're stacking millions of items) won't actually matter and those systems become a lot less painful to program as a result. ideally, what you probably want is a simple "Add X: function as well as the "add 1" function that we have now though.