splatsh 10 Posted February 16, 2010 I am using this code to save my weapons and magazine and my rucksack. I am saving this to my respawn. while {true} do { waitUntil {!alive player}; _weapons = weapons player; _magazines = magazines player; waitUntil {alive player}; _p = player; removeAllItems _p; removeAllWeapons _p; {_p addMagazine _x} forEach _magazines; {_p addWeapon _x} forEach _weapons; _primw = primaryWeapon _p; if (_primw != "") then { _p selectWeapon _primw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); _p selectWeapon (_muzzles select 0); }; }; But how do I save what I have inside my rucksack? Share this post Link to post Share on other sites
mosh 0 Posted February 16, 2010 http://forums.bistudio.com/showpost.php?p=1513983&postcount=336 http://ausarma.org/forum/viewtopic.php?f=29&t=158&view=next I have been looking into this myself, those links might help but I haven't tried it yet... Share this post Link to post Share on other sites
splatsh 10 Posted February 16, 2010 I am no good in script and code, but what I have now is working OK for me. This is what I have: Initfield on every man: null = [] execVM "player_getName.sqf"; gear=compile preprocessfile "squadGear.sqf"; [this] call gear; null = [] execVM "player_reloaded.sqf"; null = [] execVM "ruck_reloaded.sqf"; player_getName.sqf // player_getName.sqf while {true} do { waitUntil {!alive player}; _Name = Name Player; waitUntil {alive player}; _p = player; {_p setName _x} forEach _Name; }; squadGear.sqf private["_u"]; _DumpAmmo={ waituntil{!isNull _this}; _u= _this; removeallweapons _u }; _Add_Team_Spec_Leader={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_VTAC_RUSH72"; _u addweapon "ACE_HuntIR_monitor"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addMagazine "ACE_HuntIR_M203"; _u addMagazine "ACE_HuntIR_M203"; _u addmagazine "SmokeShell"; _u addMagazine "1Rnd_HE_M203"; _u addMagazine "1Rnd_HE_M203"; _u addMagazine "1Rnd_HE_M203"; _u addMagazine "1Rnd_HE_M203"; _u addMagazine "SMAW_HEAA"; _u addMagazine "SMAW_HEAA"; _u addweapon "M16A4_ACG_GL"; _u setVariable ["ACE_weapononback", "SMAW"]; _u selectWeapon "M16A4_ACG_GL"; [_u, "ACE_Battery_Rangefinder", 1] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "ACE_30Rnd_556x45_T_Stanag", 10] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "ACE_HuntIR_M203", 8] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "pipebomb", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SmokeShell", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SMAW_HEAA", 5] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; _Add_Team_Spec_Medic={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_Rucksack_MOLLE_ACU_Medic"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_30Rnd_556x45_T_Stanag"; _u addmagazine "ACE_m34"; _u addmagazine "SmokeShell"; _u addmagazine "SmokeShell"; _u addweapon "ACE_M4A1_ACOG"; _u setVariable ["ACE_weapononback", "SMAW"]; _u selectWeapon "ACE_M4A1_ACOG"; [_u, "ACE_30Rnd_556x45_T_Stanag", 20] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SmokeShell", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "ACE_m34", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; _Add_Team_Spec_MG={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_Rucksack_MOLLE_ACU"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "100Rnd_762x51_M240"; _u addmagazine "SmokeShell"; _u addMagazine "SMAW_HEAA"; _u addweapon "ACE_M240G_M145"; _u setVariable ["ACE_weapononback", "SMAW"]; _u selectWeapon "ACE_M240G_M145"; [_u, "100Rnd_762x51_M240", 5] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SmokeShell", 2] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "ACE_m34", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SMAW_HEAA", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; _Add_Team_Spec_AT={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_Rucksack_MOLLE_Wood"; _u setVariable ["ACE_weapononback", "ACE_Rucksack_MOLLE_Wood"]; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "SMAW_HEAA"; _u addmagazine "SMAW_HEAA"; _u addmagazine "SMAW_HEAA"; _u addmagazine "SmokeShell"; _u addweapon "ACE_M4A1_ACOG"; _u addweapon "SMAW"; _u selectWeapon "ACE_M4A1_ACOG"; [_u, "SMAW_HEAA", 5] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "30Rnd_556x45_Stanag", 6] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; _Add_Team_Spec_AA={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_Rucksack_MOLLE_Wood"; _u setVariable ["ACE_weapononback", "ACE_Rucksack_MOLLE_Wood"]; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "30Rnd_556x45_Stanag"; _u addmagazine "Stinger"; _u addweapon "ACE_M4A1_ACOG"; _u addweapon "Stinger"; _u selectWeapon "ACE_M4A1_ACOG"; [_u, "Stinger", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "30Rnd_556x45_Stanag", 5] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; _Add_Team_Spec_Sniper={ waituntil{!isNull _this}; _u= _this; _u addweapon "ACE_Rucksack_MOLLE_Wood"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "ACE_20Rnd_762x51_T_M110"; _u addmagazine "30Rnd_9x19_MP5"; _u addmagazine "30Rnd_9x19_MP5"; _u addmagazine "ACE_m34"; _u addmagazine "Smokeshell"; _u addmagazine "Smokeshell"; _u addweapon "ACE_M110"; _u setVariable ["ACE_weapononback", "ACE_MP5A4"]; _u selectWeapon "ACE_M110"; [_u, "ACE_m34", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "SmokeShell", 3] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "ACE_20Rnd_762x51_T_M110", 10] call ACE_Sys_Ruck_fnc_AddMagToRuck; [_u, "30Rnd_9x19_MP5", 10] call ACE_Sys_Ruck_fnc_AddMagToRuck; }; if(!isNil "a1")then{ _u=a1; _u call _DumpAmmo; _u call _Add_Team_Spec_Leader; }; if(!isNil "a2")then{ _u=a2; _u call _DumpAmmo; _u call _Add_Team_Spec_Medic; }; if(!isNil "a3")then{ _u=a3; _u call _DumpAmmo; _u call _Add_Team_Spec_Sniper; }; if(!isNil "a4")then{ _u=a4; _u call _DumpAmmo; _u call _Add_Team_Spec_MG; }; if(!isNil "a5")then{ _u=a5; _u call _DumpAmmo; _u call _Add_Team_Spec_AT; }; if(!isNil "a6")then{ _u=a6; _u call _DumpAmmo; _u call _Add_Team_Spec_AA; }; player_reloaded.sqf // player_reloaded.sqf while {true} do { waitUntil {!alive player}; _weapons = weapons player; _magazines = magazines player; waitUntil {alive player}; _p = player; removeAllItems _p; removeAllWeapons _p; {_p addMagazine _x} forEach _magazines; {_p addWeapon _x} forEach _weapons; _primw = primaryWeapon _p; if (_primw != "") then { _p selectWeapon _primw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); _p selectWeapon (_muzzles select 0); }; }; ruck_reloaded.sqf // ruck_reloaded.sqf _hasruck = false; _ruckType = ""; _ruckMags = []; _ruckWeps = []; while {true} do { if (alive player) then { _hasruck = player call ACE_Sys_Ruck_fnc_hasRuck; if (_hasruck) then { _ruckType = player call ACE_Sys_Ruck_fnc_FindRuck; _ruckMags = player getVariable "ACE_RuckMagContents"; _ruckWeps = player getVariable "ACE_RuckWepContents"; //hint format ["%1", _ruckType]; }; } else { waitUntil {alive player}; sleep 1; if (_hasruck) then { player addWeapon _ruckType; player setVariable ["ACE_RuckMagContents", _ruckMags, true]; player setVariable ["ACE_RuckWepContents", _ruckWeps, true]; }; }; sleep 1; }; I have only tryed this one time, and it worked, I spawned with my weapons and with rucksack and with my items inside the rucksack. Maybe someone could build a more simple and more useful code than my code here... Share this post Link to post Share on other sites
splatsh 10 Posted February 18, 2010 I have tested and I did make one new code to respawn with rucksack and weapons. But this code is just for players, (me, one person) How to make all in my squad to use this code? // player_reloaded.sqf while {true} do { waitUntil {!alive player}; _weapons = weapons player; _magazines = magazines player; _ruckType = player call ACE_Sys_Ruck_fnc_FindRuck; _ruckMags = player getVariable "ACE_RuckMagContents"; _ruckWeps = player getVariable "ACE_RuckWepContents"; waitUntil {alive player}; _p = _this; removeAllItems _p; removeAllWeapons _p; {_p addMagazine _x} forEach _magazines; {_p addWeapon _x} forEach _weapons; player setVariable ["ACE_weapononback", _ruckType, true]; player setVariable ["ACE_RuckMagContents", _ruckMags, true]; player setVariable ["ACE_RuckWepContents", _ruckWeps, true]; _primw = primaryWeapon _p; if (_primw != "") then { _p selectWeapon _primw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); _p selectWeapon (_muzzles select 0); }; }; Share this post Link to post Share on other sites