Jump to content
Sign in to follow this  
doctorbutts

Why doesn't it work on dedicated?!!?

Recommended Posts

I'm at my wits end. Everything works fine in 3den when testing, but not in dedicated.


I can get EVERYTHING to work if it is all called in init.sqf, but the problem is that the scripts called in there are run for every player on the server- meaning that if i have a spawn_badguys.sqf, a bad guy is spawned for each player on the server. aka it's executed globally.

 

So, I moved a lot of stuff to initServer.sqf. It works fine in 3den. However, it seems to do absolutely nothing on a dedicated server. Even if i do a isServer in init.sqf, it still won't fire off that code at all.

I tried first defining the variables in init.sqf, then tried defining them in initServer.sqf. I've put the arrays in both as well. The scripts simply do not seem to fire at all on initServer.sqf on dedicated.

 

When I tried going into the in-game console on the server, I tried manually running the script and used the 'server' execute option. The arma3 log throws an error saying there's an undefined variable.. but I defined that variable in init.sqf. So, I tried making it a public variable in init.sqf, and that was fine until the script needed an array that was defined in init.sqf.

What am I doing wrong? This all seemed to work just fine with another mission I had created a while ago, and I tried to copy the 'layout' there as well. Nothing seems to work for this.

Share this post


Link to post
Share on other sites
1 hour ago, doctorbutts said:

What am I doing wrong?

 

Not sharing your code.

  • Like 2

Share this post


Link to post
Share on other sites

hoo boy, ok  here goes:

init.sqf:

//HA▯ARD ▯ONE

rtg = 0;
#include "briefing.sqf";

recurring_left = "RecurringLeft" call BIS_fnc_getParamValue;
t_mult = "TimeMulti" call BIS_fnc_getParamValue;

can_land = 0;
landing = 0;
can_takeoff = 0;
plane_in = 0;
takingoff = 0;
bomb_truck_active = 0;
bad_house_active = 0;
blu_in_house = 0;
plane_cam = 1;

de_plane setVariable ["argle",false,true];
de_plane setVariable ["bargle",true,true];
de_plane setVariable ["poopie",false,true];


civ_unit_array = ["UK3CB_TKC_I_CIV"];

civ_clothes_array = ["UK3CB_ADC_C_U_01","UK3CB_ADC_C_U_01_B","UK3CB_ADC_C_U_01_C","UK3CB_ADC_C_U_01_D","UK3CB_ADC_C_U_01_E","UK3CB_ADC_C_U_01_F","UK3CB_ADC_C_U_01_G","UK3CB_ADC_C_U_01_H","UK3CB_ADC_C_U_01_I","UK3CB_ADC_C_U_01_J","UK3CB_ADC_C_U_01_K","UK3CB_TKC_I_U_01","UK3CB_TKC_C_U_01","UK3CB_TKC_C_U_01_B","UK3CB_TKC_C_U_01_C","UK3CB_TKC_C_U_01_D","UK3CB_TKC_C_U_01_E","UK3CB_TKC_C_U_02","UK3CB_TKC_C_U_02_B","UK3CB_TKC_C_U_02_C","UK3CB_TKC_C_U_02_D","UK3CB_TKC_C_U_02_E","UK3CB_TKC_C_U_03","UK3CB_TKC_C_U_03_B","UK3CB_TKC_C_U_03_C","UK3CB_TKC_C_U_03_D","UK3CB_TKC_C_U_03_E","UK3CB_TKC_C_U_06","UK3CB_TKC_C_U_06_B","UK3CB_TKC_C_U_06_C","UK3CB_TKC_C_U_06_D","UK3CB_TKC_C_U_06_E"];

civ_hat_array = ["","","","","","","","","","","","","","","UK3CB_TKC_H_Turban_01_1","UK3CB_TKC_H_Turban_02_1","UK3CB_TKC_H_Turban_06_1","UK3CB_TKC_H_Turban_03_1","UK3CB_TKC_H_Turban_04_1","UK3CB_TKC_H_Turban_05_1","UK3CB_H_Beanie_02_Win","UK3CB_H_Beanie_02_BRN"];

bad_grp_units = ["UK3CB_TKM_O_RIF_1","UK3CB_TKM_O_RIF_2","UK3CB_TKM_O_ENG","UK3CB_TKM_O_MD","UK3CB_TKM_O_AR","UK3CB_TKM_O_AT","UK3CB_TKM_O_MK","UK3CB_TKM_O_LAT","UK3CB_TKM_O_GL","UK3CB_TKM_O_MG"];

civ_cars = ["UK3CB_C_Hilux_Open","UK3CB_C_Kamaz_Open","UK3CB_C_Pickup","UK3CB_C_V3S_Closed","C_Van_01_transport_F"];

bad_grp_spawn = [[11237.1,2821.85],[11315.4,2859.39,0],[11445.1,2857.42,0],[11526.9,2842.14,0],[11606.4,2809,0],[11071.4,2893.86,0],[10875.9,2712.6,0],[11091.8,2258.69,0]];

bad_tech_vehs = ["UK3CB_TKM_O_Hilux_Dshkm","UK3CB_TKM_O_Datsun_Pkm","UK3CB_TKM_O_Hilux_Pkm","UK3CB_TKM_O_Hilux_Rocket","UK3CB_TKM_O_Hilux_Zu23","UK3CB_TKM_O_Pickup_M2","UK3CB_TKM_O_Pickup_DSHKM","UK3CB_ADE_O_V3S_Zu23"];

bad_tech_spawn = [[11061.4,3176.12,0],[11379,2961.92,0],[12240.3,2286.22,0],[11727.1,2849.68,0],[10684.3,3574.97,0]];

civ_speedmode = ["FULL","NORMAL"];

car_speedmode = ["LIMITED","NORMAL"];

civ_bags = ["B_CivilianBackpack_01_Everyday_Astra_F","B_CivilianBackpack_01_Everyday_Black_F","B_CivilianBackpack_01_Everyday_Vrana_F","B_Messenger_Black_F","B_Messenger_Coyote_F","B_Messenger_Gray_F","UK3CB_CW_SOV_O_LATE_B_Sidor_RIF","UK3CB_CW_SOV_O_EARLY_B_Sidor_RIF","UK3CB_CPD_B_B_ASS_BLU","fanny_pack1"];

civ_beans = ["ACE_Banana","ACE_fieldDressing","ACE_Can_Franta","ACE_Can_RedGull","ACE_Can_Spirit","ACE_Canteen","dmpCash","FirstAidKit","ACE_Humanitarian_Ration","dmpPainkillers","dmpRice","dmpTacticalBacon","dmpBeans","dmpFlashDrive","ACE_WaterBottle"];

bag_guns = ["rhs_weap_ak74","rhs_weap_makarov_pm","rhs_weap_M590_5RD"];

IED_list = ["rhs_ec200_sand_ammo","IEDLandSmall_Remote_Ammo","IEDUrbanSmall_Remote_Ammo","DemoCharge_Remote_Ammo_Scripted"];

de_plane addEventHandler ["HandleDamage", {if (isNull (_this select 3)) then { 0; } else { _this select 2; }; }];

occupied_buildings = ["land_ffaa_casa_urbana_7","land_ffaa_casa_urbana_4","land_jbad_House_c_9","land_jbad_House_c_10"];

indoor_lights = [light_2,light_3,light_4];
hangar_lights = [light_1];

if ("AIpilot" call BIS_fnc_getParamValue == 1) then {
	land_chat = compileScript ["logistics\plane_land_chat.sqf"];
	ai_takeover = compileScript ["logistics\ai_takeover.sqf"];
	do_landing = compileScript ["logistics\landing.sqf"];
	takeoff = compileScript ["logistics\takeoff.sqf"];
	landing = compileScript ["logistics\landing.sqf"];
	pre_landing = compileScript ["logistics\pre_landing.sqf"];
	pre_takeoff = compileScript ["logistics\pre_takeoff.sqf"];
};



if ("AIpilot" call BIS_fnc_getParamValue == 1) then {
	deleteMarker "approach_2";
	deletemarker "end_mark";
	aux_pilot allowDamage false;
	aux_pilot moveInGunner de_plane;
	aux_pilot allowDamage false;
	aux_pilot moveInGunner de_plane;
	de_plane action ["CollisionLightOn", de_plane];
	de_plane action ["lightOn", de_plane];
	de_plane lockDriver true;
	_ace_land = ["Clear to Land","Clear to Land","\A3\ui_f\data\igui\cfg\simpleTasks\types\land_ca.paa",{[] spawn pre_landing;},{true}] call ace_interact_menu_fnc_createAction;
	_ace_takeoff = ["Clear to Takeoff","Clear to Takeoff","\A3\ui_f\data\igui\cfg\simpleTasks\types\takeoff_ca.paa",{[] spawn pre_takeoff;},{true}] call ace_interact_menu_fnc_createAction;
	
	[the_radio, 0, ["ACE_MainActions"], _ace_land] call ace_interact_menu_fnc_addActionToObject;
	[the_radio, 0, ["ACE_MainActions"], _ace_takeoff] call ace_interact_menu_fnc_addActionToObject;

	#include "ai_brief.sqf";
};

if ("AIpilot" call BIS_fnc_getParamValue == 0) then {
	[west, "dropoff", ["Land and allow evacuees to disembark.", "Deliver Evacuees", ""], [11644.4,16950.7,0], "CREATED", 2, true,"land",true] call BIS_fnc_taskCreate;
	the_pilot moveInDriver de_plane;
	[] execVM "logistics\invincible_landing.sqf";
};

_ace_spawn = ["All Refugees Died/Request More Refugees","All Refugees Died/Request More Refugees","\A3\ui_f\data\igui\cfg\simpleTasks\types\meet_ca.paa",{[] execVM "logistics\spawncivs.sqf";},{true}] call ace_interact_menu_fnc_createAction;

_ace_more_loads = ["Increase Transport Mission Count","Increase Transport Mission Count","\A3\ui_f\data\igui\cfg\simpleTasks\types\plane_ca.paa",{recurring_left = recurring_left + 1; hint format ["%1 loads of refugees left to deliver", recurring_left]; },{true}] call ace_interact_menu_fnc_createAction;

_ace_last = ["Make this the last load.","Make this the last load.","\A3\ui_f\data\igui\cfg\simpleTasks\types\exit_ca.paa",{recurring_left = 0; hint format ["%1 loads of refugees left to deliver", recurring_left]; },{true}] call ace_interact_menu_fnc_createAction;

[the_radio, 0, ["ACE_MainActions"], _ace_spawn] call ace_interact_menu_fnc_addActionToObject;
[the_radio, 0, ["ACE_MainActions"], _ace_more_loads] call ace_interact_menu_fnc_addActionToObject;
[the_radio, 0, ["ACE_MainActions"], _ace_last] call ace_interact_menu_fnc_addActionToObject;

if ("Arsenal" call BIS_fnc_getParamValue == 1) then {
	[the_crate, true] call ace_arsenal_fnc_initBox;
	//deleteMarker "respawn_west";
};





[] execVM "cameras.sqf";
[] execVM "camera_actions.sqf";
	_camera_reset = ["Camera Reset/Debug","Camera Reset/Debug","\A3\ui_f\data\igui\cfg\simpleTasks\types\use_ca.paa",{[] execVM "cameras.sqf";},{true}] call ace_interact_menu_fnc_createAction;
	[the_radio, 0, ["ACE_MainActions"], _camera_reset] call ace_interact_menu_fnc_addActionToObject;



sleep 20;

[west, "pickup", ["Allow evacuees to load the transport.", "Load Evacuees", ""], [11287.8,2478.4,0], "CREATED", 1, true,"takeoff",true] call BIS_fnc_taskCreate;

rtg = 1;


initServer.sqf
 

[missionNamespace, 1] call BIS_fnc_respawnTickets;
[missionNamespace, -1] call BIS_fnc_respawnTickets;

waitUntil { rtg == 1; };

[] execVM "monitor.sqf";

[] execVM "logistics\spawncivs.sqf";

[] execVM "attacks\spawnbaddies.sqf";

[] execVM "logistics\cleanup.sqf";

setTimeMultiplier t_mult;


 

Share this post


Link to post
Share on other sites
1 hour ago, doctorbutts said:

waitUntil { rtg == 1; };

 

So, initServer.sqf runs before init.sqf in MP. You are going to throw an error here as "rtg" is not yet defined. However, as long as nothing else prevents it, init.sqf might eventually "catch up" and initServer.sqf will continue. You can instead define "rtg" at the top of initServer.sqf to avoid this. 

 

That's the first thing that jumps out at me.

  • Like 1

Share this post


Link to post
Share on other sites

I had put that in right before I posted this: before it wasn't there or called, and had the same issue. I had wanted to double check to make sure other things were defined in the init before the initServer continued. So, even if it isn't there, it's still not working.


For some reason I had it in my head that init.sqf ran before initserver, so i'll try re-arranging things with that in mind later today.

  • Like 1

Share this post


Link to post
Share on other sites

I took it out, and regardless of load order, things should work. It does work when I run the script 'local' on a dedicated server. I don't know why this isn't working.

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  

×