Jump to content
Sign in to follow this  
gokitty1199

animate not working globally

Recommended Posts

to sum it up, i have literally 99% of the code running on the server only as the clients just trigger events for the server to handle. i have a hit event handler that gets applied to a target, when the target is hit twice, i use _Target animate ["terc", 1]; to drop the target. this is only going to run on the server, but animate is global. when i shoot the target(as the server) the target drops for me but nobody else, when a client shoots the target twice, it drops for me (the server) but nobody else and not even the client. i tried remoteexec it like so [_Target, ["terc", 1]] RemoteExec ["animate", 0, true]; just to see if that would solve my issue without any luck. any ideas? i just want the target to drop for all the clients

		_x AddEventHandler["Hit",
		{
			params ["_Target", "_Weapon", "_Damage", "_Shooter"];
			_SetShooter = _Target GetVariable "Shooter";
			_Active = _Target GetVariable "Active";
			_IsTargetDone = _Target GetVariable "Done";
			_Stage = _Target GetVariable "Stage";
			_Timer = _Target GetVariable "Timer";
			
			if (_Active && !_IsTargetDone && _SetShooter == _Shooter) then
			{
				_HitCount = _Target GetVariable "HitCount";
				_HitCount = _HitCount + 1;
				_Target SetVariable ["HitCount", _HitCount];
				
				if (_HitCount >= 2) then
				{
					[_Target, ["terc", 1]] RemoteExec ["animate", 0, true];
					//_Target animate ["terc", 1];
					_Target SetVariable ["Done", true];
					_TargetsDone = _Timer GetVariable "TargetsDone";
					_TargetsDone = _TargetsDone + 1;
					_Timer SetVariable ["TargetsDone", _TargetsDone];
				};
			};
			
			_IsTargetDone = _Target GetVariable "Done";
			if (_IsTargetDone && _Active) then
			{
				_Target SetVariable ["Active", false];
				_TargetsDone = _Timer GetVariable "TargetsDone";
				_TargetCount = _Timer GetVariable "TargetCount";
				[format["%1 Eliminated %2/%3 Targets", name _SetShooter, _TargetsDone, _TargetCount]] call HintToEveryone;
			};
		}];

 

Share this post


Link to post
Share on other sites

Try using an MPHit EH (with addMPEventhandler command) and use animateSource instead animate and ditch the remoteExec.

From a quick glance at your snippet this might solve the issue.

 

Cheers

Share this post


Link to post
Share on other sites
9 hours ago, Grumpy Old Man said:

Try using an MPHit EH (with addMPEventhandler command) and use animateSource instead animate and ditch the remoteExec.

From a quick glance at your snippet this might solve the issue.

 

Cheers

will give that a try in a few hours, thanks for the suggestion!

Share this post


Link to post
Share on other sites
14 hours ago, Grumpy Old Man said:

Try using an MPHit EH (with addMPEventhandler command) and use animateSource instead animate and ditch the remoteExec.

From a quick glance at your snippet this might solve the issue.

 

Cheers

this did not change anything. as a test (using mpeventhandler) i set it up so that the animatesource code would run on all clients (it prints out a hint on the clients where the animatesource line is so it is running) and it still only gets animated on the server. no matter what i do the target will not drop in multiplayer for some reason.

 

edit: found the problem, it was actually related to the target itself TargetBootcampHumanSimple_F. i was using these because they did not fold down when shot by default, but they could still be animated. when animating these targets via animate/animateSource, they are not animated globally, but when i switched the target for one that is suppose to fold down and come back up when shot, it worked perfectly and animateSource was working as intended.

 

edit: WELL APPARENTLY IT WONT ANIMATE FOR OTHER CLIENTS IF YOU HAVE ENABLED SIMULATION UNCHECKED

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  

×