Advertisement

Author Topic: Respawn with Saved Loadouts w/ preconfigurable Custom Loadouts  (Read 1736 times)

0 Members and 1 Guest are viewing this topic.

Offline tcp

  • Members
  • *
    • Violator Gaming
v01 Changelog:
-one script file, modes determine by size of array passed to it
-Save loadouts at ammoboxes, or vehicles with ammo filler script
-supports briefing gear selection, default loadouts, or the preconfigured custom loadouts

Code: (tcp_arm.sqf) [Select]
/* tcp_arm.sqf v01
Author: tcp Support: <<http://blackop.co.cc>>
Used examples from Hunt Waldo by Bon_Inf*
Respawn with custom loadouts.  Preconfigure custom loads and/or enable saving at ammoboxes.
Init.sqf: << >> enclosures for clarity only, not part of syntax
<<_player_armed = [true] execVM "tcp_arm.sqf";>> to enable saving only (when already using briefing gear selection or starting ammoboxes)
<<_player_armed = [true,true] execVM "tcp_arm.sqf";>> to enable saving and custom starting loadouts (needs to be configured below)
Ammobox init:
<<_saveloadout = this addAction ["Save Loadout", "tcp_arm.sqf",[],-3,false,true,"",""];>>
Ammo filler script:
<<_saveloadout = _this addAction ["Save Loadout", "tcp_arm.sqf",[],-3,false,true,"",""];>>
*/
sleep 1;
waitUntil{alive player};
if(typeName _this != "ARRAY") then {
removeAllWeapons player;
{player addMagazine _x} foreach (tcp_loadout select 1); {player addWeapon _x} foreach (tcp_loadout select 0);
if (primaryWeapon player != "") then {
player selectWeapon (primaryWeapon player);
_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); // Fix for weapons with grenade launcher
player selectWeapon (_muzzles select 0);
};
} else {
if(count _this < 3) then {
player addEventHandler ["killed", {player execVM "tcp_arm.sqf";}];
if(count _this == 2) then {
switch (typeOf player) do{
case "USMC_Soldier_Officer": {
//an empty case leaves default loadouts alone, see "USMC_Soldier" case for custom example
//<<http://www.ofpec.com/COMREF/index.php?action=read&id=209#Man>> for more Soldier types
//http://www.ofpec.com/COMREF/index.php?action=read&id=210 for Weapon and Magazine types
};
case "USMC_Soldier_Pilot": {
};
case "USMC_Soldier_SL": {
};
case "USMC_Soldier_LAT": {
};
case "USMC_Soldier_AR": {
};
case "USMC_Soldier_Medic": {
};
case "USMC_SoldierM_Marksman": {
};
case "USMC_SoldierS_Sniper": {
};
case "USMC_Soldier": {
removeAllWeapons player;
//8 secondary ammo slots
{player addMagazine "15Rnd_9x19_M9SD"} forEach [1,2,3,4,5,6,7,8];
//12 primary ammo slots
{player addMagazine "30Rnd_556x45_StanagSD"} forEach [1,2,3,4,5,6,7,8];
{player addMagazine "HandGrenade_West"} forEach [9,10];
{player addMagazine "PipeBomb"} forEach [11+12];
//Weapons
player addWeapon "M4A1_AIM_SD_camo";
player addWeapon "M9SD";
player addweapon "ItemGPS";
player addWeapon "NVGoggles";
player addWeapon "Binocular";
};
case "USMC_SoldierS_Engineer": {
};
};
if (primaryWeapon player != "") then {
player selectWeapon (primaryWeapon player);
_muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); // Fix for weapons with grenade launcher
player selectWeapon (_muzzles select 0);
};
};
};
tcp_loadout = [weapons player,magazines player];
if ( daytime < 4.0 ) then {player action ["NVGOGGLES",player]};
if ( daytime > 20.5 ) then {player action ["NVGOGGLES",player]};
if (count _this < 3) then {HintSilent "Loadout Saving Enabled."} else {HintSilent "Loadout Saved."};
};
if(true) exitWith{true};

Example mission:
http://www.filefront.com/14682949/tcp_arm_test_v01.utes.pbo

« Last Edit: 08 Oct 2009, 22:40:52 by tcp »