Dear friends. I have made an example of a first level with Email3lang which contains a simple inventory, type Adventure game, i.e. the player collect items and use them on objects in the scene to go on. I like to explain here how to make its features.
Features of the inventory:
- it prints the items of the inventory as text to the screen if a key is pressed,
- it adds objects from the scene with mouse click to the inventory when the player is near to the object,
- taken objects can be put back to their original place when the player is near to it,
- taken objects will disappear from the scene and will stay disappeared when the scene is reloaded,
- inventory will be saved to level 2,
- status of the ‘objects which can be taken’ will be used to trigger s.th., p.e. a message,
- objects of the inventory can be used on objects in the scene to trigger s.th., p.e. open a locked door with a key from the inventory.
Features of the demo .blends:
See Contents beneath of Credits
Desadvantage of this inventory:
Each kind of “getable item” needs an own keyboard key (or a combination of two), which limits the amount of them in the game.
If you like to see my progress with this issue, visit https://blenderartists.org/forum/showthread.php?413884-Start-making-an-inventory-accessed-by-keys&p=3139628&viewfull=1#post3139628 Start making an inventory accessed by key.
Credits :
- My starting point for the inventory has been: https://blenderartists.org/forum/showthread.php?308604-how-to-make-a-store-inventory&p=2470987&viewfull=1#post2470987 / Naxela and Kheetor, thank you both.
- Special thanks to the Blender team and the Blender artists community.
The .blend which I will explain in this thread till post#7 can be found here: https://blenderartists.org/forum/showthread.php?408743-Email-account-with-3-languages-and-manual&p=3129809&viewfull=1#post3129809 / The related credits too.
The explanations from Email3lang_ex1stLvl_01.blend are taken out of a greater context as the one in the demo .blend.
At the bottom of this post you can find a little demo .blend which I made to show the elementary code of the inventory in one piece and how it works. For some details of it see chapter ### Preliminary ###. I put also some commentaries in the module file. And I made some progresses with that demo, described in post #12 till #19.
### Contents ###
Preliminary -> 3129829
Initializing the inventory
Printing the inventory to screenMaking the text disappear
Increasing the text resolution
Foreword to the get object from the scene to the inventory procedure -> 3130146How the order of scenes is organized
Adding an object from the scene to the inventory -> 3130150
Adding an object to the scene from layer 2 -> 3130152
How works 'def init():'Hiding the objects in the inventory from the scene
Using status of the objects which can be taken to trigger s.th. -> 3130155
Dropping an object from the inventory back to its origin
Using objects of the inventory on objects of the scene -> 3130159Features of the demo .blends:
Dropping an item of the inventory to more than one place -> 3130471Making items stackable in the inventory -> 3131524
How to interact with a container -> 3132468Showing a message if the player tries to drop an item to the ground
To interact with Box_01 -> 3132476
Using textwrap.fill to show the inventory -> 3132815
How to show an object name with mouse over any
How to get an certain “added object, part 1” -> 3133122
How to get an certain “added object, part 2” -> 3134355
How to sort a dictionary by key or value
In the next post we will start with some preliminaries.
Greetings,
achisp
A simplified Demo.blend made with Blender 2.74, which I will describe from post #12 to #19:
(For the descriptions from post#1 till post#7 I have used another .blend, the link is above.)
Revision history:
2016-12-23.: SimpleInventory_Demo_06.blend
- Moved Logic bricks from object on 2. layer to player object. Details and .blend see here -> 3133122
2016-12-22.: SimpleInventory_Demo_05.blend
-
Amplified: (1.) textwrap.fill() is used for the inventories; (2.) The item names are shown with Mouse over any. Details and .blend see here -> 3132815
2016-12-21.: SimpleInventory_Demo_04.blend
-
Amplified: Interaction with a container is added. Details and .blend see here -> 3132468
2016-12-19.: SimpleInventory_Demo_03.blend
-
Amplified: The item is stackable in the inventory. Details and .blend see here -> 3131524
2016-12-16.: SimpleInventory_Demo_02.blend
-
Amplified: The same item can be dropped/taken at two points in the scene. Details and .blend see here -> 3130471
2016-12-20.: SimpleInventory_Demo_012.blend
-
Rebuild of the .blend with module file from Demo_011
2016-12-16.: SimpleInventory_Demo_011.blend
-
Correction of the commentaries to homekey_add(cont): .
2016-12-14.: SimpleInventory_Demo_01.blend
Attachments
SimpleInventory_Demo_012.blend (540 KB)