Hey, sorry to post another thread so soon, however the last thread was very informative and helpful.
However, I have stumbled in a hole, and I require help to get out of it.
I've been working on a script that will:
1) Clear out my inventory
2) Spawn a preset load out
I will post it so you can see what I've done so far. (And if you can suggest better ways to improve the code I would appreciate that as well.)
// Spawn preset DayZ equipment into inventory
// by KaosNye
// Moday, June 25, 2012
// File: preset1.sqf
//-- -- -----------------------------------------------//
//---------------------------------------------------//
//------------------CLEAN INVENTORY------------------//
//---------------------------------------------------//
// Display hint
_title = "<t color='#ff0000' size='1.2' shadow='1' shadowColor='#000000' align='center'>CLEANING</t><br/><br/>";
_text = "your inventory.";
hint parseText (_title + _text);
// Removes all special items
removeAllItems player;
// Remove all weapons
removeAllWeapons player;
// Remove backpack contents **
//clearMagazineCargo ?
// Remove backpack
//removeBackpack player;
sleep 10;
//---------------------------------------------------//
//------------------SPAWN INVENTORY------------------//
//---------------------------------------------------//
// Display hint
_title1 = "<t color='#ff0000' size='1.2' shadow='1' shadowColor='#000000' align='center'>Preset 1</t><br/><br/>";
_text1 = "has been loaded!";
hint parseText (_title1 + _text1);
// Spawn magazine for M14 in loop
// Spawn first to avoid initial reload
{player addMagazine "20Rnd_762x51_DMR"} forEach [1,2,3,4];
// Spawn a M14 into player inventory
player addWeapon "M14_EP1";
// Spawn magazine for M9SD in loop
// Spawn first to avoid initial reload
{player addMagazine "15Rnd_9x19_M9SD"} forEach [1,2,3,4];
// Spawn a M9SD into player inventory
player addWeapon "M9SD";
// Spawn the tools/accessories for player
player addWeapon "Binocular_Vector";
player addWeapon "NVGoggles";
player addWeapon "ItemGPS";
player addWeapon "ItemCompass";
player addWeapon "ItemWatch";
player addWeapon "ItemFlashlightRed";
player addWeapon "ItemKnife";
player addWeapon "ItemHatchet";
player addWeapon "ItemMatchbox";
player addWeapon "ItemEtool";
player addWeapon "ItemToolbox";
// Spawn player backpack
player addBackpack "DZ_Backpack_EP1";
The code highlighted in red is the area I am having problems with. I believe this is the right command to use, but I am not sure the correct way to go about it.
The code highlighted in green, is working, but yet again, I am not sure the best way to group them together. I believe it's something like:
player addWeapon ["ItemGPS","ItemEtool",etc];
Edit:
//clearMagazineCargo ?player addWeapon "Binocular_Vector";
player addWeapon "NVGoggles";
player addWeapon "ItemGPS";
player addWeapon "ItemCompass";
player addWeapon "ItemWatch";
player addWeapon "ItemFlashlightRed";
player addWeapon "ItemKnife";
player addWeapon "ItemHatchet";
player addWeapon "ItemMatchbox";
player addWeapon "ItemEtool";
player addWeapon "ItemToolbox";Again, thanks for the help!