Author: code34
Author Website:

Requirements: No addons required

Version: 0.2

Short description: object oriented inventory save/restore

Support the author:

100% of your donation goes directly to the author of this content!
Date: 2015-01-07 15:47


Comments: (0)
Rating:



 





Object Oriented inventory

by
code34


Description:
OO INVENTORY is a class (object oriented) that permits to simply save/restore very easily the inventory of a unit. That can be usefull, for example, to create a loadout script, restore the inventory after the death of player, tranmists inventory to other unit, etc. This class uses Object Oriented SQF scripting of Naught and doesn't require any addons, or any insertions in description.ext


Features:
clear inventory of a unit
load/save inventory of a unit


Installation / Usage:
put the "oo_camera.sqf" and the "oop.h" files in your mission directory
put this code into your mission init.sqf:
call compilefinal preprocessFileLineNumbers "oo_camera.sqf";

See example mission in directory: init.sqf

Example:
call compilefinal preprocessFileLineNumbers "oo_inventory.sqf";
	// create a new inventory 
	_inventory = ["new", []] call OO_INVENTORY;

	// save the inventory of player
	["save", player] call _inventory;

	sleep 2;

	// clear the inventory of player
	 ["clear", player] call _inventory;	

	sleep 2;

	// load the inventory of player to player
	["load", player] call _inventory;

	sleep 2;

	// retrieve inventory and copy it to clipboard
	_loadout = "getInventory" call _inventory;
	copytoclipboard str(_loadout);

	// reverse way, set the inventory
	["setInventory", _loadout] call _inventory;

	// load the inventory on  other civil guy called "toto"
	["load", toto] call _inventory;	

	["delete", _inventory] call OO_INVENTORY;
	hint str("getInventory" call _inventory);



Notes:
GitHub: https://github.com/code34/oo_inventory.altis
Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling


License / Disclaimer:
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author.


Changelog:
v0.2
- add accessors set/get
- rebuild constructor
- add doc

v0.1
- OO_INVENTORY - from combat-assault.eu mission


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: No tags