Jump to content

Inventory System


Slimwaffle
 Share

Recommended Posts

Hey guys I was working on a new inventory system for my game. And I was just wondering before I get too in depth with it. Is there a better or easier way I should be doing it?

Because I can see where its going in my head and it just seems like a lot of code. I will attach the script and a small video here so you can get the basic idea of where I am going with it.

Basically I want to be able to click and move everything from slot to slot. And the only info I can find on leadwerks is for systems that are a little more basic in functionality.

Inventory.lua

Link to comment
Share on other sites

I was purposely avoiding using widgets. I tried this once before and had issues mostly with the event handling.

So I figured doing it this way (calls to draw) that I would better be able to customise everything. The beauty of this method if I can get it working is that I can use any image shape or size I want.

Since posting this I have fixed it somewhat. Clicking and dragging items works. Would have preferred to be able to click on one slot then click on the next though. It needs some kind of trigger command that stops it from trying to pick up again or place down again when the mouse button is clicked. The problem is pressing the mouse in an if or while statement will trigger multiple times in the space of a single click.

I added in about 25 slots. At this stage I just have to figure out how I want new items to add to the list.

Link to comment
Share on other sites

The advantage of using a widget is the your inventory panel will work seamlessly with the GUI and you can upload the script for anyone to plug into their program, if you decide to go that route later.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I pretty much have this figured out using my original method of using draws. I just need to add some code that searches for an empty slot when first adding to inventory.Then to finish this script off just copy and paste for each new item I add.

It just seemed easier to write my own code from scratch rather then trying to edit someone else's code.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...