Inventory engine for rpg

0 favourites
From the Asset Store
130 high-quality sound effects of civilian and military aircraft engines.
  • Anyone willing to spare some freelance time I need someone to help building an inventory system for my game. I dont feel like spending money in the store(I dont have any) I wanna learn programming and why my way isn't working. all the tutorials mostly show arrays and stuff for inventory but dont fully show what i'm aiming for

    add me on skype "gryz34"

    Be my team player please

  • Learn arrays.

    Check the tutorial section for that and pick out a simple tutorial relating to arrays.

    After that do one of the inventory tutorials with arrays.

    Generally, you have 1 player inventory array determining what you have.

    And either another array or dictionary with all existing inventory items.

    Upon some action, an item is copied from the dictionary/array to the player inventory array.

  • yes i already know how arrays work but all the tutorials use only 1 array not 2 , so its hard for me to understand how to coordinate 2 arrays together. some tutorials are just not out there yet.... may sound simple but i've looked at all the tutorials and capxs and i still dont understand. you gave me some good ideas though that i will try doesn't hurt to go back and test things. still looking for someone to add me on skype

  • I generally use arrays based on their x index, and the Y placements having their items/names/ids/description/amounts.

    A really simple idea would be to have 1 big array with every item in it, and you use their x index as ID reference.

    example

    all items

    x,y

    0,1 = "sword"

    0,2 = swordstrength number

    1,1 = "shield"

    1,2 = shield strength number

    2,1 = "potionX"

    2.2 = potion health amount number

    Then you have 1 small array, where each item you posses take up a X index, where its Y(1) hold the id from the x based index of your total inventory array, and the Y(2) determine how many you have of them.

    Player Inventory

    x,y

    0,1 = 0 (x ID from the sword)

    0,2 = 3 (you have 3 swords)

    1,1 = 2 (x ID from the potion)

    1,2 = 10 (you have 10 potions)

    Thats the general idea.

  • https://www.scirra.com/tutorials/614/array-based-inventory/page-4

    I was looking at this inventory tutorial and added drag and drop to item but the instance doesn't change until i click again on the corresponding box

    AND

    Just got your message about how the 2 arrays are comparing each other , is that right?

    i noticed in my research that y is the array for stats, by the looks or Z i've seen arrays with X for item Y slot Z stats or something like that

    also i see that 1 = it doesn't have stats

    2= strength

    why isn't 0 used on the Y?

    and if i want more stats added like defense do i just raise the Y to however many stat variables i want

    also i see your example holding 3 swords i dont want that in 1 slot. like each sword or gear to only take 1 slot and each sword to have unique amount of def or str so each sword you get may be stronger or weaker

    according to when you pick it up it will roll round(random(1,60)

    thank you so much for your help!!!! its definately a nudge in the right direction for me. FYI i just started learning C2 strings and whatnot , last year i really was just messing with platforms and doing simpler stuff.

  • i think talking over skype would help alot faster too if you can add me

  • I used a 1 for the Y index instead of 0 just to make it more clear.

    Every X index can have an unlimited amount of Y entries and you can use them as you please

    ie

    x,0 = name

    x,1 = type

    x,2 = strength

    x,3 = shop price

    x,4 = level required

    etc

    In my example, I used the 3 swords, 1 is a reference to which item, and the amount is a total you hold, this would generally be represented by a number over the image, in this case, sword. It was an example.

    I hardly skype anymore lately.

    Just use the forums, lots of people willing to help if you ask the right questions and show your willing to do more then request for capx files for quick solutions

    Info provided to you in here, will most likely benefit others in the future too

  • yes i like your style of helping, rather than most people who want capx or send you to tutorials which aren't helpful if not explained well

    and you do EXPLAIN WELL!!!

    I guess i could add variable

    x,5 = stackable or make a boolean on the item?

    do you know what way is best , i'm leaning toward the boolean

  • With arrays you add text strings or numbers, you could use either as a boolean mechanic

    say

    x,5 = armed, where a 0 is not armed, and 1 is armed.

    If you reference that spot accordingly, say you have a gun at the 3rd X index, which states its armed status at the 5th Y.

    3,5 = 0

    Means your gun is not armed.

    Actually it should have been 2,4 = 0 according to my statement, seeing as arrays use a 0 based index, starting their count at 0 rather then 1.

    So keeping the zero based index in mind:

    2,4 = 1

    would mean your gun is armed.

  • What kind of inventory do you want to build? And if you understand how arrays work then building an inventory really shouldnt be a problem at all.

  • I want an inventory with drag and drop like the one in the store that is 40 dollars. Its not just knowing arrays I still need to know the instance variables to setup, system actions, and strings to use, and know how to set it all up. I also like to understand the sequence of actions so that i know whats going on than just messing around. Fireche somethings aren't as easy to some people especially when im more of a visual learner not a reader. which is why i asked for people to skype me and that way i can show through share screen whats going on, i think i'm close to my goal though . I like what lennaert said though its also nice to converse on the forums so that everyone can have this knowledge. feel free to jump in and share how you would tackle this problem

    thank you everyone for your thoughts

  • In this example that lennaert gave me wouldn't the inventory array 0,2 = check for swordstrength not the amount of the item? i just started creating these arrays and i ran into this question. sorry if this is a silly simple or obvious thing, bear with my dumbness. but i would think i need another Y variable in all items array for "amount" am i right?

    example

    all items

    x,y

    0,1 = "sword"

    0,2 = swordstrength number

    1,1 = "shield"

    1,2 = shield strength number

    2,1 = "potionX"

    2.2 = potion health amount number

    Then you have 1 small array, where each item you posses take up a X index, where its Y(1) hold the id from the x based index of your total inventory array, and the Y(2) determine how many you have of them.

    Player Inventory

    x,y

    0,1 = 0 (x ID from the sword)

    0,2 = 3 (you have 3 swords)

    1,1 = 2 (x ID from the potion)

    1,2 = 10 (you have 10 potions)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • oh shoot another dumb question where am i exactly assigning these x,y values?

    I was looking at this first image on this tutorial is this how its supposed to setup? is there an easier way to setup per item since i'm going to have tons of items?

    https://www.scirra.com/tutorials/614/array-based-inventory/page-3

  • There are ways to import data to arrays, JSON for example, or fetching info elsewhere with Ajax, or the dictionary.

    Otherwise an on start of layout can be used.

    The examples I gave with names and indexes do not relate to any tutorials, though there may be similarities.

  • ok now thats just confusing me cuz now i need to look up JSON and AJAX and all that

    i understand your indexes didn't relate to any tutorials i just saw that and was ... oh is that how i assign the x,y for each item and that would mean for alot of actions per each item

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)