Brick icon

A3 Moving Target

Brick | PRO | 09/18/16 01:32:52 AM UTC | 0 ⭐ | 222 👁️ | Never ⏰ | []
SQF |

2.73 KB

|

None

|

0 👍

/

0 👎

private _mat = "ShootingMat_01_Olive_F" createVehicle [0, 0, 0];
_mat setPos getPos player;
_mat setDir getDir player;
 
_mat setVariable ["targetMin", 600, true];
_mat setVariable ["targetMax", 1200, true];
 
[
    _mat,
    {
        _this addAction
        [
            format
            [
                "<t color='#00FF00'>Reset Target (%1m - %2m)</t>",
                _mat getVariable "targetMin",
                _mat getVariable "targetMax"
            ],
            {
                private _target = param [0];
                private _caller = param [1];
                private _ID     = param [2];
                private _args   = param [3];
 
                deleteVehicle (_target getVariable ["currentTarget", objNull]);
 
                private _newObject = "TargetBootcampHumanSimple_F" createVehicle [0, 0, 0];
                _target setVariable ["currentTarget", _newObject];
 
                private _min = _target getVariable "targetMin";
                private _max = _target getVariable "targetMax";
 
                private _distance = random (_max - _min) + _min;
 
                hint format ["Target Distance: %1", round _distance];
 
                _newObject setPos (_target getRelPos [_distance, 0]);
                _newObject setDir (getDir _target);
 
                _newObject addEventHandler
                [
                    "HitPart",
                    {
                        private _params = param [0];
 
                        private _target   = _params param [0];
                        private _position = _params param [3];
                        private _direct   = _params param [10];
 
                        if (_direct) then
                        {
                            private _hitMarker = "Sign_Sphere10cm_F" createVehicleLocal [0, 0, 0];
                            _hitMarker setObjectTextureGlobal [0, "#(rgb,8,8,3)color(0,1,1,1)"];
                            _hitMarker setPosASL _position;
 
                            _hitMarker spawn
                            {
                                uiSleep 1;
                                deleteVehicle _this;
                            };
                        };
                    }
                ];
            },
            [ ],
            5,
            true,
            false
        ];
 
        _this addAction
        [
            "<t color='#FF0000'>Pack Up</t>",
            {
                private _target = param [0];
 
                deleteVehicle (_target getVariable "currentTarget");
 
                deleteVehicle _target;
            },
            [ ],
            5,
            true,
            false
        ];
    }
] remoteExec ["call", 0];

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎