Announcement

Collapse
No announcement yet.

OPINION TOPIC-Generic Inventory Expansion Script

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • OPINION TOPIC-Generic Inventory Expansion Script

    Hi Guys,

    I just wanted to get some of your thoughts on or against the following idea I have for a script to simulate an inventory space where a player can store gear beyond his normal inventory. This idea started out as an idea for a backpack (which I miss from ArmA ACE mod), totally scripted of course, but changed into the following as I realized it would be very easy to create.

    Idea..

    Each player would get an ordnance crate (the small box ammo crate) to act as their extra inventory space (or "backpack" if you will). This ordnance crate could be deployed by the player at their location, allowing them to access it. After which they could pick it up again to bring with them.

    This crate would be local or client side to the player, only he could access its contents. A script would monitor all contents of the crate. The script will assign weight values to all man portable gear in ArmA 2. A predetermined weight for extra inventory will be set and when players attempt to add stuff to the crate which exceeds this weight, the item is deleted from the crate and readded to the player's inventory.

    Possible Optional feature (requires testing of my coding theory)...
    Upon death, this local crate and its contents could then be created globally for other players to access. This would allow a player's extra inventory to be accessed and hence would avoid the loop hole in the concept above of inventory being lost and not retrievable by other players on the server.

    So what do you think? Would you like your own personal ammo crate for a little extra gear?

    **EDIT**
    Hey, give me some examples of how much extra you think players should be able to carry? How much weight? This script could also include spare weapons.
    Last edited by GeneralCarver; 09-26-2009, 10:57 AM. Reason: misspells and more errors!
    Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity. - General George S. Patton.

  • #2
    Re: OPINION TOPIC-Generic Inventory Expansion Script

    Hell yeah, I would like some of that. "Carrying" a crate around seems also a pretty straightforward way to expand the inventory, since all the basic mechanics of putting gear in it and retreiving gear are already in the game. Even if it wouldn't be quite as handy as the ACE backpack system it'd be much much simpler to implement, and more often than not simplicity is for good.

    Comment


    • #3
      Re: OPINION TOPIC-Generic Inventory Expansion Script

      I experimented with the topic a little bit and wrote a small script that just allows you to "pack"(moves ammobox to the edge of the map) and "unpack"(moves the box in front of you) your "backpack"(a small ammobox), without any restrictions in size or weight yet, and it works great!

      A very good idea Carver :icon14:

      edit: How about using "deleteCollection" on the ammobox the make it invisible, and then placing another object directly on it which would act as the backpack? That would make it a bit more immersive than just unpacking an ammobox.
      Last edited by Fincuan; 09-26-2009, 11:42 AM.

      Comment


      • #4
        Re: OPINION TOPIC-Generic Inventory Expansion Script

        Hey good idea. Can you still access it when the collective is gone? What object would we use? Too bad there's not a single backpack. There is a backpack heap object.. but its a small mountain. lol. Not too useful.

        I can't think of any other object that would be better than crate. I'll take a look thru the editor object documentation and the editor and see if anything seems to fit this idea.
        Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity. - General George S. Patton.

        Comment


        • #5
          Re: OPINION TOPIC-Generic Inventory Expansion Script

          I didn't find anything suitable(a briefcase wast the closest lol), and also had some trouble getting things to work after using deleteCollection. It looks like a crate is indeed the best choice.

          If you went for an addon-version you could of course create your own ammocrate that looks like a backpack :)

          Comment


          • #6
            Re: OPINION TOPIC-Generic Inventory Expansion Script

            Maybe you can create the "backpack heap object" only showing the top of the heap by setpos?

            Sidenote:
            It would really great if the player has the backpack, it would simulate the weight. Slowing movement by only allowing such player to move in "crouched-walking" speed. Just a thought.

            TGU Instructor TG Pathfinder

            Former TGU Dean Former ARMA Admin Former Irregulars Officer

            "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

            Comment


            • #7
              Re: OPINION TOPIC-Generic Inventory Expansion Script

              Originally posted by LowSpeedHighDrag View Post
              ...

              Sidenote:
              It would really great if the player has the backpack, it would simulate the weight. Slowing movement by only allowing such player to move in "crouched-walking" speed. Just a thought.
              This is technically possible, but it would be complex to do.

              The BIS Battlefield Clearance module essentially does this, it puts the player into an animation FSM loop that rebinds their movement keys to the drag movement animations. Same for the AIS when you are incapacitated and are crawling on the ground, you cannot strafe or crawl backwards, only forwards.

              Not sure if this will require an addon or not, but it would definately be something to look into, though it will take quite a bit of work to accomplish.

              Comment


              • #8
                Re: OPINION TOPIC-Generic Inventory Expansion Script

                Personally I'm not interested in restructing player movement. We can just make sure they can only carry 20 or 50 pounds of extra gear, not like a full backpack of 70 pounds or 100. But if one of you wants to take a crack at it on your own.. of modifying what I make..be my guest.
                Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity. - General George S. Patton.

                Comment


                • #9
                  Re: OPINION TOPIC-Generic Inventory Expansion Script

                  man,... why the hell would BIS NOT put a backpack system in.. GOD! the more I think about it.. the more it makes me mad. lol. Dude, its a military game! Backpacks are like, used all the time!!

                  Any who, I looked at the backpack heap and its not really layout to accommodate the partial revealing of the top unit idea.
                  Last edited by GeneralCarver; 09-26-2009, 04:52 PM. Reason: more
                  Never tell people how to do things. Tell them what to do and they will surprise you with their ingenuity. - General George S. Patton.

                  Comment


                  • #10
                    Re: OPINION TOPIC-Generic Inventory Expansion Script

                    RMM_f_backpack
                    Code:
                    // (C) Rommel, 
                    // http://creativecommons.org/licenses/by-nc-sa/2.5/au/
                    ////////////////////////////////////////////////////
                    
                    	if (isDedicated) exitwith {};
                    	
                    	_fReset = {
                    		BIS_MENU_GroupCommunication = [
                    			["User menu", false],
                    			["Open backpack", [2], "", -5, [["expression", "[0] spawn RMM_f_backpack"]], "1", "1"]
                    		];
                    	};
                    
                    	_var = player getvariable "RMM_backpack";
                    	if (isnil {_var}) exitwith {
                    		player setvariable ["RMM_backpack", [[],[]], true];
                    	};
                    	if (count _this == 0) exitwith {
                    		[] call _fReset;
                    	};
                    	
                    	_invSlots = player call RMM_f_invSlots;
                    
                    	_blackList = [
                    		"Binocular","CDF_dogtags","Cobalt_File","EvDogTags","Evkobalt","EvMap","EvMoney","EvMoscow","EvPhoto",
                    		"ItemCompass","ItemCore","ItemGPS","ItemMap","ItemRadio","ItemWatch","Kostey_photos","Kostey_map_case",
                    		"Kostey_notebook","Laserdesignator","Laserdesignator_mounted","Moscow_Bombing_File","NVGoggles"
                    	];
                    	_weapons = (weapons player) - _blackList;
                    	_magazines = magazines player;
                    	_weaponsMax = (_invSlots select 4) + (_invSlots select 6);
                    	_magazinesMax = (_invSlots select 2) + (_invSlots select 3);
                    
                    	_switch = -1;
                    	if (count _this > 0) then {
                    		_switch = _this select 0;
                    	};
                    
                    	_item = "";
                    	_itemType = -1;
                    	if (count _this > 1) then {
                    		_item = _this select 1;
                    		_cfgM = count (configFile>> "CfgMagazines" >> _item);
                    		_cfgW = count (configFile>> "CfgWeapons" >> _item);
                    		if (_cfgM > 0) then {
                    			_itemType = 1;
                    		} else {
                    			if (_cfgW > 0) then {
                    				_itemType = 0;
                    			};
                    		};
                    	};
                    
                    	_idx = -1;
                    	if (count _this > 2) then {
                    		_idx = _this select 2;
                    	};
                    
                    	_fHint = {
                    		_img = "CA\ui\data\ui_action_gear_ca.paa";
                    		_text = parsetext (
                    			format ["<t size='3.0' color='#ffffff' shadow='0'><img image='%1'/> Oh No!</t><br />", _img] +
                    			format ["<t size='0.9' color='#eeeeee' shadow = '1'>%1, a %2 cannot fit in your backpack!<br />Try removing something first.</t>", name player, _this]
                    		);
                    		hint _text;
                    	};
                    	_fHint2 = {
                    		_img = "CA\ui\data\ui_action_gear_ca.paa";
                    		_text = parsetext (
                    			format ["<t size='3.0' color='#ffffff' shadow='0'><img image='%1'/> Oh No!</t><br />", _img] +
                    			format ["<t size='0.9' color='#eeeeee' shadow = '1'>%1, a %2 cannot be carried as you are too heavy.<br />Try removing something first.</t>", name player, _this]
                    		);
                    		hint _text;
                    	};
                    	
                    	switch (_switch) do {
                    		case 0 : {
                    			_idx = 2;
                    			_weaponTypes = [];
                    			if (count (_var select 0) < _weaponsMax) then {
                    				{
                    					if (not (_x in _weaponTypes)) then {
                    						_weaponTypes set [count _weaponTypes, _x];
                    					};
                    				} foreach _weapons;
                    			};
                    			_magTypes = [];
                    			if (count (_var select 1) < _magazinesMax) then {
                    				{
                    					if (not (_x in _magTypes)) then {
                    						_magTypes set [count _magTypes, _x];
                    					};
                    				} foreach _magazines;
                    			};
                    			_Menu = [["User menu", false]];
                    			{
                    				_Menu set [count _Menu, [format["- Put in %1", _x], [_idx], "", -5, [["expression", format["[1, %1] spawn RMM_f_backpack", str(_x)]]], "1", "1"]];
                    				_idx = _idx + 1;
                    			} foreach (_magTypes + _weaponTypes);
                    			_ruckTypes = [];
                    			{
                    				if (not (_x in _ruckTypes)) then {
                    					_ruckTypes set [count _ruckTypes, _x];
                    				};
                    			} foreach ((_var select 0) + (_var select 1));
                    			{
                    				_Menu set [count _Menu, [format["- Take out %1", _x], [_idx], "", -5, [["expression", format["[2, %1] spawn RMM_f_backpack", str(_x)]]], "1", "1"]];
                    				_idx = _idx + 1;
                    			} foreach _ruckTypes;
                    
                    			BIS_MENU_GroupCommunication = _Menu;
                    			showCommandingMenu "#USER:BIS_MENU_GroupCommunication";
                    			waituntil {speed player > 0};
                    			[] call _fReset;
                    		};
                    		case 1 : {
                    			_itemCount = if (_itemType == 0) then {count _weapons} else {count _magazines};
                    			_itemMax = if (_itemType == 0) then {_weaponsMax} else {_magazinesMax};
                    			if (_itemCount >= _itemMax) exitwith {_item call _fHint2};
                    			if (_item in (_weapons + _magazines)) then {
                    				_inRuck = _var select _itemType;
                    				if (count _inRuck < _itemMax) then {
                    					 if (_itemType == 0) then {player removeweapon _item} else {player removemagazine _item};
                    					_inRuck set [count _inRuck, _item];
                    					_var set [_itemType, _inRuck];
                    					player setvariable ["RMM_backpack", _var, true];
                    				} else {
                    					_item call _fHint;
                    				};
                    			};
                    			[0] call RMM_f_backpack;
                    		};
                    		case 2 : {
                    			_itemCount = if (_itemType == 0) then {count _weapons} else {count _magazines};
                    			_itemMax = if (_itemType == 0) then {_weaponsMax} else {_magazinesMax};
                    			if (_itemCount >= _itemMax) exitwith {_item call _fHint2};
                    			_inRuck = _var select _itemType;
                    			_idx = _inRuck find _item;
                    			if (_idx == -1) exitwith {};	
                    			_inRuck set [_idx, "^*&"];
                    			_inRuck = _inRuck - ["^*&"];
                    			_var set [_itemType, _inRuck];
                    			player setvariable ["RMM_backpack", _var, true];
                    			if (_itemType == 0) then {
                    				_primWeap = primaryWeapon player;
                    				if (_primWeap != "") then {
                    					[1, _primWeap] spawn RMM_f_backpack;
                    				};
                    				player addweapon _item;
                    			} else {
                    				player addmagazine _item;
                    			};
                    			[0] call RMM_f_backpack;
                    		};
                    	};
                    
                    ////////////////////////////////////////////////////
                    Ruck source
                    Code:
                    // (C) Rommel, 
                    // http://creativecommons.org/licenses/by-nc-sa/2.5/au/
                    ////////////////////////////////////////////////////
                    
                    	_gen = _this select 0;
                    	_caller = _this select 1;
                    	_id = _this select 2;
                    	
                    	if (_gen distance _caller > 3) exitwith {hint "You need to be closer.";};
                    	_gen removeaction _id;
                    
                    	//_caller playMove "AinvPknlMstpSlayWrflDnon_medic";
                    	//sleep 8;
                    
                    	hint "Press 0-8 to open your backpack";
                    	[] call RMM_f_backpack;
                    	
                    	sleep 10;
                    	_gen addaction ["Get a replacement backpack", "functions\ruckSource.sqf"];
                    
                    ////////////////////////////////////////////////////
                    Its only downside is the menu is a little clunky; and the menu may be over-ridden by COIN and SecOps. Which is why I may be developing a dialog for it in the near future. But for now, thats a working backpack which allows an extra weapon and ammunition to be stored (the maximums can be changed in the script easily).

                    RMM_f_invSlots
                    Code:
                    // (C) Rommel, 
                    // http://creativecommons.org/licenses/by-nc-sa/2.5/au/
                    ////////////////////////////////////////////////////
                    
                    	private ["_unit"];
                    	
                    	if (typename _this == "STRING") then {
                    		_unit = _this;
                    	} else {
                    		_unit = typeOf _this;
                    	};
                    
                    	_int = getNumber(configFile>> "CfgVehicles" >> _unit >> "weaponSlots");
                    	_return = [];
                    	{
                    		_i = floor (_int / _x);
                    		_int = _int - (_i * _x);
                    		_return set [count _return, _i];
                    	} foreach [131072, 4096, 256, 16, 4, 2, 1];
                    
                    	//_return = [%item slots%, %binocular slots%, %magazines%, %sidearm magazines%, %secondary weapons%, %sidearms%, %primary weapons%];
                    	_return
                    	
                    ////////////////////////////////////////////////////
                    The crate idea is ingenious enough, and I've done it before, but I just wanted to make this one a while back, so I did :P.
                    Idea for you: If you don't want a crate, have a look at weaponHolders, it would dump your weapons in a pile (its what happens when you put down a weapon, as a weapon must be a cargo or being used, can't exist in object space), but at least that makes more sense then a crate.
                    Last edited by CingularDuality; 10-18-2009, 08:12 AM. Reason: redacted email address

                    Comment


                    • #11
                      Re: OPINION TOPIC-Generic Inventory Expansion Script

                      Gentleman, we have managed to steal another great ArmAII player from the evil pub servers! mohahaha (insert mad scientist laugh here)

                      TGU Instructor TG Pathfinder

                      Former TGU Dean Former ARMA Admin Former Irregulars Officer

                      "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

                      Comment


                      • #12
                        Re: OPINION TOPIC-Generic Inventory Expansion Script

                        who are you talking about lowspeed?
                        FORMER 22ND RRR/FORMER 1ST JTOC/ ALWAYS A TACTICALGAMER


                        Spartan 4

                        Comment


                        • #13
                          Re: OPINION TOPIC-Generic Inventory Expansion Script

                          I think LowSpeed is under the impression Rommel was a pubby.

                          I think I'll have to sick my dog in him.

                          Comment


                          • #14
                            Re: OPINION TOPIC-Generic Inventory Expansion Script

                            Scope..."TG is a mature gaming community" haha
                            All the better, Rommel. Nevertheless, Good to see you here.

                            TGU Instructor TG Pathfinder

                            Former TGU Dean Former ARMA Admin Former Irregulars Officer

                            "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

                            Comment

                            Connect

                            Collapse

                            TeamSpeak 3 Server

                            Collapse

                            Advertisement

                            Collapse

                            Twitter Feed

                            Collapse

                            Working...
                            X