Using Data Asset for Weapons

Поділитися
Вставка
  • Опубліковано 23 лис 2024

КОМЕНТАРІ • 62

  • @skippyzk
    @skippyzk 3 місяці тому +3

    Woah i didn't know about showing multiple data assets. Incredible!

  • @lukaspellant5862
    @lukaspellant5862 8 місяців тому +1

    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

  • @jorrdan.
    @jorrdan. 2 місяці тому +1

    Thank you for this, I was having trouble fully understanding how to use data assets to drive actors that have functionality

    • @patsanoob
      @patsanoob  2 місяці тому

      Glad it helped you understand how they can be used!

  • @olliverkatana4168
    @olliverkatana4168 5 місяців тому +1

    Thank you for such a clear and usefull tutorial.

    • @patsanoob
      @patsanoob  5 місяців тому

      Glad you like the tutorial!

  • @pleasantlygrim6712
    @pleasantlygrim6712 7 місяців тому +2

    Awesome video! Could you do a tutorial on how to make a weapon inventory system with multiple weapon types like primary, secondary, heavy, etc?

    • @patsanoob
      @patsanoob  7 місяців тому +1

      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.

  • @Lewis-dq2xb
    @Lewis-dq2xb 8 місяців тому +2

    TY ! Data assets are the better way.

  • @thegrassyone1
    @thegrassyone1 3 місяці тому +1

    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?

    • @patsanoob
      @patsanoob  3 місяці тому +2

      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.

  • @firestorm_2048
    @firestorm_2048 7 місяців тому +1

    Amazing tutorial, have you ever thought about creating similar systems in unity?

    • @patsanoob
      @patsanoob  7 місяців тому

      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.

  • @Solo_Shade_Games
    @Solo_Shade_Games 2 місяці тому +1

    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.

    • @patsanoob
      @patsanoob  2 місяці тому

      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.

    • @Solo_Shade_Games
      @Solo_Shade_Games 2 місяці тому

      @@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.

    • @patsanoob
      @patsanoob  2 місяці тому

      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.

    • @Solo_Shade_Games
      @Solo_Shade_Games 2 місяці тому

      @@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.

  • @raven1439
    @raven1439 7 місяців тому +1

    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
      @patsanoob  7 місяців тому

      Sorry for taking a while to answer this, what do you mean by it only distinguishes the number of shots?

    • @raven1439
      @raven1439 6 місяців тому

      @@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.

    • @patsanoob
      @patsanoob  6 місяців тому

      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

    • @raven1439
      @raven1439 6 місяців тому

      @@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

    • @raven1439
      @raven1439 6 місяців тому

      @@patsanoob It's working now, we needed to add a new index Released in IA_Shoot under Triggers, by default there was only Pressed 🙂

  • @Gokword
    @Gokword 8 місяців тому +1

    hello and thank you for these amazing videos.

  • @dogamer238
    @dogamer238 Місяць тому +1

    I have a question what if i put my data assets into a datatable 🤔

    • @patsanoob
      @patsanoob  28 днів тому

      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.

  • @Damstructions-funny
    @Damstructions-funny 6 місяців тому +1

    Question: How would you implement weapon switching using this format?

    • @patsanoob
      @patsanoob  6 місяців тому

      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.

    • @Damstructions-funny
      @Damstructions-funny 6 місяців тому

      @@patsanoob I'm a bit lost, how exactly do you change the Data Asset that the Weapon Component needs when switching weapons?

    • @patsanoob
      @patsanoob  6 місяців тому

      You wouldn't change the data asset, you would have multiple weapon components instead. Which you then switch which one is active.

    • @Damstructions-funny
      @Damstructions-funny 6 місяців тому

      @@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)

    • @Damstructions-funny
      @Damstructions-funny 6 місяців тому

      @@patsanoob So do I need to create a second weapon component in the context of which weapon is picked up and visible on screen?

  • @GAMEDEV_PRO
    @GAMEDEV_PRO 7 місяців тому +1

    can we use this data assets on replicated inventory systems?

    • @patsanoob
      @patsanoob  7 місяців тому +1

      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.

  • @ГасанИсмаилов-н6и
    @ГасанИсмаилов-н6и 7 місяців тому +1

    Лучший

  • @bekonyX26
    @bekonyX26 8 місяців тому +1

    You BEST!

  • @pHaace
    @pHaace 6 місяців тому +1

    idk what i did to break it but it doesn't wanna shoot now

    • @pHaace
      @pHaace 6 місяців тому

      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

    • @pHaace
      @pHaace 6 місяців тому

      This way of doing this would be amazing to see a more fleshed out way of doing it.

    • @patsanoob
      @patsanoob  6 місяців тому +1

      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).

  • @SS-gu2tx
    @SS-gu2tx 6 місяців тому

    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.

    • @patsanoob
      @patsanoob  6 місяців тому

      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

    • @SS-gu2tx
      @SS-gu2tx 6 місяців тому

      @@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?

    • @patsanoob
      @patsanoob  6 місяців тому +1

      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).

    • @SS-gu2tx
      @SS-gu2tx 6 місяців тому

      @@patsanoob Thanks bud!

    • @SS-gu2tx
      @SS-gu2tx 6 місяців тому

      @@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'?

  • @nikolaaa7180
    @nikolaaa7180 8 місяців тому +1

    can you make a discord server or something so people can troubleshoot your tutorials (I think I did something wrong)

    • @patsanoob
      @patsanoob  8 місяців тому

      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.

    • @nikolaaa7180
      @nikolaaa7180 8 місяців тому

      @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

    • @patsanoob
      @patsanoob  8 місяців тому

      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.

  • @jacksonblack3809
    @jacksonblack3809 3 місяці тому +3

    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.

    • @jacksonblack3809
      @jacksonblack3809 3 місяці тому +1

      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. 😩

    • @patsanoob
      @patsanoob  3 місяці тому +1

      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.

    • @jacksonblack3809
      @jacksonblack3809 3 місяці тому +2

      @@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!

    • @goblinman3010
      @goblinman3010 Місяць тому

      @@patsanoob is using async load data asset the right way ?

    • @patsanoob
      @patsanoob  Місяць тому +1

      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.