Author: austin(medic)
Author Website:

Requirements: No addons required

Version: 1.0

Short description: Inventory system to use custom items.

Date: 2015-11-28 17:52


Comments: (0)
Rating:



 

Inventory System

by
austin(medic)


Description:
This inventory system allows you to define some custom objects that you can use, without them actually existing in the game itself.


Installation:
Simply merge the stuff in the scripts folder, merge description.ext and drag over the defines.hpp if one doesn't already exist, and the inventory.hpp. Drag the inventory_functions folder into the main directory. An example mission is also included.


Usage:
How can I bring up the inventory menu?
This can be done by adding a simple action to the init.sqf:
player addAction["Inventory",{createDialog "AUSMD_inventory";}];

How to Add your own Items:
Add your item and its weight into the master array (will be inside init.sqf).
e.g
masterArray = 
[
	["Item1",2],
	["Item2",1],
	["myNewItem",5],
	["Default",0]
];

If you want your item to have functionality when its used, you'll need to go into the
functions folder and modify the useItem script.

Add your item's functionality into the code, you could also put in a call/spawn/execVM to another script that will run the code if you like instead of putting it here.
e.g
switch(_item) do
{
	case "Item1": {hint "Item1 Used";};
	case "Item2": {hint "Item2 Used";};
	case "myNewItem": {hint "code-to-run-goes-here";};
	default {hint "Item usage not defined.";};
};

How can I give an item on the ground functionality?
You can pass some parameters for the item you want on the ground to the droppedItem function. This should be done after the mission has started (e.g spawn a sleep followed by the below code.)
e.g
[container that will act as the object to get the action, your item, amount of the item]
nul = [] spawn {sleep 1;[myBox,"myNewItem",2] call AUSMD_fnc_droppedItem;};


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Inventory