Slimwaffle Posted December 30, 2018 Share Posted December 30, 2018 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. 2018-12-30_17-30-04.mp4 Inventory.lua Quote Link to comment Share on other sites More sharing options...
Josh Posted December 30, 2018 Share Posted December 30, 2018 You should use a custom widget script. This looks a little glitchy but otherwise good. Quote 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 More sharing options...
Slimwaffle Posted December 30, 2018 Author Share Posted December 30, 2018 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. Quote Link to comment Share on other sites More sharing options...
Josh Posted December 31, 2018 Share Posted December 31, 2018 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. Quote 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 More sharing options...
Thirsty Panther Posted December 31, 2018 Share Posted December 31, 2018 You could check out Aggrors FlowGUI program. Its a GUI for Leadwerks but also has an inventory system build in. At least it will give an idea how to get an inventory system to work. Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted December 31, 2018 Author Share Posted December 31, 2018 thanks for that. I will definitely be looking into aggror's FlowGUI. It pretty much does exactly what I want with things printed to the context. Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted January 2, 2019 Author Share Posted January 2, 2019 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. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.