Jump to content
Sign in to follow this  
Tannerson

Items and Weapons Saving

Recommended Posts

Hey guys! I'am making a campaing and I wanted to include the weapons and items "saving" throughout missions, like in the official campaing. Is there a way to do it?:confused:

Thanks!:D

Share this post


Link to post
Share on other sites

Yes. You have to set in campaign's decription.ext: weaponPool = 1;

And then you have to put things (weapons, items, magazines) into the pool with these commands: addmagazinePool, addWeaponpool... etc.

But I found, I cannot add weapons to the pool before the first mission. It I add weapons to pool in the init.sqf it will not work in the first mission, only in the next one. But it's enough to you if you want only implement what is in the campaign: if you get weapons during the mission, you can bring it to the next one.

I create a script to detect what equipment player has and add all items into the pool (I will post it here when I'm back home) and you have to run that script at the end of your missions.

Share this post


Link to post
Share on other sites
//1ry weapon, ammo and accessory
if (primaryWeapon player != "") then {
addWeaponPool [format["%1",(primaryWeapon player)],1];
if (count (primaryWeaponMagazine player) > 0) then {
	addMagazinePool [format["%1",(primaryWeaponMagazine player) select 0], 8];
};
//optics
addItemPool [format["%1",(primaryWeaponItems player) select 2], 1];
};


//2ndry weapon, ammo
if (secondaryWeapon player != "") then {
addWeaponPool [format["%1",(secondaryWeapon player)],1];
if (count (secondaryWeaponMagazine player) > 0) then {
	addMagazinePool [format["%1",(secondaryWeaponMagazine player) select 0], 3];
};	
};

//backpack
if (backpack player != "") then {
//when backpack will works in pool:
//addWeaponPool [backpack player,1];
//..and items in backpack
{
	addWeaponPool [format["%1",_x],1];
	//addMagazinePool [format["%1",_x],1];
	//addItemPool [format["%1",_x],1];
} forEach backpackItems player;
};


//items
{
addItemPool [_x,1];
} forEach items player;
{
if (_x!="itemMap" and _x!="itemCompass" and _x!="itemWatch" and _x!="itemRadio") then {
	addItemPool [_x,1];
};
} forEach items player;

//vest
//if ((vest player)!="") then {
//	addWeaponPool [vest player,1];
//};


Share this post


Link to post
Share on other sites

Hi guys, hi bardosy,

as written in my PM, I added some things to your script.

Thanks again for the script base!

//Save the gear of the player and add it to the weapon pool.
//Code by Bardosi, complemented by Undeceived

//Primary weapon, ammo and accessories
if (primaryWeapon player != "") then {

   addWeaponPool [(primaryWeapon player), 1];

   if (count (primaryWeaponMagazine player) > 0) then {

	_number_magsPrimary_player = {_x in getArray (configFile >> "CFGWeapons" >> (primaryWeapon player) >> "magazines") } count (magazines player);

	addMagazinePool [(primaryWeaponMagazine player) select 0, _number_magsPrimary_player];

   };

   //Silencer:
   if ((primaryWeaponItems player) select 0 != "") then {addItemPool [(primaryWeaponItems player) select 0, 1]; };

//Laser:
   if ((primaryWeaponItems player) select 1 != "") then {addItemPool [(primaryWeaponItems player) select 1, 1]; };

//Optics:
if ((primaryWeaponItems player) select 2 != "") then {addItemPool [(primaryWeaponItems player) select 2, 1]; };

};


//Secondary weapon (which is the launcher, not the handgun!) + ammo
if (secondaryWeapon player != "") then {

addWeaponPool [(secondaryWeapon player), 1];

if (count (secondaryWeaponMagazine player) > 0) then {

	_number_magsSecondary_player = {_x in getArray (configFile >> "CFGWeapons" >> (secondaryWeapon player) >> "magazines") } count (magazines player);

	addMagazinePool [(secondaryWeaponMagazine player) select 0, _number_magsSecondary_player];

};

};


//Handgun, ammo and accessories
if (handgunWeapon player != "") then {

addWeaponPool [(handgunWeapon player), 1];

if (count (handgunMagazine player) > 0) then {

	_number_magsHandgun_player = {_x in getArray (configFile >> "CFGWeapons" >> (handgunWeapon player) >> "magazines") } count (magazines player);

	addMagazinePool [(handgunMagazine player) select 0, _number_magsHandgun_player];

};

//Silencer:
   if ((handgunItems player) select 0 != "") then {addItemPool [(handgunItems player) select 0, 1]; };

//Laser:
   if ((handgunItems player) select 1 != "") then {addItemPool [(handgunItems player) select 1, 1]; };

//Optics:
if ((handgunItems player) select 2 != "") then {addItemPool [(handgunItems player) select 2, 1]; };

};


//Backpack:
if (backpack player != "") then {

//Stuff in the backpack:
//Magazines:
_magsinbackpack = magazineCargo backpackContainer player;
{addMagazinePool [_x, 1]; } forEach _magsinbackpack;

//Items:
_itemsinbackpack = itemCargo backpackContainer player;
{addItemPool [_x, 1]; } forEach _itemsinbackpack;

//Weapons:
_weaponsinbackpack = weaponCargo backpackContainer player;
{addWeaponPool [_x, 1]; } forEach _weaponsinbackpack;

};


//Vest:
if (vest player != "") then {

//Stuff in the vest:
//Magazines:
_magsinvest = magazineCargo vestContainer player;
{addMagazinePool [_x, 1]; } forEach _magsinvest;

//Items:
_itemsinvest = itemCargo vestContainer player;
{addItemPool [_x, 1]; } forEach _itemsinvest;

//Weapons:
_weaponsinvest = weaponCargo vestContainer player;
{addWeaponPool [_x, 1]; } forEach _weaponsinvest;

};



//Uniform:
if (uniform player != "") then {

//Stuff in the uniform:
//Magazines:
_magsinuniform = magazineCargo uniformContainer player;
{addMagazinePool [_x, 1]; } forEach _magsinuniform;

//Items:
_itemsinuniform = itemCargo uniformContainer player;
{addItemPool [_x, 1]; } forEach _itemsinuniform;

//Weapons:
_weaponsinuniform = weaponCargo uniformContainer player;
{addWeaponPool [_x, 1]; } forEach _weaponsinuniform;

};

Edited by Undeceived

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×