Jump to content
Sign in to follow this  
ZZEZ

check script works on local but not dedicated

Recommended Posts

Heres the issue, I have a script running that checks if mortars are destroyed, if they do it deletes them and broadcasts a message, I also have a trigger changing incity variable depending if BLUFOR are inside or not to true/false.

if(isServer) then
{

//stage 0, setting server variables
mortar1var = 1;
mortar2var = 1;
mortar3var = 1;
mortar4var = 1;
allmortardead = 1;

//stage 1, looping check on mortars to see if they are destroyed and delete wreck
while {!mortarsalive} do {

	sleep 3;

	if (2 > mortar1var) then
	{
		if(!alive mortar1) then
		{
			deleteVehicle mortar1;
			[-1, {hint "Mortar destroyed!";}] call CBA_fnc_globalExecute;
			mortar1var = 5;
		};
	};

	if (2 > mortar2var) then
	{
		if(!alive mortar2) then
		{
			deleteVehicle mortar2;
			[-1, {hint "Mortar destroyed!";}] call CBA_fnc_globalExecute;
			mortar2var = 5;
		};
	};

	if (2 > mortar3var) then
	{
		if(!alive mortar3) then
		{
			deleteVehicle mortar3;
			[-1, {hint "Mortar destroyed!";}] call CBA_fnc_globalExecute;
			mortar3var = 5;
		};
	};

	if (2 > mortar4var) then
	{
		if(!alive mortar4) then
		{
			deleteVehicle mortar4;
			[-1, {hint "Mortar destroyed!";}] call CBA_fnc_globalExecute;
			mortar4var = 5;
		};
	};

	//stage 2, check if all mortars are destroyed, if yes then objective 1 complete and incity check is being run to see if BLUFOR inside city, also stops the mortarchecks
	if(allmortardead == 1) then
	{
		if(!alive mortar1 && !alive mortar2 && !alive mortar3 && !alive mortar4) then
		{
			[-1, {mortarsalive = true;"1" objStatus "DONE"; tskobj_1 setTaskState "SUCCEEDED";}] call CBA_fnc_globalExecute;	
			allmortardead = 2;
		};
	};
};

//stage 3, once there are no BLUFOR inside the city the it will set task 2 to done and end the mission.
while {mortarsalive} do{
sleep 5;
[-1, {hint "mortarsalive line 70";}] call CBA_fnc_globalExecute;
	if(!incity and mortarsalive) then
	{
		[-1, {hint "Mission complete";"2" objStatus "DONE"; tskobj_2 setTaskState "SUCCEEDED"; ForceEnd;}] call CBA_fnc_globalExecute; win = [1] execVM "f\server\f_mpEndBroadcast.sqf";
	};
};
};

The problem is when it gets to stage 3, on LOCAL server it works perfectly fine but on dedicated for some reason its not running the 3rd stage, even that "mortarsalive line 70" hint doesn't work...but on local it does and I am pretty much clueless on how to solve it.

Init.sqf

//mortar variables
mortarsalive = false;
publicvariable "mortarsalive";
incity = false;
publicvariable "incity";

//mortar check script
if (isServer) then
{
[] execVM "mortarcheck.sqf";
};

Whelp?

---------- Post added at 03:30 PM ---------- Previous post was at 03:10 PM ----------

Issue solved, I ended up moving whatever was in the init.sqf to the script itself and removing the publicvariables statement, its working now.

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  

×