Thank you, this tutorial paired up with your inventory tutorial explain how to work with ingame items very well. We need more tutorials like this that explain one part of unreal engine in detail. Keep it up
Thanks, glad you like it. I don't think I'll be making a video on that, as it is heavily dependent on what you are trying to make and not too complicated (depending on the goal). For example, a basic primary, secondary weapon system like in COD, is simply a boolean that you could add to the Data Asset & then in the player character you have a variable for primary another one for secondary. And just check that the boolean corresponds to the variable. For heavy weapons, it is the same process.
With a Data Asset inventory weapon system, how would you go about creating an ammo storage system for each individual weapon (and multiple iterations of)? For instance -> when weapons are unequipped with ammo in the mag, then later re-equipped. How would you account for that with a Data Asset type system?
So in the video I believe I explain that you don't want to use the data assets directly, they are only the "blueprint" for the weapon, and the only information they would have is MAX AMMO & MAGAZINE SIZE. So you would only be referencing them on reload or setting ammo back to max. For handling current ammunition any method is good, for example: A basic float or integer on your weapon component. If your weapon component is deleted when swapping, then a structure that is stored in the player character also works. If it is something like PUBG, ammo is separate from the weapon and is handled like any item in an inventory. I hope this helps point you in the right direction.
Hey bro, what if I didn't use the first person weapon component. At around 27:50 you attached the data asset info to it, and I don't have any components like that.
In that case, it depends on what you are using it for. You could use a widget instead if you are making a card game. As long as you have an intermediary object to copy the information over too and not directly modify the data asset.
@@patsanoob I don't really know what that means. I am doing a normal 3d game, but I made my own custom weapons and didn't use the complex nodes that the first person template already has.
The “complex nodes” in this case are the gun being created thats all you need. You expose the variable like we did and when you Spawn Actor from your own custom weapon and you can set the data asset. If you’re gun is a component you already equipped to you’re player then you can do the change in it’s default settings.
@@patsanoob I think I got it figured out, and thank you so much bro. If I make a tutorial about my inventory I'll definitely make sure to give you credit.
In my case, holding down the button does not cause a series of shots after picking up a fast weapon, it behaves here identically to the launch template, it only distinguishes the number of shots between fast and slow.
@@patsanoob The problem is that no matter which weapon I pick up, it behaves the same as the standard first-person template. Holding down the button doesn't result in firing a burst of bullets; instead, one press equals one shot. The only difference between weapons is the number of shots. I don't know, maybe I messed something up. I'll try to do it again tomorrow.
So I really don't understand the issue where the difference is the number of shots, as I didn't set anything that would limit the amount of shots you could do with a weapon. But for the fire-rate issue, I can only think of a few things: - Input Down is never set to true (33:15) - You might have used something instead of fire rate for the delay (30:10) - In the data assets you forgot to change the value () - The two weapons you placed have the same data asset (unlikely) Hope this helps
@@patsanoob I made the number of shots for each weapon myself, trying to slightly modify it to find the cause of the fire rate problem. Just now I recreated it from scratch on engine version 5.4.1, previously I was working on version 5.3.2. I didn't add anything of my own and everything works well only up to 30:00. If I change 'true' to 'false' in the weapon component in the branch, then it shoots in a series, each weapon shoots differently when I hold down the button, but when I release it, it continues to shoot, so I have some problem with the IA_Shoot. I added a print string in BP_FirstPersonCharacter after setting the variable InputDown to True and False, and when I press and hold it, both execute at the same time even though they shouldn't
Sorry it took me a while to respond. I would say it is a bit redundant, but it depends on what you are doing. If, for instance you absolutely need to associate a data asset with a name, you could just save them in a map instead of with a data table. But you could also just use a data table directly instead of the data assets all together.
So to add weapon switching, you would just need to add a second/third variable to track the "weapon component" and with mouse wheel you just change which one is currently visible. Hope this helps.
@@patsanoob Do I do this on BP_Pickup_Rifle or BP_WeaponComponent? (I'm sorry for asking so many questions, I am genuinely lost and under pressure on time)
The data assets should be treated as Read-Only and as such are identical on both client & server at all times, so there is no reason for them not to work for a replicated inventory system.
If you are having issues with the IMC not detecting the inputs, maybe try putting it in the player like I did as you may be facing the same issue (no clue why it happened though).
So reasons to use Data tables are if you are making something small in scale or especially if you are doing something that involves importing lots of data from something like Excel (.CSV). It just has risks with modifying the Structure used. For querying a "data table" you can use the "Get Data Table Row" function. For the inputs you can make a Variable of type "Data Table Row". Hope this helps
So instead of trying to explain, here is a very basic video on how it works (ua-cam.com/video/3VF41mAgG8w/v-deo.html). The only thing it doesn't cover is the "Data Table Row" variable type (that can be split because it is a structure).
@@patsanoob I his video I can see he simply queries one from a specific row. Is there a way to get multiple? Say all that have the column for gender being 'Male'?
I'm still on the fence about making a discord server, as I would prefer people just have all the tools at their disposal in one spot rather than having to go to another media just to find answers. But if you don't mind, feel free to share your issue and I will try and help.
@patsanoob8923 yea so, in trying to create a resident evil inventory system, when I pickup an item and it reaches 10 quantity and it does not want to make another array element when I want to pick up another item, where could have I messed up? I guess its something so small that I cannot notice it lol
So there are few things that could be causing this, but here is a list of the most likely issues: - Ensure that the data structure you modify in "AddItemFromFloor" is the L-ItemStructure. (59:10), you can also make sure that you are not calling the return node when you still have elements left - Make sure you do the bug fix for the "CheckRotationFit" (1:09:15) - And finally make sure the "WhereShapeFits" is correctly implemented (42:00) including the fix (1:16:30) I hope this helps! The overall issue lies in the "AddItemFromFloor" and all associated functions as they handle this situation.
This is not good. You are hard referencing a static mesh in a data asset (big no because of library bottlenecking), then using a BLOCKING load not async to load the entire data asset. 🤦♂️ Blocking loads are only meant to be used on Construction because Asynchronous actions cannot be performed. And again, never hard reference in data assets or tables. It’s just like growing a memory tumour.
Also on Add BP Weapon Component function it literally says “DO NOT CALL THIS MANUALLY”. I am sorry to come off rude but it really drives me nuts when people do not use tools properly themselves, and then teach others that way. 😩
You are right, I realized this in my next few videos that it was stupid. Although, I don't believe the load asset blocking is a big issue as long as you are not loading too much at once/ or large assets, but I should have mentioned it. As for the BP Weapon Component, isn't it an issue with being called in C++ and not in blueprint? Don't worry about it, I'd much rather be criticized, than keep making the same mistakes over and over. For me and everyone who watches.
@@patsanoob blocking load should really just be kept for constructors where async isnt possible. But with the Do not call manually EPIC themeselves does it in some of their own examples (namely physics control) so Ill let you off with a pass hahaha keep up the videos!
So from what I have understood it is better to use Async load whenever possible because it will avoid holding the rest of the logic while it loads an asset. In our case you probably wouldn't be able to tell because we are loading a few integers, but with something larger it could cause a "freeze" whilst the asset is loading.(if you use blocking load) Hope this helps.
Woah i didn't know about showing multiple data assets. Incredible!
Thank you, this tutorial paired up with your inventory tutorial explain how to work with ingame items very well. We need more tutorials like this that explain one part of unreal engine in detail. Keep it up
Thank you for this, I was having trouble fully understanding how to use data assets to drive actors that have functionality
Glad it helped you understand how they can be used!
Thank you for such a clear and usefull tutorial.
Glad you like the tutorial!
Awesome video! Could you do a tutorial on how to make a weapon inventory system with multiple weapon types like primary, secondary, heavy, etc?
Thanks, glad you like it. I don't think I'll be making a video on that, as it is heavily dependent on what you are trying to make and not too complicated (depending on the goal). For example, a basic primary, secondary weapon system like in COD, is simply a boolean that you could add to the Data Asset & then in the player character you have a variable for primary another one for secondary. And just check that the boolean corresponds to the variable. For heavy weapons, it is the same process.
TY ! Data assets are the better way.
With a Data Asset inventory weapon system, how would you go about creating an ammo storage system for each individual weapon (and multiple iterations of)? For instance -> when weapons are unequipped with ammo in the mag, then later re-equipped. How would you account for that with a Data Asset type system?
So in the video I believe I explain that you don't want to use the data assets directly, they are only the "blueprint" for the weapon, and the only information they would have is MAX AMMO & MAGAZINE SIZE. So you would only be referencing them on reload or setting ammo back to max.
For handling current ammunition any method is good, for example:
A basic float or integer on your weapon component.
If your weapon component is deleted when swapping, then a structure that is stored in the player character also works.
If it is something like PUBG, ammo is separate from the weapon and is handled like any item in an inventory.
I hope this helps point you in the right direction.
Amazing tutorial, have you ever thought about creating similar systems in unity?
I hadn't thought about it. But I already have a tight schedule, so adding re-learning unity to the degree I know Unreal would take up too much time.
Hey bro, what if I didn't use the first person weapon component. At around 27:50 you attached the data asset info to it, and I don't have any components like that.
In that case, it depends on what you are using it for. You could use a widget instead if you are making a card game. As long as you have an intermediary object to copy the information over too and not directly modify the data asset.
@@patsanoob I don't really know what that means. I am doing a normal 3d game, but I made my own custom weapons and didn't use the complex nodes that the first person template already has.
The “complex nodes” in this case are the gun being created thats all you need. You expose the variable like we did and when you Spawn Actor from your own custom weapon and you can set the data asset. If you’re gun is a component you already equipped to you’re player then you can do the change in it’s default settings.
@@patsanoob I think I got it figured out, and thank you so much bro. If I make a tutorial about my inventory I'll definitely make sure to give you credit.
In my case, holding down the button does not cause a series of shots after picking up a fast weapon, it behaves here identically to the launch template, it only distinguishes the number of shots between fast and slow.
Sorry for taking a while to answer this, what do you mean by it only distinguishes the number of shots?
@@patsanoob The problem is that no matter which weapon I pick up, it behaves the same as the standard first-person template. Holding down the button doesn't result in firing a burst of bullets; instead, one press equals one shot. The only difference between weapons is the number of shots. I don't know, maybe I messed something up. I'll try to do it again tomorrow.
So I really don't understand the issue where the difference is the number of shots, as I didn't set anything that would limit the amount of shots you could do with a weapon.
But for the fire-rate issue, I can only think of a few things:
- Input Down is never set to true (33:15)
- You might have used something instead of fire rate for the delay (30:10)
- In the data assets you forgot to change the value ()
- The two weapons you placed have the same data asset (unlikely)
Hope this helps
@@patsanoob I made the number of shots for each weapon myself, trying to slightly modify it to find the cause of the fire rate problem. Just now I recreated it from scratch on engine version 5.4.1, previously I was working on version 5.3.2. I didn't add anything of my own and everything works well only up to 30:00. If I change 'true' to 'false' in the weapon component in the branch, then it shoots in a series, each weapon shoots differently when I hold down the button, but when I release it, it continues to shoot, so I have some problem with the IA_Shoot. I added a print string in BP_FirstPersonCharacter after setting the variable InputDown to True and False, and when I press and hold it, both execute at the same time even though they shouldn't
@@patsanoob It's working now, we needed to add a new index Released in IA_Shoot under Triggers, by default there was only Pressed 🙂
hello and thank you for these amazing videos.
I have a question what if i put my data assets into a datatable 🤔
Sorry it took me a while to respond. I would say it is a bit redundant, but it depends on what you are doing. If, for instance you absolutely need to associate a data asset with a name, you could just save them in a map instead of with a data table. But you could also just use a data table directly instead of the data assets all together.
Question: How would you implement weapon switching using this format?
So to add weapon switching, you would just need to add a second/third variable to track the "weapon component" and with mouse wheel you just change which one is currently visible.
Hope this helps.
@@patsanoob I'm a bit lost, how exactly do you change the Data Asset that the Weapon Component needs when switching weapons?
You wouldn't change the data asset, you would have multiple weapon components instead. Which you then switch which one is active.
@@patsanoob Do I do this on BP_Pickup_Rifle or BP_WeaponComponent? (I'm sorry for asking so many questions, I am genuinely lost and under pressure on time)
@@patsanoob So do I need to create a second weapon component in the context of which weapon is picked up and visible on screen?
can we use this data assets on replicated inventory systems?
The data assets should be treated as Read-Only and as such are identical on both client & server at all times, so there is no reason for them not to work for a replicated inventory system.
Лучший
You BEST!
idk what i did to break it but it doesn't wanna shoot now
i was using the inventory tutorial but not sure where it messed up the imc is added but its not taking my left mouse clicks
This way of doing this would be amazing to see a more fleshed out way of doing it.
If you are having issues with the IMC not detecting the inputs, maybe try putting it in the player like I did as you may be facing the same issue (no clue why it happened though).
Are there any legitimate uses for data tables? I tried using them and added a bunch of data and I couldn't even query it.
So reasons to use Data tables are if you are making something small in scale or especially if you are doing something that involves importing lots of data from something like Excel (.CSV). It just has risks with modifying the Structure used.
For querying a "data table" you can use the "Get Data Table Row" function. For the inputs you can make a Variable of type "Data Table Row". Hope this helps
@@patsanoob Right on! Thank you for the reply. I'm still a bit confused on howto to query using Data Table Row? Could you provide anymore info?
So instead of trying to explain, here is a very basic video on how it works (ua-cam.com/video/3VF41mAgG8w/v-deo.html). The only thing it doesn't cover is the "Data Table Row" variable type (that can be split because it is a structure).
@@patsanoob Thanks bud!
@@patsanoob I his video I can see he simply queries one from a specific row. Is there a way to get multiple? Say all that have the column for gender being 'Male'?
can you make a discord server or something so people can troubleshoot your tutorials (I think I did something wrong)
I'm still on the fence about making a discord server, as I would prefer people just have all the tools at their disposal in one spot rather than having to go to another media just to find answers. But if you don't mind, feel free to share your issue and I will try and help.
@patsanoob8923 yea so, in trying to create a resident evil inventory system, when I pickup an item and it reaches 10 quantity and it does not want to make another array element when I want to pick up another item, where could have I messed up? I guess its something so small that I cannot notice it lol
So there are few things that could be causing this, but here is a list of the most likely issues:
- Ensure that the data structure you modify in "AddItemFromFloor" is the L-ItemStructure. (59:10), you can also make sure that you are not calling the return node when you still have elements left
- Make sure you do the bug fix for the "CheckRotationFit" (1:09:15)
- And finally make sure the "WhereShapeFits" is correctly implemented (42:00) including the fix (1:16:30)
I hope this helps! The overall issue lies in the "AddItemFromFloor" and all associated functions as they handle this situation.
This is not good. You are hard referencing a static mesh in a data asset (big no because of library bottlenecking), then using a BLOCKING load not async to load the entire data asset. 🤦♂️
Blocking loads are only meant to be used on Construction because Asynchronous actions cannot be performed. And again, never hard reference in data assets or tables. It’s just like growing a memory tumour.
Also on Add BP Weapon Component function it literally says “DO NOT CALL THIS MANUALLY”. I am sorry to come off rude but it really drives me nuts when people do not use tools properly themselves, and then teach others that way. 😩
You are right, I realized this in my next few videos that it was stupid. Although, I don't believe the load asset blocking is a big issue as long as you are not loading too much at once/ or large assets, but I should have mentioned it.
As for the BP Weapon Component, isn't it an issue with being called in C++ and not in blueprint?
Don't worry about it, I'd much rather be criticized, than keep making the same mistakes over and over. For me and everyone who watches.
@@patsanoob blocking load should really just be kept for constructors where async isnt possible. But with the Do not call manually EPIC themeselves does it in some of their own examples (namely physics control) so Ill let you off with a pass hahaha keep up the videos!
@@patsanoob is using async load data asset the right way ?
So from what I have understood it is better to use Async load whenever possible because it will avoid holding the rest of the logic while it loads an asset.
In our case you probably wouldn't be able to tell because we are loading a few integers, but with something larger it could cause a "freeze" whilst the asset is loading.(if you use blocking load)
Hope this helps.