Jump to content

stanhope

Member
  • Content Count

    853
  • Joined

  • Last visited

  • Medals

Posts posted by stanhope


  1. Here's an example from a mission I work on:

    Spoiler

     

    In initplayerlocal.sqf:

    
    private _loadoutScript = [] execVM "Scripts\arsenal\unitLoadout.sqf";    //Default loadout
    [_loadoutScript] spawn {
        params ["_loadoutScript"];
        waitUntil {sleep 0.1; scriptDone _loadoutScript};
        player setVariable ['PlayerLoadout', (getUnitLoadout player)];
    };

    In unitLoadout.sqf:

    
    
    private _unitType = typeOf player;
    
    {	player removeWeapon _x;	} forEach (weapons player);
    removeHeadgear player;
    removeVest player;
    removeBackpack player;
    removeUniform player;
    
    private _radioItem = "ItemRadio";
    if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {
        _radioItem = "TFAR_anprc152";
    };
    
    switch (_unitType) do {
    	
    	case "B_recon_TL_F";
    	case "B_recon_JTAC_F";
    	case "B_Soldier_SL_F": {player setUnitLoadout [["arifle_MX_GL_Black_F","","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30],["1Rnd_HE_Grenade_shell",3,1],["1Rnd_SmokeBlue_Grenade_shell",3,1],["1Rnd_SmokeOrange_Grenade_shell",2,1],["1Rnd_SmokePurple_Grenade_shell",2,1],["1Rnd_SmokeYellow_Grenade_shell",2,1],["1Rnd_SmokeGreen_Grenade_shell",2,1],["1Rnd_Smoke_Grenade_shell",2,1]]],[],"H_HelmetB","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]]};
    	case "B_recon_medic_F";
    	case "B_medic_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30],["SmokeShellBlue",2,1]]],["B_TacticalPack_rgr",[["Medikit",1],["FirstAidKit",20]]],"H_HelmetSpecB","",[],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]]};
    	case "B_soldier_repair_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30]]],["B_AssaultPack_rgr",[["ToolKit",1]]],"H_HelmetB","",[],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]]};
    	case "B_soldier_AR_F": {player setUnitLoadout [["LMG_Mk200_F","","","optic_Hamr",["200Rnd_65x39_cased_Box",200],[],"bipod_01_F_blk"],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1]]],["V_PlateCarrier2_rgr",[["200Rnd_65x39_cased_Box",2,200]]],["B_AssaultPack_rgr",[["200Rnd_65x39_cased_Box",2,200]]],"H_HelmetB","",["Binocular","","","",[],[],""],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_Soldier_GL_F": {player setUnitLoadout [["arifle_MX_GL_Black_F","","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30],["1Rnd_HE_Grenade_shell",3,1],["1Rnd_SmokeBlue_Grenade_shell",3,1],["1Rnd_SmokeOrange_Grenade_shell",2,1],["1Rnd_SmokePurple_Grenade_shell",2,1],["1Rnd_SmokeYellow_Grenade_shell",2,1],["1Rnd_SmokeGreen_Grenade_shell",2,1],["1Rnd_Smoke_Grenade_shell",2,1]]],[],"H_HelmetB","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]]};
    	case "B_recon_M_F";
    	case "B_soldier_M_F": {player setUnitLoadout [["srifle_EBR_F","","acc_pointer_IR","optic_DMS",[],[],"bipod_01_F_blk"],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1],["Laserbatteries",1,1]]],["V_PlateCarrier2_rgr",[["20Rnd_762x51_Mag",6,20]]],[],"H_HelmetB_camo","G_Bandanna_tan",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_recon_LAT_F";
    	case "B_soldier_AT_F": {player setUnitLoadout [["arifle_MXC_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],["launch_B_Titan_short_F","","","",["Titan_AT",1],[],""],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1]]],["V_PlateCarrier1_rgr",[["30Rnd_65x39_caseless_black_mag",5,30]]],["B_Kitbag_rgr",[["Titan_AT",2,1],["Titan_AP",1,1]]],"H_HelmetB","",[],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_soldier_LAT_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],["launch_RPG32_F","","","",["RPG32_F",1],[],""],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",5,30]]],["B_AssaultPack_rgr",[["RPG32_F",2,1],["RPG32_HE_F",1,1]]],"H_HelmetB","",[],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_Soldier_TL_F": {player setUnitLoadout [["arifle_MX_GL_Black_F","","acc_pointer_IR","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],["launch_RPG32_F","","","",["RPG32_F",1],[],""],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_PlateCarrier2_rgr",[["DemoCharge_Remote_Mag",2,1],["30Rnd_65x39_caseless_black_mag",5,30],["1Rnd_HE_Grenade_shell",3,1],["1Rnd_Smoke_Grenade_shell",2,1],["1Rnd_SmokeGreen_Grenade_shell",2,1],["1Rnd_SmokeBlue_Grenade_shell",2,1]]],[],"H_HelmetB","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_engineer_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1]]],["V_PlateCarrier2_rgr",[["MineDetector",1],["30Rnd_65x39_caseless_black_mag",5,30],["ClaymoreDirectionalMine_Remote_Mag",3,1]]],["B_AssaultPack_rgr",[["ToolKit",1],["DemoCharge_Remote_Mag",4,1]]],"H_HelmetB","",[],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_recon_exp_F";
    	case "B_soldier_exp_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_MRCO",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["HandGrenade",1,1],["SmokeShellBlue",2,1]]],["V_PlateCarrier1_rgr",[["MineDetector",1],["30Rnd_65x39_caseless_black_mag",5,30]]],["B_Kitbag_rgr",[["ToolKit",1],["DemoCharge_Remote_Mag",4,1],["ClaymoreDirectionalMine_Remote_Mag",2,1],["APERSTripMine_Wire_Mag",2,1],["APERSBoundingMine_Range_Mag",2,1]]],"H_HelmetB","",[],["ItemMap","",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_sniper_F": {player setUnitLoadout [["srifle_LRR_F","","","optic_LRPS",["7Rnd_408_Mag",7],[],""],[],[],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1]]],["V_PlateCarrier1_rgr",[["7Rnd_408_Mag",8,7]]],[],"H_Booniehat_mcamo","",[],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_spotter_F": {player setUnitLoadout [["arifle_MX_Black_F","","","optic_Hamr",[],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_PlateCarrier2_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30]]],[],"H_Booniehat_mcamo","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_support_Mort_F": {player setUnitLoadout [["arifle_MXC_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_PlateCarrier1_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30]]],["B_Mortar_01_weapon_F",[]],"H_Booniehat_mcamo","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_soldier_UAV_F": {player setUnitLoadout [["arifle_MXC_Black_F","","","optic_Hamr",["30Rnd_65x39_caseless_black_mag",30],[],""],[],[],["U_B_CombatUniform_mcam_tshirt",[["FirstAidKit",2],["Laserbatteries",1,1],["SmokeShellBlue",2,1],["HandGrenade",1,1]]],["V_Chestrig_rgr",[["30Rnd_65x39_caseless_black_mag",4,30],["30Rnd_65x39_caseless_black_mag_Tracer",1,30]]],["B_UAV_01_backpack_F",[]],"H_Booniehat_mcamo","",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","B_UavTerminal",_radioItem,"ItemCompass","ItemWatch","NVGoggles"]] };
    	case "B_Helipilot_F": {player setUnitLoadout [["SMG_03C_black","","","",["50Rnd_570x28_SMG_03",50],[],""],[],[],["U_B_HeliPilotCoveralls",[["FirstAidKit",2],["SmokeShellBlue",2,1],["HandGrenade",1,1],["Laserbatteries",1,1]]],["V_TacVest_blk",[["50Rnd_570x28_SMG_03",2,50],["SmokeShellBlue",2,1]]],[],"H_CrewHelmetHeli_B","G_Bandanna_beast",["Laserdesignator","","","",["Laserbatteries",1],[],""],["ItemMap","ItemGPS",_radioItem,"ItemCompass","ItemWatch","NVGoggles_OPFOR"]] };
    };

     

    And in onplayerrespawn:

    
    if (!isNil {player getVariable "PlayerLoadout"}) then {
    	player setUnitLoadout [player getVariable "PlayerLoadout", true];
    };

     

    My usage of switch case in my previous comment was incorrect, that's what you get from writing from memory 🙂

    • Thanks 1

  2. No so, a player's loadout is local to the player, the server doesn't have anything to do with it (huge oversimplification but good enough for this)

     

    So in a file called initPlayerLocal.sqf you add something like this (the following might be full of syntax errors, I didn't test any of it, just writing it from memory):

    switch (typeOf player) do {
    	case "B_Soldier_F": {
    		[player] execVM "YourScriptForTheLoadoutGoesHere"; 
    		break;
    	};
    	default {
    	hint "Something went wrong while applying your loadout, could not identify your role: " + typeOf player;
    	};
    };
    
    player setVariable ['PlayerLoadout', (getUnitLoadout player)];

    And then in onPlayerRespawn.sqf you add

    if (!isNil {player getVariable "PlayerLoadout"}) then {
    	player setUnitLoadout [player getVariable "PlayerLoadout", true];
    };

     

     

    The switch and everything in it is what you use to set up the loadout initially, then you use the setvar and getvar to reapply this loadout upon respawn. 

    • Like 1

  3. In initplayerlocal do a switch over typeof player and in the cases apply the loadout you want. 

     

    At the end of initplayerlocal, after that switch case put something along these lines:

    player setVariable ['PlayerLoadout', (getUnitLoadout player)];

    And then in onplayerrespawn put something alone the lines of:

    if (!isNil {player getVariable "PlayerLoadout"}) then {
    	player setUnitLoadout [player getVariable "PlayerLoadout", true];
    };

     

    • Like 2

  4. Quote

    -malloc=system -cpuCount=6 -exThreads=7 -malloc=tbb4malloc_bi_x64 -hugePages -maxmem=16317 -maxvram=5889 -loadMissionToMemory

    Take all of those settings out. 

    1 hour ago, ivall said:

    problem on all wasteland servers (2-3 months ago all be good), on other servers all be good

    Expend on this, do I understand it correctly that you don't have this problem unless you play on a wasteland server?


  5. Have you verified your game files through steam?

    Which mission were you playing?

    Does this always happen or just sometimes?  If it doesn't always happen, when does it happen?

    Could you share an RPT from when this happened?

    Are you using a USB headset?

×