Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th Jul 2011 18:55
I've been wondering this for quite awhile now so here is the question. How do I get DBPro to read data and use the data in ways like stats, inventory, ect...




I wasn't sure how to use the ObjectID var.

Anyway, how would I get DBPro to read the data?


Cheers.

God help me, Please.
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 27th Jul 2011 21:38
Quote: "how would I get DBPro to read the data?"

I don't realy understand what data you want to read.
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th Jul 2011 21:42
Lets say that I have an inventory, how do I get the inventory to know what items the player has and to post the stats of that item?


Cheers.

God help me, Please.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 27th Jul 2011 21:47
If I've interpreted this right, then you need to have a separate array, or file, with the item properties. Then you link the item id with the array of properties.

Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 27th Jul 2011 21:49 Edited at: 27th Jul 2011 21:51
I would suggest making an array wich holds all the items the player has:


edit
I see you have an array holding the data of the items

So instead of itemType as string your can use itemType as integer
where the itemType is the index of the BluePrint array.
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th Jul 2011 21:49 Edited at: 27th Jul 2011 21:50
@Indicium
Could I get an example of this being done, please?


Cheers.

God help me, Please.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 27th Jul 2011 21:54
Well, this is a pretty basic example, but hopefully you'll get the idea, and hopefully it's what you're looking for.



I hope that makes sense.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th Jul 2011 22:03
@Max P
So something like this:




@Indicium
I see. So for an inventory to give the player that item or to know that the player has 1+ or none of the item, would I need something like:




Cheers.

God help me, Please.
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 27th Jul 2011 22:23
I hope I'm not misunderstanding you but I made this for you
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 27th Jul 2011 22:34
Yes, that could also work. There's never only one answer when programming something, my friend.

2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 27th Jul 2011 23:04
@Max P
Thank you so much!
I have some questions:
Quote: "For i=0 to array count( playerInventory(-1) )
if playerInventory(i).id = itemID
inc playerInventory(i).count, count
exitfunction
endif
Next i
"


Why is there a -1 in the parenthesis? Do I even need the WeaponID var that I made or only the id var that you made?

Quote: "For i=0 to 10
addItemToInventory( rnd(2)+1 , rnd(10) )
Next i"

The part in the parenthesis, why are they there?
These are probably simple so I'm sorry for the dumb questions and Thanks!


@Indicium
Oh thanks!

God help me, Please.
Max P
16
Years of Service
User Offline
Joined: 23rd Jan 2010
Location:
Posted: 27th Jul 2011 23:23
Quote: "Why is there a -1 in the parenthesis"

No need for the -1, my mistake

Quote: "
For i=0 to 10
addItemToInventory( rnd(2)+1 , rnd(10) )
Next i
"


The rnd(10) is the amount of items you want to add to the inventory.
The rnd(2)+1 is the item you want to add.
The itemID is the place in the blueprint array where the weapon data is located
So using a 1 for the itemID will add the longsword, 2 will add the bow and 3 the dagger.

In the function I first loop through the inventory to check if the item is already in the inventory,
if it already is there we increase the current count of the item and exit the function.
if it isn't there we will insert a new item at the bottom of the array.


If you don't get the itemID's then take a close look at this part:


Quote: "
Do I even need the WeaponID var that I made
"

Nope, actually.. you only need my code
2Beastmode4u
15
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 28th Jul 2011 01:32
Thank you for everything guys! I finally can make inventories!


Cheers.

God help me, Please.

Login to post a reply

Server time is: 2026-07-10 15:31:40
Your offset time is: 2026-07-10 15:31:40