Jump to content

Inventory object idea


Rick
 Share

Recommended Posts

So here is what I'm thinking for an inventory object that you can drag into your scene.

 

The inventory object would check for an existence of a sqlite db file. If it's not there it creates it.

 

You place an inventory object in your scene and assign it a target, making sure the target has a name assigned to it.

 

In general you would only give inventory to the player character, BUT if you wanted to give inventory to other NPC's you could. You would drag another inventory object in your scene and assign it a target.

 

This inventory object would be pretty specific. Because of this you'd have multiple kinds of inventory objects. Something like a FPS style like HL or a RGP style with bags. The inventory object would also provide the 2D HUD for it.

 

The reason the target needs a name is because that's what the inventory object uses when it queries the sqlite db table to figure out what items that character has.

 

The cool thing about this is it would persist through multiple scenes. To create a different scene you would just drag a character in your scene, give it the same name as the character in the last scene. Drag an inventory object to your scene and make the character it's target. Because the database would exists, the inventory object opens up the db and reads the table passing in the targets name, which because it's the same as the other scene it finds what it had from the other scene.

 

Thoughts? Gaps? Anything? I'm at work bored out of my mind :blink:

 

 

One of the cool reasons I like this is because it becomes very easy to test things out inventory wise. Let's say I'm creating a RPG dungeon scene. It becomes very easy to test out different inventory stuff. Each time I open my bags the inventory object would query the db and return the items. So if I'm inside an engine I can just have my sqlite client open and add inventory to the table that I can then use instantly for testing.

Link to comment
Share on other sites

Couldn't you accomplish the same thing, by adding a field to the Character/NPC Object. Then place THAT in the SQLlite file, and if the Character/NPC changes scenes it would persist?

 

Basically, HasBag == 1 dofile(BagObject)

 

or something to that effect.

 

Or even a field in the editor that you could name what inventory item that character has, which would load the Lua.Object file for that item, then add it to the SQLlite file

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Link to comment
Share on other sites

Well the issue is, the character object is an object just like any other. When you make a new scene you have to drag that character object in again. But that's a good point that the character object would also need a sqlite file to store off it's attributes so it can go through multiple scenes.

 

You could do what you are saying, but then for different inventory styles you would need different character types. Remember that the inventory object also does the 2D drawing of that inventory. So that can be very different between inventory styles. I'm trying to break this down to objects like I would in C++. In C++ I wouldn't include inventory code inside the character object. I would have a separate class to handle that because it becomes easier to plug and play different inventory styles and makes it more reusable.

Link to comment
Share on other sites

what I was thinking, was a property field called HasInventory. That boolen, dependant on the actual character and game type would set which lua script to handle that actual inventory part. Yes it would be multiple if - thens, but would lessen the time building scenes.

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Link to comment
Share on other sites

That's not a bad idea. Instead of a bool it could just be a file selector that lets you select the lua inventory file to use and it'll just run that lua file. The character would need to be the one to call all the functions though inside its functions that LE is calling. Like Update() and such. Plus that lua file might not be able to look the same as other objects because you'd have to recreate how LE does all that stuff. Something to think about though. I just love the idea of adding objects to a scene to make a game :lol: It's so easy and reusable.

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...