Jump to content
Sign in to follow this  
kOepi

Issue functions gearscript in use with ollsen framework

Recommended Posts

hey guys,

 

I have some problems with my gearscript that works fine in editor and on a dedicated server with up to 6 guys.

 

Issues:

 

Gearscript loads partially, usually better at the start, horribly for JIPs

bringing out weapons or gear from bodies or cars memory crashes the game.

 

I am using the ollsen framework for arma3.

I really wanna keep it, cause I see some benefits having it as functions for future missions with AI spawing with custom gear.

Looks like I have redo this, but hopefully one of you can see the mistake here and help me out.

 

how on earth can I put it into the scrollable code format?

 

my fn_functions.sqf:

fnc_removeall =
{
	removeAllWeapons _this;
	removeAllItems _this;
	removeAllAssignedItems _this;
	//removeUniform _this;
	removeVest _this;
	removeBackpack _this;
	//removeHeadgear _this;
	removeGoggles _this;
};
// 0.0051 ms

// Items, Radios

fnc_giveradio = {
	private ["_rad"];
	_rad = switch (_this select 1) do {
		case 1:{"tf_pnr1000a_1"};
		case 2:{"tf_rf7800str"};
		case 3:{"tf_anprc152_19"};
		default {""};
		};
		if (_rad == "") exitWith {false};
		(_this select 0) linkitem _rad;
	true;
};

fnc_giveMS =
{
	for "_i" from 1 to 1 do {_this addItemToUniform "ACE_tourniquet";};
	for "_i" from 1 to 2 do {_this addItemToUniform "ACE_fieldDressing";};
	for "_i" from 1 to 1 do {_this addItemToUniform "ACE_morphine";};
	for "_i" from 1 to 1 do {_this addItemToUniform "ACE_elasticBandage";};
	for "_i" from 1 to 1 do {_this addItemToUniform "ACE_personalAidKit";};
	for "_i" from 1 to 2 do {_this addItemToUniform "ACE_packingBandage";};

	_this addItemToUniform "ACE_EarPlugs";
};

fnc_giveMSHM =
{
	clearAllItemsFromBackpack _this;	
	_this additemtobackpack "ACE_surgicalKit";
	for "_i" from 1 to 10 do {_this addItemToBackpack "ACE_fieldDressing";};
	for "_i" from 1 to 10 do {_this addItemToBackpack "ACE_elasticBandage";};
	for "_i" from 1 to 1 do {_this addItemToBackpack "ACE_personalAidKit";};
	for "_i" from 1 to 10 do {_this addItemToBackpack "ACE_packingBandage";};
	
	for "_i" from 1 to 26 do {_this addItemToBackpack "ACE_morphine";};
	for "_i" from 1 to 13 do {_this addItemToBackpack "ACE_tourniquet";};
	for "_i" from 1 to 26 do {_this addItemToBackpack "ACE_epinephrine";};
	for "_i" from 1 to 5 do {_this addItemToBackpack "ACE_atropine";};
	
	for "_i" from 1 to 4 do {_this addItemToBackpack "ACE_bloodIV_250";};
	for "_i" from 1 to 2 do {_this addItemToBackpack "ACE_bloodIV_500";};
	for "_i" from 1 to 4 do {_this addItemToBackpack "ACE_salineIV_250";};
	for "_i" from 1 to 2 do {_this addItemToBackpack "ACE_plasmaIV_500";};
	for "_i" from 1 to 4 do {_this addItemToBackpack "ACE_plasmaIV_250";};
	for "_i" from 1 to 4 do {_this addItemToBackpack "rhs_mag_an_m8hc";};
	for "_i" from 1 to 4 do {_this addItemToBackpack "rhs_mag_m18_yellow";};
	
};

fnc_giveCmps =
{
	_this linkItem "Itemcompass";
};

fnc_giveGPS =
{
	//_this linkitem "ItemGPS";
};

fnc_giveitems =
{
	_this addweapon "binocular";
	_this linkItem "ItemMap";
	_this linkItem "Itemwatch";
};

// 0.00517 ms

// Clothing 								// Clothing 							// Clothing 

fnc_giveUniform = {
	private ["_uni"];
	_uni = switch (_this select 1) do {
		case 1:{"rhs_uniform_mflora_patchless"};
		case 2:{"CORX_Uniform_3CDesert"};
		case 3:{"CORX_Uniform_6CDesert"};
		case 4:{"rhs_uniform_FROG01_d"};
		case 5:{"MEF_Wood_MARPAT_RM_LS"};
		case 6:{"U_B_HeliPilotCoveralls"};
		case 7:{"tin_uniform_fra_daguet_medic"};
		case 8:{"ACC_U_Pantera_D"};
		default {""};
		};
		if (_uni == "") exitWith {false};
		(_this select 0) forceaddUniform _uni;
	true;
};

fnc_giveVest = {
	private ["_vest"];
	_vest = switch (_this select 1) do {
		case 1:{"rhs_6b13_6sh92"};
		case 2:{"rhs_6sh92_headset"};
		case 3:{"CORX_Vest_6CDesert"};
		case 4:{"rhsusf_spc_rifleman"};
		case 5:{"V_BandollierB_rgr"};
		case 6:{"CORX_Vest_M81"};
		case 7:{"rhs_6b13_6sh92_vog"};
		case 8:{"rhs_6b23_ML_medic"};
		default {""};
		};
		if (_vest == "") exitWith {false};
		(_this select 0) addVest _vest;
	true;
};

fnc_giveBackPack = {
	private ["_BP"];
	_BP = switch (_this select 1) do {
		case 1:{"ACC_AssaultPack_D"};
		case 2:{"rhs_sidor"};
		case 3:{"B_Kitbag_rgr"};
		case 4:{"tf_mr3000"};
		case 5:{"CORX_Kitbag_3CDesert"};
		case 6:{"tin_backpack_medic_tan"};
		case 7:{"UKAF_PackCom"};
		default {""};
		};
		if (_BP == "") exitWith {false};
		(_this select 0) addBackpack _BP;
	true;
};

// clothing headgear					// clothing headgear					// clothing headgear

fnc_giveHeadGear = {
	private ["_HG"];
	_HG = switch (_this select 1) do {
		case 1:{"H_Bandanna_sgg"};			// Bandana Sage
		case 2:{"H_Bandanna_khk"};			// Bandana khaki
		case 3:{"rhs_beanie_green"};		//EMR-summer Beanie
		case 4:{"rhs_fieldcap"};			// flora field cap
		case 5:{"rhs_fieldcap_ml"};			// mountain les field cap
		case 6:{"MEF_Woodland_8Point"};		// Field Cap marpat woodland
		case 7:{"rhs_Booniehat_marpatwd"};			// Boonie Hat marpat woodland
		case 8:{"rhs_Booniehat_marpatd"};			// Boonie Hat marpat desert
		case 9:{"H_Cap_grn"};				// Blue Cap for Pilot 
		case 10:{"ACC_MilCap_W"};				// woodland pantera military cap
		default {""};
		};
		if (_HG == "") exitWith {false};
		(_this select 0) addHeadGear _HG;
	true;
};

fnc_giveHeadGToUniform = {
	private ["_HG"];
	_HG = switch (_this select 1) do {
		case 1:{"rhs_Booniehat_marpatd"};				// Field Cap
		case 2:{"rhs_Booniehat_marpatwd"};				// Field Cap
		case 3:{"rhsusf_ach_bare_headset"};			// Helmet for SL on body
		case 4:{"rhs_Booniehat_marpatwd"};			// Helmet for HQ on body 
		case 5:{"H_PilotHelmetHeli_O"};				// Pilot Helmet for Pilot on body
		default {""};		
		};
		if (_HG == "") exitWith {false};
		(_this select 0) addItemToUniform _HG;
	true;
};

// CLothing - Facewear					// CLothing - Facewear					// CLothing - Facewear

fnc_giveFaceW = {
	private ["_FW"];
	_FW = switch (_this select 1) do
		{
		case 1:{"G_Bandanna_tan"};		// facemask tan
		case 2:{"G_Bandanna_oli"};		// facemask olive
		case 3:{"G_Bandanna_khk"};		// facemask khaki
		case 4:{"G_Aviator"};		// facemask khaki
		default {""};
		};
		if (_FW == "") exitWith {false};
		(_this select 0) addGoggles _FW;
	true;
};

fnc_giveHelmet = {
	private ["_HM"];
	_HM = switch (_this select 1) do {
		case 1:{"ACC_H_MICH_W"};
		case 2:{"rhsusf_ach_bare"};
		case 3:{"rhsusf_ach_bare_des"};
		case 4:{"rhsusf_ach_bare_des_headset"};
		case 5:{"rhsusf_ach_bare_semi_headset"};
		case 6:{"tin_helmet_fra_ce"};
		case 7:{"ACC_H_MICH_D"};
		default {""};
		};
		if (_HM == "") exitWith {false};
		(_this select 0) addHeadGear _HM;
	true;
};

// Russian weapons								// Russian	weapons								// Russian weapons

fnc_giveWMaks =
{
	_this addItemtoVest "rhs_mag_9x18_12_57N181S";
	_this addWeapon "rhs_weap_makarov_pmm";
	for "_i" from 1 to 1 do {_this addItemToVest "rhs_mag_9x18_12_57N181S";};
	_this additemtouniform "ACE_MapTools";
};

fnc_giveWAK74_1 =
{
	for "_i" from 1 to 3 do {_this addItemToVest "rhs_30Rnd_545x39_AK_green";};
	_this addWeapon "rhs_weap_ak74m_2mag_camo";
	for "_i" from 1 to 4 do {_this addItemToVest "rhs_30Rnd_545x39_AK";};
};

fnc_giveWAK74_GP =

{
	for "_i" from 1 to 3 do {_this addItemToVest "rhs_30Rnd_545x39_AK_green";};
	_this addWeapon "rhs_weap_ak74m_gp25";
	for "_i" from 1 to 4 do {_this addItemToVest "rhs_30Rnd_545x39_AK";};
	_this addPrimaryWeaponItem "tb_acc_kobra";
	for "_i" from 1 to 8 do {_this addItemToVest "rhs_VOG25";};
	for "_i" from 1 to 6 do {_this addItemToBackpack "rhs_VOG25";};
	for "_i" from 1 to 10 do {_this addItemToBackpack "rhs_GRD40_White";};
	for "_i" from 1 to 2 do {_this addItemToBackpack "rhs_GRD40_red";};
	for "_i" from 1 to 2 do {_this addItemToBackpack "rhs_GRD40_green";};
};

fnc_giveWAK74_2 =
{
	for "_i" from 1 to 7 do {_this addItemToVest "rhs_30Rnd_545x39_AK";};
	_this addWeapon "rhs_weap_ak74m_desert";
	_this addPrimaryWeaponItem "rhs_acc_pkas";
};

fnc_giveWRPK74 =
{
	for "_i" from 1 to 10 do {_this addItemToVest "jo_60rnd_AK12";};
	_this addWeapon "JO_RF_RPK74M";
};

fnc_giveWAK74U =
{
	_this addItemToVest "CUP_30Rnd_TE1_Green_Tracer_545x39_AK_M";
	_this addItemToVest "CUP_30Rnd_TE1_Red_Tracer_545x39_AK_M";
	_this addItemToVest "CUP_30Rnd_TE1_Yellow_Tracer_545x39_AK_M";
	for "_i" from 1 to 4 do {_this addItemToVest "CUP_30Rnd_545x39_AK_M";};
	_this addWeapon "CUP_arifle_AKS74U";
	_this addPrimaryWeaponItem "CUP_optic_Kobra";
	_this addPrimaryWeaponItem "CUP_muzzle_PBS4";
	_this addItemToUniform "tf_microdagr";
};

fnc_giveWSVD =
{
	for "_i" from 1 to 9 do {_this addItemToVest "rhs_10Rnd_762x54mmR_7N1";};
	_this addWeapon "rhs_weap_svdp_wd";
	_this addPrimaryWeaponItem "rhs_acc_pso1m2";
};

fnc_giveWVSS =
{
	for "_i" from 1 to 7 do {_this addItemToVest "CUP_20Rnd_9x39_SP5_VSS_M";};
	_this addWeapon "CUP_srifle_VSSVintorez";
	_this addPrimaryWeaponItem "CUP_optic_PSO_1";
};

fnc_givegrens2 =
{
	for "_i" from 1 to 2 do {_this addItemToVest "ACE_M84";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_rdg2_white";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_m18_green";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_rgd5";};
	_this addItemToVest "rhs_mag_rgd5";
	_this addItemToVest "rhs_mag_rgd5";
	_this addItemToVest "rhs_mag_rdg2_white";
};

fnc_givegrensBPR =
{
	_this addItemtoBackpack "rhs_mag_rgd5";
	_this addItemToBackpack "rhs_mag_rdg2_white";
};

fnc_giveWRPG32 =
{
	_this addItemToBackpack "RPG32_F";
	_this addWeapon "launch_RPG32_F";
	_this addItemToBackpack "RPG32_F";
};

fnc_giveWRPG18 =
{
	for "_i" from 1 to 2 do {_this addItemToBackpack "CUP_RPG18_M";};
	_this addWeapon "CUP_launch_RPG18";
};

// American weapons								// American	weapons								// American weapons

fnc_giveWM9 =
{
	for "_i" from 1 to 1 do {_this addItemToVest "11Rnd_45ACP_Mag";};
	_this addWeapon "hgun_Pistol_heavy_01_F";
	for "_i" from 1 to 1 do {_this addItemToUniform "11Rnd_45ACP_Mag";};
	_this additemtovest "ACE_MapTools";
};

fnc_giveWM16_1 =
{
	for "_i" from 1 to 7 do {_this addItemToVest "rhs_mag_30Rnd_556x45_M855A1_Stanag";};
	_this addWeapon "rhs_weap_m16a4_carryhandle_grip_pmag";
	_this addPrimaryWeaponItem "tb_acc_compM4";
	_this addPrimaryWeaponItem "rhsusf_acc_anpeq15_light";
};

fnc_giveWM16_2 =
{
	for "_i" from 1 to 4 do {_this addItemToVest "rhs_mag_30Rnd_556x45_M855A1_Stanag";};
	for "_i" from 1 to 3 do {_this addItemToVest "rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red";};
	_this addWeapon "rhs_weap_m16a4";
	//_this additemToUniform "11Rnd_45ACP_Mag";
};

fnc_giveWM16M203 =
{
	for "_i" from 1 to 3 do {_this addItemToVest "rhs_mag_30Rnd_556x45_M855A1_Stanag";};
	for "_i" from 1 to 3 do {_this addItemToVest "rhs_mag_30Rnd_556x45_M855A1_Stanag_Tracer_Red";};
	for "_i" from 1 to 14 do {_this addItemToVest "rhs_mag_M433_HEDP";};
	for "_i" from 1 to 10 do {_this addItemToVest "rhs_mag_m714_White";};
	_this addWeapon "rhs_weap_m4_m320";
	for "_i" from 1 to 1 do {_this addItemToUniform "rhs_mag_30Rnd_556x45_M855A1_Stanag";};
	//_this additemToUniform "tf_microdagr";
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_m715_Green";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_m713_Red";};
};

fnc_giveWM249 =
{
	_this addItemToVest "rhs_200rnd_556x45_M_SAW";
	_this addWeapon "rhs_weap_m249_pip_L";
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_200rnd_556x45_M_SAW";};
	for "_i" from 1 to 1 do {_this addItemToUniform "11Rnd_45ACP_Mag";};
};

fnc_giveCCO =
{
	_this addPrimaryWeaponItem "rhsusf_acc_eotech_552";
	_this addPrimaryWeaponItem "rhsusf_acc_anpeq15_light";
};

fnc_giveCCO2 =
{
	_this addPrimaryWeaponItem "rhs_acc_ekp1";
};

fnc_giveACOG =
{
	_this addPrimaryWeaponItem "rhsusf_acc_anpeq15_light";
	_this addPrimaryWeaponItem "CUP_optic_ACOG";
};

fnc_givegrensVA =
{
	for "_i" from 1 to 2 do {_this addItemToVest "ACE_M84";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_an_m8hc";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_m18_green";};
	for "_i" from 1 to 2 do {_this addItemToVest "rhs_mag_m67";};
};

fnc_giveAARkit =
{
	_this addItemToBackpack "ACE_SpareBarrel";
	for "_i" from 1 to 3 do {_this additemtoBackpack "rhs_200rnd_556x45_M_SAW";};
	_this addItemtoBackpack "rhs_Booniehat_marpatd";
};

fnc_giveAARkit2 =
{
	for "_i" from 1 to 10 do {_this additemtoBackpack "jo_60rnd_AK12";};
};

fnc_giveFROkit =
{
	_this addItemToBackpack "ACRE_PRC77_ID_1";
};


fnc_give556V =
{
	_this addItemToVest "rhs_200rnd_556x45_M_SAW";
};

fnc_give545B =
{
	for "_i" from 1 to 4 do {_this additemtoBackpack "jo_60rnd_AK12";};
};

// special equipment				// special equipment					// special equipment

fnc_givecableties =
{
	_this additemtovest "ACE_CableTie";
	_this additemtovest "ACE_CableTie";
};

fnc_giveMineRSF =
{
	_this additemToBackpack "APERSTripMine_Wire_Mag";
	for "_i" from 1 to 2 do {_this additemtoBackPack "rhs_mine_pmn2_mag";};
};

fnc_giveMine = {
	private ["_Mn"];
	_Mn = switch (_this select 1) do
		{
		case 1:{"rhs_mine_tm62m_mag"};			// Russian Anti tank blast mine
		case 2:{"rhs_mine_pmn2_mag"};			// Anti Personal stake mine
		case 3:{"CUP_PipeBomb_M"};				// remote controlled satchel
		case 4:{"DemoCharge_Remote_Mag"};		// m112 explosive
		case 5:{"APERSTripMine_Wire_Mag"};		// Anti personnel bounding mine
		default {""};
		};
		if (_Mn == "") exitWith {false};
		(_this select 0) additemToBackpack _Mn;
	true;
};

my fn_functions will be loaded through the description.hpp:

#ifdef description
	
	#include "dia\rscdefinitions.hpp" //Must have for the end screen to work, if removed Arma 3 will crash on mission load
	#include "dia\endscreen\dia_endscreen.hpp" //Must have for the end screen to work, if removed Arma 3 will crash on mission load

	respawn = "BASE"; //Do not change, spectator script needs people to respawn, to be declared as dead and put into spectator mode
	respawndelay = 5; //5 seconds are needed to make sure people properly die and go into spectator
	disabledAI = 1; //disabledAI does so not slotted units do not spawn as ai
	respawnButton = 0; //Disables the respawn button
	respawnDialog = 0; //Disables the score screen while respawning

	class Extended_PreInit_EventHandlers {
		
		class Mission {
		
			init = "'' call compile preprocessFileLineNumbers 'preinit.sqf'; call compile preprocessFileLineNumbers 'functions\fn_functions.sqf'; "; //Compiles the gear script for the server and client
		
		};
	};
	
#endif
	
#ifdef description_titles
	
	#include "dia\debug\dia_debug.hpp" //Must have for the end screen to work, if removed Arma 3 will crash on mission load

#endif

the loadout for the individual is an the R.sqf:

//	Rifleman Scout
private ["_MRP"];
_MRP = _this select 0;
IF(!local _MRP) exitwith {};
waitUntil { !isNull player };

_MRP call fnc_removeall;

//	clothing
//[_MRP,1] call fnc_giveHelmet;
//[_MRP,2] call fnc_giveUniform;
[_MRP,6] call fnc_giveVest;

// items - Radio
[_MRP,2] call fnc_giveHeadGToUniform;
_MRP call fnc_giveCmps;
_MRP call fnc_giveMS;
_MRP call fnc_giveitems;
_MRP call fnc_givecableties;

//	weapons
//sleep 0.001;
_MRP call fnc_giveWM16_1;
_MRP call fnc_giveACOG;
_MRP call fnc_givegrensVA;
_MRP call fnc_give556V;

//0.003711 ms //0.003809 ms

// 21.9 kg

and the vehicle loadout that breaks everyone everytime is in the offroadwest.sqf:

//box1.sqf
//TVT 85 Fire with Fire Eastern offroad
//Author's: =DWT= & Hashsix
// Crates Init : nul = [this] execVM "ammobox.sqf";

if (! isServer) exitWith {};


_crate = _this select 0;




if (isServer) then 
{


clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearbackpackcargoGlobal _crate;


// crew served stuff

_crate addItemCargoGlobal ["ACE_Tripod", 1];
_crate addWeaponCargoGlobal ["rhs_weap_m240B_CAP",1];
_crate addMagazineCargoGlobal ["rhsusf_100Rnd_762x51", 14];

// medical supplies

_crate additemCargoGlobal ["ACE_fieldDressing",6];
_crate additemCargoGlobal ["ACE_elasticBandage",6];
_crate additemCargoGlobal ["ACE_personalAidKit",6];
_crate additemCargoGlobal ["ACE_packingBandage",6];

_crate additemCargoGlobal ["ACE_morphine",6];
_crate additemCargoGlobal ["ACE_tourniquet",6];
_crate additemCargoGlobal ["ACE_epinephrine",6];
_crate additemCargoGlobal ["ACE_atropine",6];
_crate additemCargoGlobal ["ACE_bloodIV_250",6];
_crate additemCargoGlobal ["ACE_bloodIV_500",6];
_crate additemCargoGlobal ["ACE_salineIV_250",6];
_crate additemCargoGlobal ["ACE_plasmaIV_500",6];
_crate additemCargoGlobal ["ACE_plasmaIV_250",6];
_crate additemCargoGlobal ["ACE_surgicalKit",1];

};

thankful for all input

 

greetz

 

kOepi

Share this post


Link to post
Share on other sites

Only thing I noticed is that you are checking twice if the offroadwest.sqf is running on the server. In addition there is a space between the ! and the isServer in line 6. (No clue if that makes a difference but I've never seen that before)

 

//box1.sqf
//TVT 85 Fire with Fire Eastern offroad
//Author's: =DWT= & Hashsix
// Crates Init : nul = [this] execVM "ammobox.sqf";
 
if (!isServer) exitWith {};//removed the space between ! and isServer (just in case)
 
// removed the if(isServer)
_crate = _this select 0;

clearMagazineCargoGlobal _crate;
clearWeaponCargoGlobal _crate;
clearItemCargoGlobal _crate;
clearbackpackcargoGlobal _crate;
 
 
// crew served stuff
 
_crate addItemCargoGlobal ["ACE_Tripod", 1];
_crate addWeaponCargoGlobal ["rhs_weap_m240B_CAP",1];
_crate addMagazineCargoGlobal ["rhsusf_100Rnd_762x51", 14];
 
// medical supplies
 
_crate additemCargoGlobal ["ACE_fieldDressing",6];
_crate additemCargoGlobal ["ACE_elasticBandage",6];
_crate additemCargoGlobal ["ACE_personalAidKit",6];
_crate additemCargoGlobal ["ACE_packingBandage",6];
 
_crate additemCargoGlobal ["ACE_morphine",6];
_crate additemCargoGlobal ["ACE_tourniquet",6];
_crate additemCargoGlobal ["ACE_epinephrine",6];
_crate additemCargoGlobal ["ACE_atropine",6];
_crate additemCargoGlobal ["ACE_bloodIV_250",6];
_crate additemCargoGlobal ["ACE_bloodIV_500",6];
_crate additemCargoGlobal ["ACE_salineIV_250",6];
_crate additemCargoGlobal ["ACE_plasmaIV_500",6];
_crate additemCargoGlobal ["ACE_plasmaIV_250",6];
_crate additemCargoGlobal ["ACE_surgicalKit",1];
 

Share this post


Link to post
Share on other sites

thanks the spaces were a problem, now only the loadouts dont get loaded when JIPs get in, they dont have uniform or vests ...

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  

×