Jump to content

Recommended Posts

So, I'm at my wits end here fellas. I have implemented this code directly in addactions and its worked in MP. Now I've gone the route of consolidating and creating functions and calling. But it seems I broke it... I've looked at this code and troubleshot it till I was blue in the face and I am at my wits end. Please take a look and I'll explain further at the end of the post. Code follows. This is all running on a dedicated server.

initserver.sqf
 

Spoiler

["Initialize", [true]] call BIS_fnc_dynamicGroups;

[] execVM "56RDLoadOuts.sqf";

[] execVM "ArmorAISpawn.sqf";

[] execVM "ConvoyAiSpawn.sqf"; 

[] execVM "RmorRng.sqf";

[] execVM "EnemyFighter.sqf";

[] execVM "EnemyFighterSQ.sqf";

[] execVM "EnemyCASFW.sqf";  
 
[] execVM "EnemyCASRW.sqf";  

[] execVM "AssaultAiSpawn2.sqf";  

[] execVM "AssaultAiSpawn.sqf";  

[] execVM "HostileAAA.sqf";  

[] execVM "CK_SpwnV.sqf";

CK_FN_CLRTNK = {
	cleanUp= vehicles inAreaArray TNKCLR;
	{{deleteVehicle _x} forEach crew _x + [vehicle _x]}forEach cleanUp;
	hint "Static Armor Clear";
};  


CK_FN_CLRAIR = {
	cleanUp= allUnits inAreaArray EnemyAirSpace;
	{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach cleanUp;
	hint "Enemy Air Space Clear";
};
 


CK_FN_CLRASSLT = {
	cleanUp= allUnits inAreaArray AssaultForce;
	{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach cleanUp;
	hint "Assault Area Clear";
};


CK_FN_CLRCNVY = {
cleanUp= allUnits inAreaArray Convoy;
{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach cleanup;
hint "Convoy Clear";
};

CK_FN_CLRAAA = {
cleanUp= allUnits inAreaArray EnemyAAA;
{{deleteVehicle _x} forEach crew _x + [vehicle _x]} forEach cleanUp;
hint "Hostile AAA Clear";
};

CK_FN_MORNING = {
	[[], {setDate [2035, 6, 24, 10, 0]}] remoteExecCall ["call",0,"JIP_id_setDate"];  
any = [[["Late next morning","align = 'center' size = '0.7' font='PuristaBold'"]]] spawn BIS_fnc_typeText2;  
sleep 5;  
};

CK_FN_EVENING = {
	[[], {setDate [2035, 6, 24, 22, 0]}] remoteExecCall ["call",0,"JIP_id_setDate"];  
any =[[["Late next evening","align = 'center' size = '0.7' font='PuristaBold'"]]] spawn BIS_fnc_typeText2;  
sleep 5;  
};

CK_FNC_CLR = {
    params ["_CK_SPWN","_CK_ZOFST","_CK_CASE"];
 	private _ClrArea =  _CK_SPWN nearObjects ["EmptyDetector", 5] select 0;
 	cleanUp= vehicles inAreaArray _ClrArea;
 	{
 	deleteVehicle _x;
	} forEach cleanup; 
	uisleep 5;
	hint "Spawn Area Clear";	
};

CK_FNC_CLRB = {
    params ["_CK_SPWN","_CK_ZOFST","_CK_CASE"];
 	private _ClrArea =  CK_BDEL1_1;
 	cleanUp= vehicles inAreaArray _ClrArea;
 	{
 	deleteVehicle _x;
	} forEach cleanup; 
	uisleep 5;
	hint "Spawn Area Clear";	
};

 


CK_SpwnV.sqf
 

Spoiler

CK_FNC_SPWNV = {
	params ["_CK_SPWN","_CK_ZOFST","_CK_CASE"];
		switch (_CK_CASE) do { 
			case 1 : {CK_VIC = ["B_Heli_Transport_01_F","Ghost Hawk"];}; 
			case 2 : {CK_VIC = ["CUP_B_MH6M_USA","Little Bird"];};
			case 3 : {CK_VIC = ["CUP_B_UH60M_US","Black Hawk"];};
			case 4 : {CK_VIC = ["CFP_B_USRANGERS_MH_60L_DAP_4Pylons_WDL_01","Black Hawk Armed"];};
			case 5 : {CK_VIC = ["CUP_B_AW159_Unarmed_RN_Blackcat","Wildcat"];};
			case 6 : {CK_VIC = ["CUP_B_AW159_RN_Blackcat","Wildcat Armed"];};
			case 7 : {CK_VIC = ["CFP_B_USMC_UH_1Y_Venom_Transport_DES_01","Huey"];};
			case 8 : {CK_VIC = ["CFP_B_USMC_UH_1Y_Venom_Gunship_DES_01","Huey Armed"];};
			case 9 : {CK_VIC = ["CUP_B_SA330_Puma_HC2_BAF","Puma"];};
			case 10 : {CK_VIC = ["CUP_B_Merlin_HC3_GB","Merlin"];};
			case 11 : {CK_VIC = ["CUP_B_Merlin_HC3_VIV_GB","Merlin VIV"];};
			case 12 : {CK_VIC = ["CUP_B_Mi171Sh_Unarmed_ACR","MI-171"];};
			case 13 : {CK_VIC = ["CFP_B_KEARMY_Harbin_ZB9_01","Harbin"];};
			case 14 : {CK_VIC = ["B_Heli_Transport_03_F","CH-471 Chinook"];};
			case 15 : {CK_VIC = ["CUP_B_CH47F_USA","CH-47F Chinook"];};
			case 16 : {CK_VIC = ["CUP_B_CH47F_VIV_USA","CH-47F Chinook VIV"];};
			case 17 : {CK_VIC = ["CUP_B_CH53E_USMC","CH-53 Super Stallion"];};
			case 18 : {CK_VIC = ["CUP_B_CH53E_VIV_USMC","CH-53 Super Stallion VIV"];};
			case 19 : {CK_VIC = ["CUP_B_AH6J_USA","AH-6M Little Bird"];};
			case 20 : {CK_VIC = ["CUP_B_AH1Z_Dynamic_USMC","AH-1Z Cobra"];};
			case 21 : {CK_VIC = ["B_Heli_Attack_01_dynamicLoadout_F","AH-66 Comanchee"];};
			case 22 : {CK_VIC = ["CUP_B_AH64D_DL_USA","AH-64D Apache"];};
			case 23 : {CK_VIC = ["CUP_I_Mi24_Mk4_ION","MI-24 Super Hind"];};
			case 24 : {CK_VIC = ["CUP_I_Mi24_D_Dynamic_ION","MI-24D Hind"];};
			case 25 : {CK_VIC = ["CFP_B_CZARMY_Mi_35_Dark_WDL_01","MI-35 Hind"];};
			case 26 : {CK_VIC = ["CFP_O_RUARMY_Ka_50_Black_Shark_DES_01","KA-50 Black Shark"];};
			case 27 : {CK_VIC = ["CFP_O_RUARMY_Ka_52_Black_DES_01","KA-52 Alligator"];};
			case 28 : {CK_VIC = ["B_Plane_Fighter_01_F","F-118 Black Wasp"];};
			case 29 : {CK_VIC = ["B_Plane_Fighter_01_Stealth_F","F-118 Black Wasp Stealth"];};
			case 30 : {CK_VIC = ["CUP_B_F35B_USMC","F-35 Lightning"];};
				case 31 : {CK_VIC = ["CUP_B_F35B_Stealth_USMC","F-35 Lightning Stealth"];};
			case 32 : {CK_VIC = ["B_Plane_CAS_01_dynamicLoadout_F","A-10D Wipeout"];};
			case 33 : {CK_VIC = ["USAF_A10","A-10C Warthog"];};
			case 34 : {CK_VIC = ["CUP_B_AV8B_DYN_USMC","AV-8B Harrier"];};
			case 35 : {CK_VIC = ["CUP_B_L39_CZ","L-39 Trainer"];};
			case 36 : {CK_VIC = ["CUP_B_SU34_CDF","SU-34 Flanker"];};
			case 37 : {CK_VIC = ["B_LSV_01_unarmed_F","Polaris"];};
			case 38 : {CK_VIC = ["B_LSV_01_armed_F","Polaris HMG"];};
			case 39 : {CK_VIC = ["B_LSV_01_AT_F","Polaris AT"];};
			case 40 : {CK_VIC = ["B_MRAP_01_F","Hunter"];};
				case 41 : {CK_VIC = ["B_MRAP_01_hmg_F","Hunter HMG"];};
			case 42 : {CK_VIC = ["B_MRAP_01_gmg_F","Hunter GMG"];};
			case 43 : {CK_VIC = ["B_MRAP_03_F","Fennek"];};
			case 44 : {CK_VIC = ["B_MRAP_03_hmg_F","Fennek HMG"];};
			case 45 : {CK_VIC = ["B_MRAP_03_gmg_F","Fennek GMG"];};
			case 46 : {CK_VIC = ["CUP_B_RG31E_M2_USA","Cougar"];};
			case 47 : {CK_VIC = ["CUP_B_Mastiff_LMG_GB_D","Mastiff LMG"];};
			case 48 : {CK_VIC = ["CUP_B_Mastiff_HMG_GB_D","Mastiff HMG"];};
			case 49 : {CK_VIC = ["CUP_B_Mastiff_HMG_GB_D","Mastiff GMG"];};
			case 50 : {CK_VIC = ["CUP_B_HMMWV_Crows_M2_USA","Humvee M2"];};
				case 51 : {CK_VIC = ["CUP_B_HMMWV_Crows_MK19_USA","Humvee Mk-19"];};
			case 52 : {CK_VIC = ["CUP_B_HMMWV_TOW_USA","Humvee TOW"];};
			case 53 : {CK_VIC = ["CUP_B_LAV25_HQ_desert_USMC","LAV LMG"];};
			case 54 : {CK_VIC = ["CUP_B_LAV25_desert_USMC","LAV M240"];};
			case 55 : {CK_VIC = ["B_APC_Wheeled_01_cannon_F","Badger"];};
			case 56 : {CK_VIC = ["I_APC_Wheeled_03_cannon_F","Pandur"];};
			case 57 : {CK_VIC = ["I_APC_tracked_03_cannon_F","Warrior"];};
			case 58 : {CK_VIC = ["CUP_B_M2A3Bradley_USA_D","Bradley"];};
			case 59 : {CK_VIC = ["B_Mortar_01_F","Mortar"];};
			case 60 : {CK_VIC = ["CUP_B_M1129_MC_MK19_Desert_Slat","M1129"];};
				case 61 : {CK_VIC = ["CFP_B_USARMY_M119_US","M119"];};
			case 62 : {CK_VIC = ["B_MBT_01_arty_F","Sholef"];};
			case 63 : {CK_VIC = ["CFP_B_UGARMY_BM_21_01","BM-21"];};
			case 64 : {CK_VIC = ["B_MBT_01_mlrs_F","Seara"];};
			case 65 : {CK_VIC = ["CUP_B_M270_DPICM_USA","M270 Cluster"];};
			case 66 : {CK_VIC = ["CUP_B_M270_HE_USA","M270 HE"];};
			case 67 : {CK_VIC = ["CUP_B_M1A1_DES_US_Army","Abrams M1A1"];};
			case 68 : {CK_VIC = ["CUP_B_M1A2_TUSK_MG_DES_US_Army","Abrams M1A2"];};
			case 69 : {CK_VIC = ["B_MBT_01_cannon_F","Merkava"];};
			case 70 : {CK_VIC = ["B_MBT_01_TUSK_F","Merkava UP"];};
				case 71 : {CK_VIC = ["I_MBT_03_cannon_F","Leopard"];};
			case 72 : {CK_VIC = ["B_AFV_Wheeled_01_up_cannon_F","Rhino UP"];};
			case 73 : {CK_VIC = ["CUP_B_RHIB2Turret_USMC","RHIB Mk-19"];};
			case 74 : {CK_VIC = ["B_Boat_Armed_01_minigun_F","Speed Boat HMG"];};
			case 75 : {CK_VIC = ["CUP_B_Zodiac_USMC","Zodiac"];};
			case 76 : {CK_VIC = ["CFP_B_USMC_AAVP7_A1_DES_01","AAVP7"];};
			case 77 : {CK_VIC = ["CUP_B_LCAC_USMC","LCAC"];};
			case 78 : {CK_VIC = ["CUP_B_LCU1600_USMC","LCU 1600"];};
			case 79 : {CK_VIC = ["CUP_I_LCVP_VIV_RACS","LCPV"];};
			case 80 : {CK_VIC = ["B_SDV_01_F","SDV"];};
				case 81 : {CK_VIC = ["CUP_B_MV22_USMC","Osprey"];};
			case 82 : {CK_VIC = ["CUP_B_MV22_USMC_RAMPGUN","Osprey M2"];};
			case 83 : {CK_VIC = ["CUP_B_MV22_VIV_USMC","Osprey VIV"];};
			case 84 : {CK_VIC = ["B_T_VTOL_01_infantry_F","Black Fish"];};
			case 85 : {CK_VIC = ["B_T_VTOL_01_armed_F","Black Fish Armed"];};
			case 86 : {CK_VIC = ["B_T_VTOL_01_vehicle_F","Black Fish VIV"];};
			case 87 : {CK_VIC = ["USAF_AC130U","AC-130 Spectre"];};
			case 88 : {CK_VIC = ["USAF_E3","E3 AWACS"];};
			case 89 : {CK_VIC = ["USAF_C17","C-17 Globe Master"];};
			case 90 : {CK_VIC = ["Valor_Transport_Unarmed_F","UV-85 Omaha"];};
				case 91 : {CK_VIC = ["HTNK_Gdi","Mammoth"];};
			case 92 : {CK_VIC = ["CUP_B_Challenger2_Desert_BAF","Challenger"];};
			case 93 : {CK_VIC = ["B_UAV_01_F","Darter"];};
			case 94 : {CK_VIC = ["B_UAV_06_F","Pelican"];};
			case 95 : {CK_VIC = ["B_UAV_05_F","Sentinal"];};
			case 96 : {CK_VIC = ["B_UAV_02_dynamicLoadout_F","Yabhon"];};
			case 97 : {CK_VIC = ["B_T_UAV_03_dynamicLoadout_F","Falcon"];};
			case 98 : {CK_VIC = ["USAF_MQ9","Reaper"];};
			case 99 : {CK_VIC = ["CFP_B_CDF_Pchela_1T_SNW_01","Pchela"];};
			case 100 : {CK_VIC = ["bwi_a3_at6b","Texan II"];};
			case 101 : {CK_VIC = ["USAF_F22_Heavy","F-22 Raptor Heavy"];};
			case 102 : {CK_VIC = ["USAF_F35A","F-35 Raptor Heavy"];};
			default {CK_VIC = ["","Nothing"];};
		};
	private _SpwnPos = CK_GSPWN;
	private _vic = createVehicle [CK_VIC select 0,  [getPosATL _SpwnPos select 0,getPosATL _SpwnPos select 1,(getPosATL _SpwnPos select 2) + 0.01], [], 0,"CAN_COLLIDE"];
	_vic allowDamage false;
	_vic enableSimulationGlobal false;
	private _MRKR = nearestObjects [(_CK_SPWN), ["Land_HelipadEmpty_F"], 5];
	_SpwnPos = _MRKR select 0;
	_vic setdir getdir _SpwnPos;
	_vic setPosASL [getPosATL _SpwnPos select 0, getPosATL _SpwnPos select 1, _CK_ZOFST];		
	uisleep 1;
	_vic enableSimulationGlobal true;
	_vic allowDamage true;
	if (_CK_CASE < 28) then {
	  	_vic addaction ["Disable Main Rotor", {
			_this select 1;
			[(_this select 0) , ["hithrotor", 1]] remoteExecCall ["setHitpointdamage", owner (_this select 0)];
		}];
		_vic addaction ["Disable Tail Rotor", {
			_this select 1;
			[(_this select 0) , ["hitvrotor", 1]] remoteExecCall ["setHitpointdamage", owner (_this select 0)];
		}];
		} else {
	};
	_vic addaction ["Fix It!", {
		_this select 1;
		[(_this select 0) , 0] remoteExecCall ["setDamage", owner (_this select 0)];
	}];
	_vic addaction ["Flip Vehicle", {
		_this select 1; 
    	private _veh = (_this select 0); 
    	_veh setVectorUp [0,0,1]; 
    	_veh setPosATL [(getPosATL _veh) select 0, (getPosATL _veh) select 1, 0]; 
 	}];
 	_vic addaction ["Rearm", {
 		_this select 1; 
  		[(_this select 0) , 1] remoteExecCall ["setVehicleAmmo", owner (_this select 0)];
  	}]; 
	hint format ["%1 spawned", CK_VIC select 1];
};

 

Okay so now I have some pedestals that players can utilize to spawn various vehicles, lets take the transport helo for exaple.

heres the object init in 3den.

Spoiler

this setObjectTextureGlobal [0, "BHWK.paa"];       
this addaction ["Clear Spawn Area", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];}];      
this addaction ["Spawn Ghost Hawk", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,1] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Little Bird", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,2] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Black Hawk", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,3] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Black Hawk Armed", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,4] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Wildcat", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,5] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Wildcat Armed", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,6] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Huey", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,7] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Huey Armed", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,8] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Puma", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,9] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Merlin", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,10] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Merlin VIV", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,11] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn MI-171", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,12] remoteExec ["CK_FNC_SPWNV",2];}];      
this addaction ["Spawn Harbin", {      
 _this select 1;      
 _CK_CLR = [CK_HTRN1_1] remoteExec ["CK_FNC_CLR",2];      
 _CK_SPWNV = [CK_HTRN1_1,getposasl CK_HTRN1_1 select 2,13] remoteExec ["CK_FNC_SPWNV",2];}];

 


Okay so theres that, heres the problem. When spawning a vehicle everything fires without a problem but the additional addactions for the vehicle are missing "Disable main rotor" etc... In the past this was all embeded in each individual addaction and it worked but now for some reason the additional addactions are not added to the spawned vehicle. This is working when I host locally. Thanks for any help!

Share this post


Link to post
Share on other sites

I may be completely wrong and way far away from the right track, but are you sure that all the clients have access to the .sqfs that are called?

  • Like 1

Share this post


Link to post
Share on other sites

If I'm right, you create vehicles on server (normal), then apply addAction locally (so on server only). You need to remoteExec the addAction itself. Example:

[_vic, ["Rearm", { _this select 1; [(_this select 0) , 1] remoteExecCall ["setVehicleAmmo", owner (_this select 0)]; }] ] remoteExec ["addAction", -2];

(-2 is fine for clients on dedicated server).

Don't mistake the remote execution for the addAction menu on clients, for the remote execution of some necessary parts on the run code (due to arguments or effects local of the used commands).

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Could recycle some of that code a bit,

you_fnc_cleanUp={

	params ["_area", "_hint"];
	{{deleteVehicle _x} forEach crew _x + [vehicle _x]}forEach (vehicles inAreaArray _area);
	hint _hint;
};

[TNKCLR, "Static Armor Clear"] call you_fnc_cleanUp;

Have fun!

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@pierremgi Thanks, I was thinking it was a locality issue but couldn't figure it out, I'll give that a try.

@wogz187 Always room for improvement, once I fix this addaction issue I'll break improve other things!

  • Like 1

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

×