RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System
RPG Inventory System and Equipment System RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
Go Back  Xtreme Visual Basic Talk > > > RPG Inventory System and Equipment System


Reply
 
Thread Tools Display Modes
  #1  
Old 08-14-2012, 01:34 PM
magnite7 magnite7 is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default RPG Inventory System and Equipment System


Hey guys, I've been working on a RPG game in VB 2010 and I've gotten to the point where I am adding items and giving them properties but I'm a bit confused and stuck. I currently have a form with 28 picture boxes and 28 'inventory settings & amounts' (inv1, inv2, etc) and on loading the inventory form the pictures are updated accordingly to the setting and a number below it to show the amount you currently have of the item. Then I want to be able to click the items and it "equips" it which will then show up on a different form called the 'Character Screen'.

Here is some of my current coding for it:

Inventory updating on load
Code:
        If My.Settings.inv4 = "fvisage" Then
            inv4.Image = My.Resources.fVisage
            inve4.Text = My.Settings.fvisage
        ElseIf My.Settings.inv4 = "draBody" Then
            inv4.Image = My.Resources.draBody
            inve4.Text = My.Settings.drabody
        ElseIf My.Settings.inv4 = "dralegs" Then
            inv4.Image = My.Resources.draLegs
            inve4.Text = My.Settings.dralegs
        ElseIf My.Settings.inv4 = "draboots" Then
            inv4.Image = My.Resources.draBoots
            inve4.Text = My.Settings.draboots
        ElseIf My.Settings.inv4 = "drahelm" Then
            inv4.Image = My.Resources.draHelm
            inve4.Text = My.Settings.drahelm
        ElseIf My.Settings.inv4 = "clothbody" Then
            inv4.Image = My.Resources.clothBody
            inve4.Text = My.Settings.clothbody
        ElseIf My.Settings.inv4 = "clothlegs" Then
            inv4.Image = My.Resources.clothLegs
            inve4.Text = My.Settings.clothlegs
        ElseIf My.Settings.inv4 = "clothboots" Then
            inv4.Image = My.Resources.clothBoots
            inve4.Text = My.Settings.clothboots
        ElseIf My.Settings.inv4 = "clothhat" Then
            inv4.Image = My.Resources.clothHelm
            inve4.Text = My.Settings.clothhat
        ElseIf My.Settings.inv4 = "plaBody" Then
            inv4.Image = My.Resources.plaBody
            inve4.Text = My.Settings.plabody
        ElseIf My.Settings.inv4 = "plalegs" Then
            inv4.Image = My.Resources.plaLegs
            inve4.Text = My.Settings.plalegs
 'etc......
         ElseIf My.Settings.inv4 = "en50" Then
            inv4.Image = My.Resources.pow50
            inve4.Text = My.Settings.en50
        ElseIf My.Settings.inv4 = "en100" Then
            inv4.Image = My.Resources.pow100
            inve4.Text = My.Settings.en100
        ElseIf My.Settings.inv4 = "poke" Then
            inv4.Image = My.Resources.poke
            inve4.Text = My.Settings.Poke
        End If
Gaining item loot from a fight and it being stored in the first open inventory slot
Code:
If My.Settings.inv2 = "" Or My.Settings.inv2 = "fvisage" Then
                                    My.Settings.inv2 = "fvisage"
                                    My.Settings.fvisage = My.Settings.fvisage + 1
                                    MsgBox("You gained: " + fgold.ToString + " gold" & vbNewLine & "You gained: " + _
fExp.ToString + " experience." & vbNewLine & "You gained: " + fExp.ToString + " experience." & vbNewLine & "You've also found a Flaming Visage!", vbOKOnly, "Loot")

                                ElseIf My.Settings.inv3 = "" Or My.Settings.inv3 = "fvisage" Then
                                    My.Settings.inv3 = "fvisage"
                                    My.Settings.fvisage = My.Settings.fvisage + 1
                                    MsgBox("You gained: " + fgold.ToString + " gold" & vbNewLine & "You gained: " + _
fExp.ToString + " experience." & vbNewLine & "You've also found a Flaming Visage!", vbOKOnly, "Loot")

                                ElseIf My.Settings.inv4 = "" Or My.Settings.inv4 = "fvisage" Then
                                    My.Settings.inv4 = "fvisage"
                                    My.Settings.fvisage = My.Settings.fvisage + 1
                                    MsgBox("You gained: " + fgold.ToString + " gold" & vbNewLine & "You gained: " + _
fExp.ToString + " experience." & vbNewLine & "You've also found a Flaming Visage!", vbOKOnly, "Loot")
'etc.....
                                ElseIf My.Settings.inv20 = "" Or My.Settings.inv2 = "fvisage" Then
                                    My.Settings.inv20 = "fvisage"
                                    My.Settings.fvisage = My.Settings.fvisage + 1
                                    MsgBox("You gained: " + fgold.ToString + " gold" & vbNewLine & "You gained: " _
+ fExp.ToString + " experience." & vbNewLine & "You've also found a Flaming Visage!", vbOKOnly, "Loot")

                                Else
                                    MsgBox("You gained: " + fgold.ToString + " gold" & vbNewLine & "You gained: " + _
fExp.ToString + " experience." & vbNewLine & "Due to lack of inventory space, you had to leave the Flaming visage behind.", vbOKOnly, "Better than nothing!")
                                End If

This is my "equip" method that occurs when clicking one of the picture boxes
it is in a switch case that switches to, in this perticular case, what is stored in my.settings.inv2. The whole 'Elseif my.settings.inv2 = x then' thing was suppossed to be for in cases where you already have a item equipped in that slot but that seems to not work and I can't seem to grab the 'item' from the character screen and bring it back to the inventory screen without causing a problem.
Code:
http://pastebin.com/x4KCNCAa

Now, I know my code is very inefficient and long and probably overall unnecessary but I'm stuck and confused and have no idea what I should be doing. By looking at this could anyone please be able to teach me a more efficient and easier method of doing this? I tried creating a new class and making a function, that I'd be able to call on in a different form, to find the next available slot starting with inv2 (inv1 always has gold in it no matter what, even if you have 0 gold) but that didn't work cause I again didn't even know where to start.

Thank you in advance and I hope you all have a great day.

PS. For those who don't know pastebin is a online notepad of sorts made specially for code, I put my code in there so that it wouldn't take up the whole thread, and I didn't see a rule against posting the link, but if there is then I'm sorry I didn't see it.

Last edited by passel; 08-14-2012 at 10:38 PM.
Reply With Quote
  #2  
Old 08-14-2012, 02:16 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default rpg in vb.net

Hi magnite7, and welcome to the forum.

Quote:
Originally Posted by magnite7
I've been working on a RPG game in VB 2010..
Good to here.
I haven't seen a really good example of this yet.
Quote:
Originally Posted by magnite7
I currently have a form with 28 picture boxes
That's probably about 27 picturebox too many.
Have you ever read anything about using backbuffers..?
(It looks like you are trying to use sprite sheets maybe).
Have you looked at how texturebrush is used in the sprite sheet code attached to this passel post.

A well written class could replace long if-then-else blocks using an indexed data approach.
I see you posted some class code in this social.msdn posting.
There is also a magnite7 on the dream-in-code site (Robert Stivanson) who posted some similar code.

Even some use of arraylists code might be helpful.
Also just found this stackoverflow thread that suggested using interface code for developing an rpg game in vb.net.

More than your code I'd be interested in some prospective (even faked up) screenshots
of what you image the the interface would look like.
What type of dragging behaviors would be involved?
I could see grid of inventory equipment sprites and then maybe
drag and drop the sprites onto the character's body outline diagram.

It doesn't have to be as fancy as something from DungeonSiege,
but maybe something Diablo-style.
(that's old Diablo style, not Diablo3 inventory style).

Have you read any other tutorials on making an RPG using .Net?
Here one, even though its in C#.Net, it tries to cover the basics.

Last edited by surfR2911; 08-14-2012 at 03:57 PM.
Reply With Quote
  #3  
Old 08-14-2012, 02:33 PM
magnite7 magnite7 is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default

This is what I wanted them to look like, Character screen on the left and Inventory screen on the right (Different forms).
There wouldn't be any dragging, just clicking the item and I wanted it to equip it and show it in the CScreen and if there is any item already equipped it will come back to the Inventory.
Never heard of backbuffers.
Attached Images
File Type: png Inventory.png (17.7 KB, 20 views)

Last edited by passel; 08-14-2012 at 10:11 PM. Reason: Remove link to page McAfee regards as exhibiting risky behavior
Reply With Quote
  #4  
Old 08-14-2012, 03:53 PM
magnite7 magnite7 is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default

Quote:
Originally Posted by surfR2911 View Post
Hi magnite7, and welcome to the forum.

Good to here.
I haven't seen a really good example of this yet.
That's probably about 27 picturebox too many.
Have you ever read anything about using backbuffers..?
(It looks like you are trying to use sprite sheets maybe).
Have you looked at how texturebrush is used in the sprite sheet code attached to this passel post.

A well written class could replace long if-then-else blocks using an indexed data approach.
Even some use of arraylists code might be helpful.

More than your code I'd be interested in some prospective (even faked up) screenshots
of what you image the the interface would look like.
What type of dragging behaviors would be involved?
I could see grid of inventory equipment sprites and then maybe
drag and drop the sprites onto the character's body outline diagram.

It doesn't have to be as fancy as something from DungeonSiege,
but maybe something Diablo-style.
(that's old Diablo style, not Diablo3 inventory style).

Have you read any other tutorials on making an RPG using .Net?
Here one, even though its in C#.Net, it tries to cover the basics.

This is the layout that I have designed, character screen on the right and inventory on the left. (different forms)

I'm not using sprite sheets its a simple click game not a walk around game, kinda like the browser game Gladiatus, click the building and a form designating for that building will appear giving you options so on and so forth. Mainly because I don't know how to do sprites and movement yet, still learning.

I didn't want there to be any dragging and dropping I just wanted the item to be clicked and it would be equipped and if there were any items already equipped in that slot then it would be move to the Inventory.

I tried using that class as a new base for my inventory system but I couldn't seem understand, and got confused very easily. If you'd mind explaining that to me in a little more detail I'd be greatly appreciative.

Nah, haven't read any other tutorials cause I like to try to teach myself, but occasionally I hit a brick wall have to ask or look something up, like this for example.

P.S. I posted a reply before this but it hasn't seem to have gone through.
Attached Images
File Type: png Inventory.png (17.7 KB, 12 views)

Last edited by passel; 08-14-2012 at 10:12 PM. Reason: Attach image, rather than link
Reply With Quote
  #5  
Old 08-14-2012, 10:34 PM
passel's Avatar
passelRPG Inventory System and Equipment System passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,028
Default

Quote:
Originally Posted by magnite7 View Post
...PS. For those who don't know pastebin is a online notepad of sorts made specially for code, I put my code in there so that it wouldn't take up the whole thread, and I didn't see a rule against posting the link, but if there is then I'm sorry I didn't see it.
We would prefer if you posted either snippets of your code that you have a question on, or if you feel that whole routines or projects need to be referenced, then zip them up and attach the zip file.
Don't zip or attach any executables, i.e. .exe, .obj, .dll, .ocx etc...

You can also attach the png and jpg files.
The two main reasons for posting or attaching here is:
1. External links often become dead links and future readers of the thread will not have the context to make the thread meaningful.
2. External links have a greater chance of being malicious. McAfee gave warning about the site you originally posted your png picture on as exhibiting dangerous behavior.

If you don't see the "Manage Attachments" button below the reply window a little ways down the page, you probably did a quick reply. Just select "Go Advance" to get more options, including the "Manage Attachments" button if you need to attach a file.
Attached files are required to be less than 2MB in size.
You can only have 10,000 characters in a post.
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #6  
Old 08-15-2012, 07:26 AM
magnite7 magnite7 is offline
Newcomer
 
Join Date: Aug 2012
Posts: 4
Default

Quote:
Originally Posted by passel View Post
We would prefer if you posted either snippets of your code that you have a question on, or if you feel that whole routines or projects need to be referenced, then zip them up and attach the zip file.
Don't zip or attach any executables, i.e. .exe, .obj, .dll, .ocx etc...

You can also attach the png and jpg files.
The two main reasons for posting or attaching here is:
1. External links often become dead links and future readers of the thread will not have the context to make the thread meaningful.
2. External links have a greater chance of being malicious. McAfee gave warning about the site you originally posted your png picture on as exhibiting dangerous behavior.

If you don't see the "Manage Attachments" button below the reply window a little ways down the page, you probably did a quick reply. Just select "Go Advance" to get more options, including the "Manage Attachments" button if you need to attach a file.
Attached files are required to be less than 2MB in size.
You can only have 10,000 characters in a post.
You're right I was quick replying, and that makes a lot of sense. I will do that from now on, thank you for the information.
Reply With Quote
  #7  
Old 08-15-2012, 03:42 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default Using a simple RPG game to move into .Net programming -- taking baby steps.

Quote:
Originally Posted by magnite7
I'm not using sprite sheets its a simple click game not a walk around game,
kinda like the browser game Gladiatus, clicking the building and a form designating for that building will appear
giving you options so on and so forth.
Mainly because I don't know how to do sprites and movement yet, still learning.
Oh no!
Even the Gladiatus-type game you describe probably has much
behind the scenes code logic tracking the buildings (graohic sprite images)
as well as the forms and the dialog options list.

Just to let you know:
In general RPG games are sort of at the top of the "game hierarchy"
pyramid of games you can program.

Most newbie programers start out with
1.) console and text (non-graphical) games.
2.) Then they proceed onto games with minimal (usually stick figure) graphics, like hangman.
3.) Then they might try something more ambitious like a "matching" game,
where you flip over "cards" containing either the standard card faces,
or simpler type of graphic symbols, to see if you can get a matching pair.
4.) Then they will try a retro arcade game like breakout,
using very primitive graphics with some movement and collision detection.
5.) Then they'll move onto some more advanced arcade games like Pacman that requires
some battling..likely an attack system with A.I.(artificial intelligence) algorithms used,
as well as sprite movement.
6.) Then they might look at using multi-layer sprites in a card games like
Solitaire, Poker, or Blackjack (that usually have an embedded "rule set")..
7.) Finally they might be ready to tackle a very primitive sort of role playing game.

A truly advanced commercial rpg game, of course, uses not only very advanced
graphics (2,5D isometric perspective tiling or full 3D), but also
involves many many behind the scenes databases
and advanced concepts like
NPC (non-player-character) walking/flocking A.I., dialogs, conversational dialogs, and non-linear plot pathing.

I could try to explain the tutorial but if you haven't even mastered sprites you really need to do that first.
I'm sorry to have to say that, but if you were designing an office-type app,
like a front end to a database, then graphics are not so very important,
but for high quality games, users have certain expectations and, well,
(fortunately or unfortunately) your game will be judged
on both the quantity and quality of your graphics.

As a programmer you may not be able to crank out really nice
images,
but you can make you code as robust as possible,
with being able to handle quantities of graphics both efficiently and adeptly.
Quote:
Originally Posted by magnite7
This is what I wanted them to look like, Character screen on the left and Inventory screen on the right (Different forms).
One of the great things about doing game programming
is that you have such a wide latitude in terms of how you configure the game.

I like to use the K.I.S.S method - Keep it Simple Stupid
Don't purposely go out of your way to make things hard on yourself.

Why use two forms when you can put everything on one form?
(or the other way or looking at it:
"Why do I really need two forms - what's the justification for adding
that extra level of complexity?"
Hopefully not just so you can keep the two panels "straight" in your own mind.

It will not only make the coding a lot less involved to use a single form,
but give the option of dragging later on (without a lot of tedious
code re-factoring later on if you decide to go with ahead that option).

Using managed .Net coding you probably don't realize this, but
at a lower level dragging between two forms
is much much more involved than dragging within a single form
because a single form has a single hWnd and a single hDC (handle to a device context).

Dragging between two forms involves at least two hWnds (Window handles)
and 3 hDCs (Form1, Form2, and the desktops graphic "space").
This is inevitably involve handling/coding for multiple Paint events even
at the level of using managed .Net code.

So getting back to what I was saying above..
Before you go any further with this project
you need to be able to be able to work with sprites off of sprite sheets.
This is really game programming 101 stuff.

All the code structures behind the scenes (whether class base or just using arrays/indexing) are
probably going to be tied in with multiple sprites (irregular outline graphics) shown
on screen (possible using a class later on..but not at first..baby steps..)

Look for some tile map examples.
They will give you the basics if passel's texturebrush example is too
involved.

There's some code attached post #57 of the VB_Alien's "copying tiles from a sheet" thread,
download it, run it, and see if you can wrap your head around the code.

Quote:
edit:
Also, I seem to remember that code loaded the graphics from a file
but there is a special way you can actually "tuck"
your graphics (including sprite sheets) inside your VB.Net project (as a "resource").
Saves you having to worry about file pathing IO code.

I wrote out (longhand) a set of instructions in post #31 of the Viewer
thread..look down the post a bit for the section entitled:
"So here's my 'little' set of mini-instructions".
When you are ready to post your .Net project/solution (or best attempt even if not quite working right),
do as passel says, deleting any .exe and .dlls from the bin/obj sub-folders first,
and then zip up the whole thing,
(see below if you don't know how to do that).

First click on the "Manage Attachments" button,
(below where you text edit your forum posts
scroll down your browser window a bit to find it),
and then click on the click on the "Browse" button
(that appears at the top of the browser window/tab that pops up)
to select the zip file for upload.

If you don't have any installed program for easy zipping,
I like to use oldapps 3.71 version of WinRar
(less nag screens than more current versions).

Once it's installed you right click on the top level folder you want to zip,
then select "WinRar -> add to archive"
from the cascading right click context popup menu),

Then when the WinRar "Archive name and parameters" dialog box appears
use/click on the radio (option) button for "Zip", and press the "OK" button.

The zip file that is created well be found in the folder one level up (above)
the folder you first right clicked on.

Last edited by surfR2911; 08-15-2012 at 05:02 PM.
Reply With Quote
  #8  
Old 09-11-2012, 11:15 PM
surfR2911 surfR2911 is offline
Contributor
 
Join Date: Oct 2009
Posts: 719
Default RPG Inventory System UI sample

Well, it's been a while and it looks like magnite7 isn't going
to post any code.

I hate when threads end up with no working code so based on the "Inventory.png" screenshot that magnite7 posted above
I tried to come up with a working sample,
(see screenshot attached below for comparison)

I started an "outlier" thread here to explore using
a.m.t.a.r. (active mouse tracking w/array of rects)
and
r.e.p.l.a.m (rect positioning locator array matrix)
to come with a demo that didn't use any picturebox controls or panels
and only one form.

The demo has a few options not obvious from the screenshot
so please download and try it out.
The rects will show highlighting as you mouse over them
and clicking in a any rect will move the coin sprite to that square.
Attached Images
File Type: jpg screenshot_M7_RPGIS_sample5.JPG (68.3 KB, 16 views)
Attached Files
File Type: zip _M7_RPGIS_sample5.zip (24.3 KB, 12 views)

Last edited by surfR2911; 09-11-2012 at 11:20 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
 
RPG Inventory System and Equipment System
RPG Inventory System and Equipment System
 
-->