Jump to content
Sign in to follow this  
Martinez.E

Script not working on multiplayer dedicated server, works fine on editor

Recommended Posts

    Actually, other than the setVariable to stop others from using the range, I guess it's all local anyway.  Oh well :)

thanks for the help, at least i can base my other ranges off of this now

Share this post


Link to post
Share on other sites

Tested as working on hosted and dedicated server

It still pops up multiple targets and goes past number of max targets on the server. It has to be something with multiple people on the server, as it works fine when i am on the server alone doing it or in editor.

Share this post


Link to post
Share on other sites

It still pops up multiple targets and goes past number of max targets on the server. It has to be something with multiple people on the server, as it works fine when i am on the server alone doing it or in editor.

 

How are you running the script?  I tested with three people on a hosted and dedicated server and didn't see that happening.

Share this post


Link to post
Share on other sites

How are you running the script?  I tested with three people on a hosted and dedicated server and didn't see that happening.

still running the script off of a range master and it works fine for about half of the time then it starts having additional ones popping up

Share this post


Link to post
Share on other sites

Sounds like the mission is maybe just lagging and commands are getting lost or slowing down.  We could probably just replace most of those remoteExec's with simply local calls, but there's not a lot that that particular script is doing.  Maybe change the call to spawn?

Share this post


Link to post
Share on other sites

Sounds like the mission is maybe just lagging and commands are getting lost or slowing down.  We could probably just replace most of those remoteExec's with simply local calls, but there's not a lot that that particular script is doing.  Maybe change the call to spawn?

Ok so its got something to do with people being close to the rangemaster as i had the shooter call the function as I was standing 10 meters away and the function worked perfectly until the score. it counted him having 8 hits when I was watching him get 38/40.

Share this post


Link to post
Share on other sites

Here is something i did very fast.


/* For messaging the clients via server */
Global_msg = {
	private ["_msg"];	
	params ["_msg"];
	hint _msg;	
};

Start_Loop = {
	/* Start the loop here */
	[] spawn {
		private ["_inc","_count","_targets","_many"];

		_inc   = 0;
		_count   = 0;
		_targets = [pt2, pt2_1, pt2_2, pt2_3, pt2_4, pt2_5];
		_many    =  count _targets;
		{_x  animate["terc",1]} forEach _targets;

		while {true} do 
		{
			_rnumber = floor random _many;
			_rtarget = _targets select _rnumber;
			_rtarget animate["terc", 0];

			sleep 6;

			if (_rtarget animationPhase "terc" > 0.1) then {
				_count = _count+1;
			};

			hint format ["Targets :%1 Hit :%2",_inc+1,_count];

			_rtarget animate["terc", 1];
			_inc = _inc + 1;

			if (!(Loop_Alive)) exitWith {
				hint "Session Complete,";

				sleep 5;

				if (_count >= 36) exitWith {
					hint "You Scored EXPERT";
				};

				if (_count <= 32)  exitWith {
					hint "You Scored SHARPSHOOTER";
				};

				if (_count <= 23)  exitWith {
					hint "You Scored MARKSMAN";
				};

				if (_count <= 9) exitWith {
					hint "You Scored Below Minimum Standards, Try Again";
				};
			};
		};
	};
};

/* Must run serverside so everyone is equaltd with the timing on the loop */
if (isServer) then {
	private ["_msg"];

	Loop_Alive = false;
	publicVariable "Loop_Alive";

	_msg "Welcome to the 82nd Airborne Division Qualification Range";
	[_msg] remoteExec ["Global_msg"];
	sleep 5;
	_msg "Remember to reload!";
	[_msg] remoteExec ["Global_msg"];
	sleep 5;
	_msg "Setting up the Range";
	[_msg] remoteExec ["Global_msg"];
	sleep 3;
	_msg "The Qualification Course will begin in 10 Seconds";
	[_msg] remoteExec ["Global_msg"];
	sleep 2;
	_msg "The Qualification Course will begin in 8 Seconds";
	[_msg] remoteExec ["Global_msg"];
	sleep 2;
	_msg "The Qualification Course will begin in 6 Seconds";
	[_msg] remoteExec ["Global_msg"];
	sleep 2;
	_msg "The Qualification Course will begin in 4 Seconds";
	[_msg] remoteExec ["Global_msg"];
	sleep 2;
	_msg "The Qualification Course will begin in 2 Seconds";
	[_msg] remoteExec ["Global_msg"];
	sleep 2;
	_msg "Begin!";
	[_msg] remoteExec ["Global_msg"];
	[] remoteExec ["Start_Loop"];

	Loop_Alive = true;
	publicVariable "Loop_Alive";

	sleep 8;

	Loop_Alive = false;
	publicVariable "Loop_Alive";
};

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  

×