Announcement

Collapse
No announcement yet.

RPG Shotfinder Script v1

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • RPG Shotfinder Script v1

    I'm back with another script. This script determines the direction of an RPG shot near the vehicle that the script is running on. Right now, the max range of the detection is about 70m, and no, I cannot change that as of yet.

    Both scripts are to be placed in the mission folder. The script "sf_startEH.sqf" is to be called in the vehicle you wish to have the shot finder system active. The script will tell players via the vehicle chat the direction of the RPG in relation to the vehicle in clock bearing.

    Download Link: http://www.mediafire.com/?12247wolcyh4wl5

    Code:

    sf_startEH.sqf
    Code:
    //ShotFinder Eventhandler Script
    //Script Call Line: nul=[this]execVM "sf_startEH.sqf";
    //Call line placed in  vehicle's init
    //Script by Blackpython of TacticalGamer.com
    private ["_veh"];
    _veh = _this select 0;
    nul=_veh addEventHandler ["FiredNear", {nul= _this execVM "shotfinder.sqf";}];
    Shotfinder.sqf
    Code:
    //Shotfinder.sqf
    //Script by Blackpython of TacticalGamer.com
    private ["_vehLoc","_veh","_firer","_dist","_ammo","_rDir","_fireLoc","_xcor","_ycor","_ammoArray","_sDir","_rdir","_vDir"];
    
    _veh = _this select 0;
    _firer = _this select 1;
    _dist = _this select 2;
    _ammo = _this select 6;
    
    _vDir = getDir _veh;
    _ammoArray = ["R_PG7V_AT", "R_PG7VL_AT", "ACE_R_PG7VM_AT", "R_PG7VR_AT", "R_PG9_AT", "ACE_Rocket_PG29", "ACE_R_TBG7V_AT", "ACE_Rocket_TBG29"];
    
    _vehLoc = getpos _veh;
    _fireLoc = getpos _firer;
    _xcor = (_fireLoc select 0) - (_vehLoc select 0);
    _ycor = (_fireLoc select 1) - (_vehLoc select 1);
    
    if ((_ammo in _ammoArray)) then
    {    
    
        switch (true) do
        {
            case ((_xcor > 0)  && (_ycor > 0)): //Quadrent I
            {
                _sDir = asin (abs(_xcor) / _dist);
            };
            case ((_xcor < 0)  && (_ycor > 0)): //Quadrent II
            {
                _sDir = (360 - (asin (abs(_xcor) / _dist)));
            };
            case ((_xcor < 0)  && (_ycor < 0)): //Quadrent III
            {
                _sDir = (270 - (asin (abs(_ycor) / _dist)));
            };
            case ((_xcor > 0 ) && (_ycor < 0)): //Quadrent IV
            {
                _sDir = (90 +(asin (abs(_ycor) / _dist)));
            };
            case default
            {
                hint "Script broked";
            };
        };
        _rDir = _sDir - _vDir;
        if (_rDir < 0) then {_rdir = _rdir + 360};
    
        switch (true) do
        {
            case ((_rDir > 345) ||(_rDir <= 15)):
            {
                _veh vehicleChat "RPG : 12 O'Clock";
            };
            case ((_rDir > 15) && (_rDir <= 45)):
            {
                _veh vehicleChat "RPG : 1 O'Clock";
            };
            case ((_rDir > 45) && (_rDir <= 75)):
            {
                _veh vehicleChat "RPG : 2 O'Clock";
            };
            case ((_rDir > 75) && (_rDir <= 105)):
            {
                _veh vehicleChat "RPG : 3 O'Clock";
            };
            case ((_rDir > 105) && (_rDir <= 135)):
            {
                _veh vehicleChat "RPG : 4 O'Clock";
            };
            case ((_rDir > 135) && (_rDir <= 165)):
            {
                _veh vehicleChat "RPG : 5 O'Clock";
            };
            case ((_rDir > 165) && (_rDir <= 195)):
            {
                _veh vehicleChat "RPG : 6 O'Clock";
            };
            case ((_rDir > 195) && (_rDir <= 225)):
            {
                _veh vehicleChat "RPG : 7 O'Clock";
            };
            case ((_rDir > 225) && (_rDir <= 255)):
            {
                _veh vehicleChat "RPG : 8 O'Clock";
            };
            case ((_rDir > 255) && (_rDir <= 285)):
            {
                _veh vehicleChat "RPG : 9 O'Clock";
            };
            case ((_rDir > 285) && (_rDir <= 315)):
            {
                _veh vehicleChat "RPG : 10 O'Clock";
            };
            case ((_rDir > 315) && (_rDir <= 345)):
            {
                _veh vehicleChat "RPG : 11 O'Clock";
            };
            case default
            {
                hint "scriptbroked";
            };
        };
    };
    Blackpython / ZephyrDark
    Former 31st RECCE Member

Connect

Collapse

TeamSpeak 3 Server

Collapse

Advertisement

Collapse

Twitter Feed

Collapse

Working...
X