Jump to content
Sign in to follow this  
Lucky44

remoteExec and moving popup targets

Recommended Posts

I'm looking for scripting advice from those who know (and understand) more about sqf than I do.

 

I'm trying to have map triggers initialize the movement of moving targets, like the "Target_Popup_Moving_F". The problem I'm having is getting the movement to work properly on each client on a dedicated server. The code works fine on SP, but on dedi or hosted, clients don't see the proper movement of the targets. Usually, it seems like the target doesn't move at all, then when the movement should be ended, the target teleports to the end position (on the clients).

 

Here's what I'm doing. I have a function, fn_MovingTargetOnce, in a script called movTarOnce1.sqf, (in a folder called scripts) which looks like this:

/*
This function can be used by putting the following in moving target's Init:

   handle = [tar2,((direction tar2) + 0),10,0.1,.3] spawn fn_MovingTargetOnce;

   where tar2 is the name of the moving target. Other parameters below.

---->Note: target animationPhase 1 is down, and animationPhase 0 is up.
*/

fn_MovingTargetOnce =
{
	private ["_target","_distance","_speed","_dir"];
	if (!isServer) exitWith {};

	_target = _this select 0;
	_dir = _this select 1; // direction of travel (and opposite)
	_distance = _this select 2; // how far to travel in each direction
	_speed = _this select 3; // speed of movement
	_pause = _this select 4; // pause at either end

	sleep _pause;
	for "_i" from 0 to _distance/_speed do
	{
		_target setPos
		[
			(position _target select 0) + ((sin (_dir)))*_speed,
			(position _target select 1) + ((cos (_dir)))*_speed,
			0
		];
		sleep 0.01;

	};
	sleep 0.05;
};

And I'm initializing that in the init.sqf like this:

execVM "scripts\movTarOnce1.sqf"; // set up the function for moving targets once

I've tried using BIS_fnc_MP in the trigger's onActivation, like this:

[[tar2,((direction tar2) + 0),10,0.1,.01],"fn_MovingTargetOnce"] call BIS_fnc_MP;

And I've tried using remoteExec in the trigger's onActivation like this:

[tar2,((direction tar2) + 0),10,0.1,.01] remoteExec ["fn_MovingTargetOnce"] ;

But neither work on the clients. -I'm probably just not understanding remoteExec completely, so any insight will be VERY welcome.

Share this post


Link to post
Share on other sites

I'm still eager for help on this. My current question is whether a script that's trying to move an object over the network 100 times per second could create problems since the netcode isn't getting sent that often. Does that seem accurate? If so, is there a solution? Would moving the object at a slower rate, more like 20 times per second, help?

Share this post


Link to post
Share on other sites

OK, last request: does anyone know how to make moving popup targets work in MP (on dedi server) ?

Share this post


Link to post
Share on other sites

I've been seeking for an answer to this problem for as long as Arma 3 has been alive. Would this guy's code help at all?

https://www.gruppe-w.de/forum/viewthread.php?thread_id=2235&pid=27160

 

To save some time, a Google translation of the German:

I originally stood before the problem that I wanted to build calibration Kill House. There need be no secret that should be Arma 3 kind S.W.A.T-Missionfür. When I've been thinking a concept I have remembered the Shooting Ranges from Bohemia Interactive. (You know when there were not content and they have tried with Time Trials to keep us at the bar;)) Anyway, there was this moving targets that are driven on rails to and fro, or to too. Kill Houses and Shooting Ranges available by now to satisfy, but hardly any that use moving targets, and if they do, regular targets that slide on magical way across the floor.
The necessary objects are in the editor, but who has desire to tinker, the for each rail together, and then have to move the whole yet.


I have therefore made a script to design, build the user-friendly automatic moving targets and can be moved. About parameters should one can set how long the track is that alignment has the goal as fast, how often and when ever it moves.

A big part is done , it runs quite passable in Single Player . Now I stand before the whole hurdle on the ded . Server to get to work.
Crux is obviously the eternally annoying issue locality . The whole construct , as performed on the Intit - line of the first rail section running course on each client , and many players you have of course several targets that seemed to swing back and forth , which although looks very funny , but not really his fulfilled purpose . Even better , it will probably be later in the " Hit " event handlers . A simple "if exit with { } ( IsServer ! ) ; " has not solved the problem .
( Would have been nice )

is called up the whole by placing the first rail section as an object in the editor , and the init - line ( or alternatively inti.sqf or so ) the script " initTargetRailExt.sqf " . The script then builds the basis of the parameters the rail at the first segment and in turn, calls the script " moveTargetRailExt.sqf " on what governs the movement has its own array .

The best way is probably recognized by the script itself . The documentation is entirely in English , because I wanted to leave me open to release it .

To control how the target fold up and down is that Bohemia Script " PopUpTarget.sqf " in connection with " nopop = true " used init.sqf in the modified form . This should rather make no problems .

Because there are some very experienced programmers and I would appreciate ideas and suggestions very .
Here once the download of the mission :

Moving Target Test Mission

Maybe I could even inspire one or the other of the idea .

Good luck and keep searching, I'm keen for this too!!

Share this post


Link to post
Share on other sites

If you want to execute that script remotely one somebody

 

a.) use remoteExec since the bis_fnc_mp is deprecated

b.) Read the wiki entry for remoteExec correctly. The line must be this:

[tar2,((direction tar2) + 0),10,0.1,.01] remoteExec ["fn_MovingTargetOnce",<target>];

And for the target you can use allPlayers to adress all players in the game, or just an ownerID of a unit you get via (owner cursorTarget) for example or any other allowed target. Go and check for the wiki links below. Do not use nothing as target, since you do not want to adress the server with that, don't you? 

 

You can find all required information here:

 

https://community.bistudio.com/wiki/remoteExec

https://community.bistudio.com/wiki/Arma_3_Remote_Execution

https://community.bistudio.com/wiki/owner

 

Read those pages and you will be fine!

 

 

Regards Arkensor

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  

×