XxRTEKxX

Cloaking Device

21 posts in this topic

This is a cloaking device script we made a while back on the bohemia forums. It uses the VR suits, and gives the player wearing the VR suit the ability to cloak. Cloak lasts for 60 seconds and has a recharge time of 30 seconds. This can be adjusted to whatever times you want.

init.sqf

player addAction ["Cloak", "cloak.sqf", [], 6, false, true, ""];
cutRsc ["CLOAK_BAR","PLAIN"];

description.ext

#define CT_PROGRESS         8 
class RscTitles 
 { 
    class RscProgress 
    { 
        type = 8; 
        style = 0; 
        shadow = 2; 
        colorFrame[] = {0,0,0,1}; 
        colorBar[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.69])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.75])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.5])","(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"};  
        texture = "\A3\ui_f\data\GUI\RscCommon\RscProgress\progressbar_ca.paa";  
        w = 0.25; 
        h = 0.03; 
    };     
        class CLOAK_BAR 
        { 
            idd = 10000; 
            onload ="((_this select 0) displayCtrl -1) progressSetPosition 1;uiNamespace setVariable [""TAG_CLOAKBAR"", _this select 0];_this ExecVM 'Cloak_ProgressBar.sqf';"; 
            duration = 10000000; 
            class Controls 
            { 
                class Progress: RscProgress  
                    { 
                        idc = -1; 
                        x = 0.849 * safezoneW + safezoneX; 
                        y = 0.9350 * safezoneH + safezoneY; 
                    }; 
            }; 
        }; 
  };

Cloak.sqf 

///Authors: XxRTEKxX, HallyG, and DreadedEntity
_Unit = _this select 0;  
_id = _this select 2;  
_Unit removeAction _id;  
//Put in and/or Remove any of these uniforms to customize the uniform restriction. 
UsableUniforms = ["U_B_Protagonist_VR","U_B_Soldier_VR","U_C_Soldier_VR","U_I_Protagonist_VR","U_I_Soldier_VR","U_O_Protagonist_VR","U_O_Soldier_VR"]; 
  
  
  
If ((uniform _Unit) in UsableUniforms) then  
        { 

        // You can change these and it'll do the rest woooo  
        timer = 60;   
        cooldown = 30;  

        _source = "#particlesource" createVehiclelocal getpos _Unit;  
        _source setParticleCircle [0, [0.1, 0.1, 0.1]]; 
        _source setParticleRandom [0, [0, 0.1, 1], [0.1, 0, 0.1], 0, 0.1, [0, 0, 0, 0.1], 0, 0]; 
        _source setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract", 1, 0, 1], "", "Billboard", 1, 4, [0, 0, 0], [0, 0, 0.5], 9, 10, 7.9, 0.1, [0.6, 1, 0.9, 0.8], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0, 0.1, 0.2, 0.5, 0.1, 0.1], 0, 0, "", "", _Unit]; 
        _source setDropInterval 0.1;  
        _source attachto [_Unit,[0,0,0]]; 
   
        sleep 1; 

        _Unit hideObjectGlobal true;    
        SystemChat "Cloak Active";    
        _Unit setCaptive true;    

    [timer] spawn  
    {  
        disableSerialization;  
        number = _this select 0;  
        _Display = uiNamespace getVariable "TAG_CLOAKBAR";  
        _setProgress = _display displayCtrl -1;  
        _setProgress progressSetPosition 1;  
        _number = (1/number);  
        BarTimer = 1;   
        for "_i" from 0 to number do   
        {    
            _setProgress progressSetPosition BarTimer;   
            BarTimer = BarTimer - (_number);  
            sleep 1;   

        };   
    };  


    while {!(timer == -1)} do   
        {    
            SystemChat format ["%1 seconds left",timer];   
            timer = timer -1;   
            sleep 1;   
        }; 

    deleteVehicle _source; 
    sleep 1; 
    _Unit hideObjectGlobal false;   
    
    SystemChat "Cloak Deactivated";   
    _Unit setCaptive false;   
   
    [cooldown] spawn  
    {  
        disableSerialization;  
        number = _this select 0;  
        _Display = uiNamespace getVariable "TAG_CLOAKBAR";  
        _setProgress = _display displayCtrl -1;  
        _setProgress progressSetPosition 1;  
        _number = (1/number);  
        BarTimer = 0;   
        for "_i" from 0 to number do   
        {    
            _setProgress progressSetPosition BarTimer;   
            BarTimer = BarTimer + (_number);  
            sleep 1;   

        };   
    };  
    timer = 0;  
    while {!(timer == cooldown)} do   
        {    
            timer = timer +1;   
            sleep 1;   
        };    
   
    _Unit addAction ["Cloak", "cloak.sqf", [], 6, false, true, "",""]; 
    playsound3d ["a3\missions_f_beta\data\sounds\firing_drills\drill_finish.wss",_Unit,false,getPosASL _unit,1,1,100];  
    systemChat "Your cloak has recharged"; 
    _Unit addaction ["Cloak", "Cloak.sqf", [], 6, false, true];   


    } else  
    {  
    // If you're not wearing the correct uniform 
        SystemChat "Your suit is not equipped with the Cloaking Technology"; 
        sleep 1; 
        _Unit addAction ["Cloak", "cloak.sqf", [], 6, false, true, "",""]; 
    };  

Cloak_ProgressBar.sqf 

disableSerialization; 

    _Display = uiNamespace getVariable "TAG_CLOAKBAR"; 
    _setProgress = _display displayCtrl -1; 
    _setProgress progressSetPosition 1;

 

multiplayer compatible version (however it has CBA as a dependancy),
initPlayerLocal.sqf

["MPCloakToggle", { 
    _unit = _this Select 0; 
    _mode = _this Select 1; 
     
    if (_mode) then 
    { 
        _source = "#particlesource" createVehicleLocal getPos _unit; 
        _source setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract.p3d",1,0,1,0],"","Billboard",1,    1,    [0,0,.4],[0,0,1],0,1,1,0,[.25,3,.25,0],[[1,1,1,1],[1,1,1,1]],[1.5,0.5],0,0,"","",_unit]; 
        _source setDropInterval .1; 
        _unit setVariable ["CloakVic", _source]; 
        [_unit] spawn  
        { 
            sleep .4; 
            (_this select 0) hideObjectGlobal true; 
        }; 
    } else { 
        deleteVehicle (_unit getVariable "CloakVic"); 
        [_unit] spawn  
        { 
            sleep .25; 
            (_this select 0) hideObjectGlobal false; 
        }; 
    }; 
}] call CBA_fnc_addEventHandler;

initCloak.sqf

// callscript with 0 = this execVM "initCloak.sqf" from a units init line 
if (str player != str _this) exitWith {}; 

player setVariable ["CloakIsOn", false]; 

_OffId = player addAction ["Turn off cloak",{player setVariable ["CloakIsOn", false]; player setCaptive false; ["MPCloakToggle",[player, false]] call CBA_fnc_globalEvent;}, "",1,true,true,"","(player getVariable ""CloakIsOn"")"]; 
_OnId = player addAction ["Turn on cloak",{player setVariable ["CloakIsOn", true]; player setCaptive false; ["MPCloakToggle",[player, true]] call CBA_fnc_globalEvent;}, "",1,true,true,"","!(player getVariable ""CloakIsOn"")"]; 
player setVariable ["CloakOffActionID", _OffId]; 
player setVariable ["CloakOnfActionID", _OnId]; 
         
0 = [] spawn 
{ 
    while {true} do 
    { 
        waituntil{!alive player}; 
        player removeAction (player getVariable "CloakOffActionID"); 
        player removeAction (player getVariable "CloakOnActionID"); 
        waituntil{alive player}; 
        _OffId = player addAction ["Turn off cloak",{player setVariable ["CloakIsOn", false]; player setCaptive false; ["MPCloakToggle",[player, false]] call CBA_fnc_globalEvent;}, "",1,true,true,"","(player getVariable ""CloakIsOn"")"]; 
        _OnId = player addAction ["Turn on cloak",{player setVariable ["CloakIsOn", true]; player setCaptive false; ["MPCloakToggle",[player, true]] call CBA_fnc_globalEvent;}, "",1,true,true,"","!(player getVariable ""CloakIsOn"")"]; 
        player setVariable ["CloakOffActionID", _OffId]; 
        player setVariable ["CloakOnfActionID", _OnId]; 
    }; 
     
};

 

  • Like 7

Share this post


Link to post
Share on other sites

Nice!

Better with video !

Anyway to make it work without CBA? (multi)

Will look for that issue tomorrow :)

 

 

Edited by nark0t1k
  • Like 3

Share this post


Link to post
Share on other sites
Advertisement

Will players be able to bypass AI and go straight to loot boxes, thereby ending the mission?

This is dependent on how the missions are configured.

Most missions have a condition that the server owner can set, how many of the AI have to be killed to be able to finish the mission.

So, if the server owner set this to 100%, then you would have to kill all AI of that mission to be able to finish it.

Anyways, if this script works like the infistar "Invisible" option, then the AI would not shoot, unless the player shoots first.

Share this post


Link to post
Share on other sites

Anyone else think this kills the Game known as Exile? This is not Star Trek, you are not play Ghost Recon.......Just a thought from one man.

Depends on how you wish to play. And cloaking technology is not far away today. Its all about bending light, which has already been proven to work. Arma 3 takes place in 2035, given the acceleration of technology in the past 20 years alone, a suit with the ability to bend light around it not a far fetched prospect. This cloak uses the refract effect, like a mirage. Not pure invisibility.

 

Share this post


Link to post
Share on other sites

Depends on how you wish to play. And cloaking technology is not far away today. Its all about bending light, which has already been proven to work. Arma 3 takes place in 2035, given the acceleration of technology in the past 20 years alone, a suit with the ability to bend light around it not a far fetched prospect. This cloak uses the refract effect, like a mirage. Not pure invisibility.

 

Don't feed the troll ;-)

  • Like 1

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.