There are a couple of answers to moving targets here although I didn't get either to work for me.
http://forums.bistudio.com/showthrea...=moving+target
I did get this bit of script working.
Calling it with
null=[targets,direction,angle,distance] execvm "targetmove.sqf"
wroks but it should be a function call really.
Code:
/*
File: targetMove.sqf
Author: Joris-Jan van 't Land
Description:
Make a moving target move.
Parameter(s):
null=[target,direction,angle,distance] execvm "targetmove.sqf"
*/
private ["_tgt", "_dir", "_angle", "_dist", "_startPos"];
_tgt = _this select 0;
_dir = _this select 1;
_angle = _this select 2;
_dist = _this select 3;
_startPos = position _tgt;
private ["_targetPos", "_dist", "_dX", "_dY", "_duration", "_ticks"];
if (_dir == 0) then {_dist = -_dist};
_targetPos = [_startPos, _dist, _angle - 90] call BIS_fnc_relPos;
_duration = 1 + round(((_tgt distance player) / 50));
_ticks = _duration * 100;
_dX = ((_targetPos select 0) - (_startPos select 0)) / _ticks;
_dY = ((_targetPos select 1) - (_startPos select 1)) / _ticks;
for "_tick" from 0 to (_ticks - 1) do
{
if (!LIB_abortChallenges) exitWith {};
_tgt setPos [((position _tgt) select 0) + _dX, ((position _tgt) select 1) + _dY, 0];
sleep 0.1;
};
LIB_targetMoved = true;
true