Inventory engine for rpg

Looking to build a team or have a job to offer?

Post » Thu May 07, 2015 7:51 pm

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 :D
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri May 08, 2015 3:50 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 08, 2015 6:15 pm

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
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri May 08, 2015 6:27 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 08, 2015 7:39 pm

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.
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri May 08, 2015 7:41 pm

i think talking over skype would help alot faster too if you can add me
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri May 08, 2015 7:54 pm

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 :)
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 08, 2015 8:07 pm

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
B
10
S
1
Posts: 97
Reputation: 700

Post » Fri May 08, 2015 9:21 pm

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.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri May 08, 2015 9:49 pm

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.
B
12
S
3
Posts: 211
Reputation: 1,477

Next

Return to Job Offers and Team Requests

Who is online

Users browsing this forum: No registered users and 0 guests