Announcement

Collapse
No announcement yet.

Has any one done a RPG Inventory in BP?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Has any one done a RPG Inventory in BP?

    Hi everyone
    I am looking for someone who has possibly done a RPG system in BP. The kind where if I pick up an item my stats change.
    I have a system I have done that works but its getting a little tedious.
    I wanted to know if anyone could possibly help me or just tell me this is the way it has to be done before I go any further with it.
    I originally made a video for someone but I haven't heard back in several days. If you have time check this video out and if you could help me that would be great!
    Thanks!
    https://www.youtube.com/watch?v=qGjeH1ghrLk

    #2
    You can plug your array into a ForEachLoop and have it combine all the stats from all equipped items in your array into whatever variable your character uses.

    Something like this:
    Click image for larger version

Name:	8bef8ae8f0b490e6bf9cfbc247ae9ba7.png
Views:	1
Size:	213.1 KB
ID:	1053355

    Both of those do the exact same thing, I just added both for clarity. You can just as easily break your struct array after the loop and use the same pass through the loop to set all your different stats. The first Set PlayerHealth intializes it before doing anything, otherwise it would just keep adding to it every time you change anything.

    Comment


      #3
      Thanks! I have one question. Is it possible to add to an array like this? Click image for larger version

Name:	array.png
Views:	1
Size:	171.1 KB
ID:	1053356
      What I need to do is update the one variable in the array while not affecting the others but still have it loop so I don't have to plug the others in.

      Comment


        #4
        You can keep the rest of them the same by just passing the same unmodified value into the new one.

        Although if the stat is just 0 on your item, you can add it to the overall stats and it wont change. Like if you wanted to have the same loop change all your different stats at once.

        Comment


          #5
          I have tried this many different ways but I am not having any luck getting it to actually work. It might be the way I have it set up but its not feeding the correct numbers and when I am equipping stuff its not subtracting the correct values.
          I will for now revert to the way I have gotten to work but it is very tedious.
          Click image for larger version

Name:	array.png
Views:	1
Size:	239.3 KB
ID:	1053357
          The different numbers in the array represent each slot of inventory. I have to store the number that item gave me so I can subtract it.
          I was hoping it would be as easy as just connecting the break array to the store array for the ones where I don't have to modify the numbers.
          Click image for larger version

Name:	array2.png
Views:	1
Size:	263.7 KB
ID:	1053358
          And then the for each loop I was having trouble getting to work right.
          Click image for larger version

Name:	array3.png
Views:	1
Size:	223.5 KB
ID:	1053359
          I need it to pull all 4 numbers for the array and just store them.
          The first picture shows how it actually works. I was just hoping I could figure out the trick. Sorry if this is easy, I am a novice and still trying to understand. I may have everything coded in the wrong way and am making it harder on myself.
          Thanks for trying to help me though.

          Comment


            #6
            This is as complex as it really needs to be: Click image for larger version

Name:	5f3bcf8ab44f3326fa286d29a3321384.png
Views:	1
Size:	482.4 KB
ID:	1053360

            I added comments about what each section does and this will work for however many items you want to have equipped.
            This is something that should happen when you drag and drop an item into an equipment slot for example.
            It adds up all the stats of all the items you have equipped every time you equip something new (if an item has a crit stat of 0, it just adds a 0 and the value remains the same)
            The only other thing you really need is to get the stats of the item from the item somehow.

            Also having an array of structs is easier to work with than having a struct of arrays.

            Comment


              #7
              Wow! Yea I think the way I am doing it is completely backwards! I have it setup and running already though so I will leave it as is. I will eventually need a more complex system and I will use this as a reference. Appreciate it!

              Comment

              Working...
              X