![]() |
Visual Inventory (GSD) - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49) +---- Thread: Visual Inventory (GSD) (/showthread.php?tid=216) |
Visual Inventory (GSD) - Matt - 31-07-2006 This wasn't here, or on the old forums, Spoon sent it to me, so I posted it. ^^ Visual Inventory Tutorial Created By: God Sent Death (Sean) This Code Might Have Slight Bugs In It, But It Shouldnt Be Too Hard To Figure Out How To Fix Them. ---------------------------------------------------------------------- Index ---------------------------------------------------------------------- I. Displaying The Inventory Pictures II. Click Any PicInv() To Display The Info (Relying On The Pics Instead) III. Removing Image When Item Dropped IV. Bringing Back To Item One V. Use Item Potion Fix And Updating Visual Inventory VI. (OPTIONAL)Double Click Item To Use It VII. Fin ---------------------------------------------------------------------- :::::::::::::::::::::: :::All In frmMirage::: :::::::::::::::::::::: --------------------------------------- make a timer called "VisInvTimer" interval = 50 enabled = false --------------------------------------- make 24 picture boxes (make as many as your max inventory) all control arrays(call them picInv) --------------------------------------- make another picture box called picItems AutoRedraw = true AutoResize = true Scale Mode = pixel Visible = false --------------------------------------- make 4 picture box (these will be your visual equiped items(Make as many as you want if you got more item equipment) name them: ArmorImage WeaponImage HelmetImage ShieldImage --------------------------------------- Make a picture box called picInv2 (This will be the selected item picture) --------------------------------------- make a label called IName (this will be the item name) --------------------------------------- :::::::::::::::::::::::::::::::::: :::THIS CODE IS ALL CLIENT SIDE::: :::::::::::::::::::::::::::::::::: ---------------------------------------------------------------------- I. Displaying The Inventory Pictures ---------------------------------------------------------------------- in the modGameLogic find: Code: Sub GameInit() Code: frmMirage.VisInvTimer.Enabled = True double click the timer in frmMirage (the one u made) add the following: Code: Dim Q As Integer ---------------------------------------------------------------------- II. Click Any PicInv() To Display The Info (Relying On The Pics Instead) ---------------------------------------------------------------------- Keep your original inventory list box, just make the visble = false double click on any picInv(), in there add: Code: Private Sub PicInv_Click(Index As Integer) ---------------------------------------------------------------------- III. Removing Image When Item Dropped ---------------------------------------------------------------------- in frmMirage double click lblDropItem in there you will see at the bottom: Code: End If right under that add: Code: PicInv(InvNum - 1).Picture = LoadPicture() ---------------------------------------------------------------------- IV. Bringing Back To Item One ---------------------------------------------------------------------- In frmMirage source add the following code at the very bottom: Code: Sub UpdateVisInv() in the drop item code at the bottom add: Code: Call UpdateVisInv now in the picInventory code at the bottom add (Or whatever you have to click on to open your inventory): Code: Call UpdateVisInv ---------------------------------------------------------------------- V. Use Item Potion Fix And Updating Visual Inventory ---------------------------------------------------------------------- Replace all the Use Item code for: Code: Call SendUseItem(lstInv.ListIndex + 1) ---------------------------------------------------------------------- VI. (OPTIONAL CODE) ---------------------------------------------------------------------- //DOUBLE CLICK TO USE ITEM\\ Code: Private Sub PicInv_DblClick(Index As Integer) //VISUAL EQUIPMENT\\ COMING SOON! ---------------------------------------------------------------------- VII. Fin ---------------------------------------------------------------------- - Krloz - 31-07-2006 It works there are no bugs ![]() ![]() - Matt - 31-07-2006 It wasn't on the old forums either. Hence, the reason I said it wasn't, so I posted it here. ^^ - Van - 31-07-2006 It was in the 25-tutorials in one thing on the old forums :wink: , it´s probably hard to find for new users so thanks for posting again. - RyanBlandin - 03-09-2006 Hey, I know its an old post but when I added this part of your tutorial: Code: Call BitBlt(PicInv(Q).hdc, 0, 0, PIC_X, PIC_Y, PicItems.hdc, 0, EDIT: Same with all this: Code: If Item(GetPlayerInvItemNum(MyIndex, lstInv.SelCount + D + e)).Name = "" EDIT2: And all of this: Code: Sub UpdateVisInv() EDIT3: Guess this doesn't work either. Code: If Item(lstInv.ListIndex + D).Type = ITEM_TYPE_POTIONADDMP Or It's probably me just being new to VB6 but if anyone could tell me what im doing wrong that would be great. - Matt - 03-09-2006 That's because, thanks to the word wrap feature, it wrapped parts of it, just move the parts after the ,'s back to the next line, and it should fix it. - RyanBlandin - 03-09-2006 Oooh. Thanks alot. ![]() - RyanBlandin - 03-09-2006 EDIT: NVM Fixed it myself. :oops: - Matt - 03-09-2006 Trace it, if it says that it's not defined, then apparently, it's not defined. Do a search for Dim InvNum as or something along those lines. It's not hard. - RyanBlandin - 03-09-2006 Yeah I did that for InvNum, but for my current problem it's goign to take alot longer. It's the variable "E" lol. Thanks for the help, I can probably fix this one on my own. - Leighland - 04-09-2006 Code: Dim e as long :wink: - RyanBlandin - 05-09-2006 Yeah I allready fixed it by adding that. Thanks though. - DarkX - 12-10-2006 Hey I know this is awhile back but I thought I would post something, for there are any who haven't figured this out. Ok after you added all of that code, if you notice the images don't load until you click on a picInv box, there's a way to fix this, and here's how I did it. find Code: Private Sub lblInventory_Click() Code: Private Sub lblInventory_Click() - Matt - 12-10-2006 Um, it all works perfectly for me. And as far as I know, it should already have that code in there. It should already update it. I'm going to make this tut look pretty here soon, so if it's not there, I will add it in, since I have a few other things to add in. - Robin - 13-10-2006 This is a pretty bad way to go around it... It's icky... all those picture boxes going everywhere... meh. T'is much better to just blt directly to picScreen. You can even mask them to get some cool effects. -Kite- - Matt - 13-10-2006 Well, this is the only method around, and works just fine. If you want to make a tut for that method and post it, then go ahead. - Robin - 13-10-2006 Ok. I will :twisted: - Matt - 13-10-2006 Lol. Good luck with it, though, won't it lag it a bit more? As that's even more to blit? - Robin - 13-10-2006 And BitBlting into 50 boxes isn't going to lag? As long as you know what you are doing it's easy. It won't lag too much, unless they have really crap pc's... but... meh =) - Matt - 13-10-2006 I like this method better, it looks neater. Imo. - Robin - 13-10-2006 I can think of neater stuff than 50 indexed picture boxes =) -Kite- - Matt - 13-10-2006 You do know that I mean it looks nice and neat, right? Not that it's better. Lol. - Robin - 13-10-2006 Personally I think it looks trashy, but we obviously have different views, so I will leave you to your picture boxes =) -Kite- - Matt - 13-10-2006 Lol, several major mmo's have it LOOKING like this. So, I think it's good. - Spodi - 14-10-2006 If you are going to use a picture box, then I'd have to agree with Kite on the single picture box, since then you can render a GUI around it. :wink: |