Jump to content

Recommended Posts

Sorry to resurrect an old thread but I'm really interested to get this going on my Epoch server. I noticed the init is essentially a persistent addAction which from what I've read is quite performance damaging to ARMA. I tried to get this to run by moving the addAction into the cloak.sqf itself after the If ((uniform _Unit) in UsableUniforms) then statement so it won't show up unless the player is wearing one of the correct uniforms. Has anyone got this working on their server neatly?

Share this post


Link to post
Share on other sites

Hello all.

I was wondering, how would one go about having an add action to turn cloak off, in addition to the time limit and the recharge?

Share this post


Link to post
Share on other sites

this is neat but that bubble is huge and is visible at range and seems to be moving even when he is still

Share this post


Link to post
Share on other sites

This is absolutely amazing ;)

Share this post


Link to post
Share on other sites

Says the top method made by Racketen is MP compatible, yet I cannot get it to work properly. Everything works as it's supposed to but it does not seem to execute the hideObjectGlobal line. It works in singleplayer as it should but not in MP for me. Can anyone else confirm this?

Share this post


Link to post
Share on other sites

I noticed when the cloak is acive again after the first use, the cloak action in the menu duplicates.

I fixed it. And now only appears once everytime after using it.

THIS IS THE CLOAK.SQF

_Unit = _this select 0;

_id = _this select 2;

_Unit removeAction _id;

UsableUniforms = ["U_O_CombatUniform_ocamo","U_I_G_resistanceLeader_F","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 = 30;

cooldown = 1000;

_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 removeAction ["Cloak", "cloak.sqf", [], 6, false, true, "",""]; // I added this line //

_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, "",""];

};

Edited by HeadPop

Share this post


Link to post
Share on other sites

I was wondering if you guys could tell me how to make this script multiplayer. It is an old version of yours rtek that is modified without the uniforms. I know that Racketen made an mp one but it is not the way I want it to work. The reason I want your old version is that I would like to have a cooldown on the ability. It only works with the server host and no other player can use it but me. They can see the effect and see me go invisible but they cant do it themselves. If you can help, thanks. By the way I am a big noob so If you could explain in detail, if possible, it would be nice.

 

if (hasInterface) then {
 
 
_Unit = _this select 0;
_id = _this select 2;
player removeAction _id;
timer = 6;
 
_nil = [] execVM "HeatEffect.sqf";
 
(_this select 0) hideObjectGlobal true; 
SystemChat "Cloak Active"; 
Cloaker setCaptive true; 
 
 
[timer] spawn 
while {!(timer == -1)} do
Heat setpos (getpos _Unit);
sleep 0.1;
};
};
 
while {!(timer == -1)} do
SystemChat format ["%1 seconds left",timer];
timer = timer -1;
sleep 1;
};
 
 
(_this select 0) hideObjectGlobal false;
deleteVehicle Heat; 
SystemChat "Cloak Deactivated, wait 20 seconds before use again";
Cloaker setCaptive false;
 
sleep 20;
SystemChat "Cloak Ready";
 
Cloaker addAction ["Cloak", "cloak.sqf", [] , 1 , true , true , "" , "_this == _target"];
 
};

Share this post


Link to post
Share on other sites

I'm using this code in a mission but the cloak option is coming up for every player, does anyone know how to remove the action from certain players' menu's?

Share this post


Link to post
Share on other sites

I've rewritten some of this script (because the way I approached it previously was...):

initPlayerLocal.sqf:

params [
    ["_player", objNull, [objNull]],
    ["_jip", false, [false]]
];

[] spawn {
    waitUntil {!isNull (findDisplay 46)};
    9901 cutRsc ["CLOAK_BAR","PLAIN"];
};
//player forceAddUniform "U_B_Protagonist_VR";

USEABLEUNIFORMS = ["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"];

player addAction [
    "Cloak",
    "cloak.sqf",
    [],
    6,
    false,
    true,
    "",
    "_target isEqualTo _this && {((uniform _target) in USEABLEUNIFORMS) && {!(_target getVariable [""isCloakUsed"", false])}}"
];

cloak.sqf:

if !(hasInterface) exitWith {};

params ["_unit", "_caller", "_id"];
private _timer = 20;
private _cooldown = 10;

_unit setVariable ["isCloakUsed", true];
_unit setVariable ["isCloakTimerEnd", false];  

private _setProgress = {
    ["TAG_CLOAKBAR_TIMER", "onEachFrame", {
        params ["_start", "_end", "_down", "_test", "_unit"];
        private _progress = linearConversion ([[_start, _end, time, 0, 1], [_start, _end, time, 1, 0]] select _down);
        ((uiNamespace getVariable "TAG_CLOAKBAR") displayCtrl 100031) progressSetPosition _progress;
        ((uiNamespace getVariable "TAG_CLOAKBAR") displayCtrl 100031) ctrlSetTextColor [
            linearConversion [0, 1, _progress, 1, 0],
            linearConversion [0.1, 1, _progress, 0, 0.5],
            0, 1
        ];
        
        if (_progress > 1 || _progress < 0) then {
            systemChat _test;
            _unit setVariable ["isCloakTimerEnd", true];
            ["TAG_CLOAKBAR_TIMER", "onEachFrame"] call BIS_fnc_removeStackedEventHandler;
        };
    }, _this] call BIS_fnc_addStackedEventHandler;
};

private _source = "#particlesource" createVehicle 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], "spine3"];

[_unit, true] remoteExec ["hideObjectGlobal", 2];
_unit setCaptive true;
        
systemChat "Cloak Activated";    
[time, time + _timer, true, "Cloak Deactivated", _unit] call _setProgress;

waitUntil {_unit getVariable ["isCloakTimerEnd", false];};
    
deleteVehicle _source;
[_unit, false] remoteExec ["hideObjectGlobal", 2];
_unit setCaptive false;    

waitUntil {isNull _source};
sleep 1;

systemChat "Cloak Recharging";
_unit setVariable ["isCloakTimerEnd", false];
[time, time + _cooldown, false, "Cloak Recharged", _unit] call _setProgress;

waitUntil {_unit getVariable ["isCloakTimerEnd", false];};    
_unit setVariable ["isCloakUsed", false];

description.ext:

class RscTitles {
    class RscProgress {
        type = 8;
        style = 0;
        shadow = 2;
        colorFrame[] = {0,0,0,1};
        colorBar[] = {0,0.5,0,1};  
        texture = "\A3\ui_f\data\GUI\RscCommon\RscProgress\progressbar_ca.paa";  
        w = 0.25;
        h = 0.03;
    };     
    class CLOAK_BAR {
        idd = 10003;
        onload = "((_this select 0) displayCtrl 100031) progressSetPosition 1; uiNamespace setVariable [""TAG_CLOAKBAR"", _this select 0]; ((uiNamespace getVariable ""TAG_CLOAKBAR"") displayCtrl 100031) progressSetPosition 1;";
        duration = 10000000;
        
        class Controls {
            class Progress: RscProgress {
                idc = 100031;
                x = 0.849 * safezoneW + safezoneX;
                y = 0.9350 * safezoneH + safezoneY;
            };
        };
    };
};

The progress bar changes from green (when full) to red (when empty).
Action will only appear if the player is wearing the correct uniform and if the player is not currently cloaked.
 

In multiplayer, the unit should now be properly hidden. Haven't tested to see if the particle effects will work.

Share this post


Link to post
Share on other sites

I didn't know this got released, though it was still a WIP- Someone pointed me here asking if it could be added to my Ghost Recon mod- Is there a way to modify the script to only have it apply if the character is below a certain speed?

I ideally would like it to only be enabled if you are at 'crawling speed' while prone or while stationary. The speed maximum would be 6 KM (as that's sprint-crawling speed, +1 KM for safety)

Share this post


Link to post
Share on other sites

I tried multiple ways of getting this to work, decided i would finally create an account and ask. No server errors or anything. Just won't work. Copied the files exactly as hallyG rewrote them. Won't work on multiplayer server running exile mod. Can I get some help from those of you that got it to work?

Share this post


Link to post
Share on other sites

I have this working perfectly fine  for a SP mission, but it might be multiplayer causing the issue? I have not, nor know of, anyone who's used this in MP so not sure. 

Share this post


Link to post
Share on other sites
11 hours ago, SniperandChill said:

I tried multiple ways of getting this to work, decided i would finally create an account and ask. No server errors or anything. Just won't work. Copied the files exactly as hallyG rewrote them. Won't work on multiplayer server running exile mod. Can I get some help from those of you that got it to work?

I'll have a [more in depth] look when I have some free time. I'm moving house currently so, needless to say, I seldom have free time.

However, I've uploaded a version to dropbox which I have updated for you today. It seemed to work in multiplayer apart from the particle effects. I haven't bothered to script for the player respawning but I'll do that in the near future.

 

This version has various improvements which I'll probably update this post later with a list of them. It is by no means finished but I thought I may as well post it for anyone who is still interested.

 

Share this post


Link to post
Share on other sites
On 1/2/2017 at 1:52 PM, hallyg said:

I'll have a [more in depth] look when I have some free time. I'm moving house currently so, needless to say, I seldom have free time.

However, I've uploaded a version to dropbox which I have updated for you today. It seemed to work in multiplayer apart from the particle effects. I haven't bothered to script for the player respawning but I'll do that in the near future.

 

This version has various improvements which I'll probably update this post later with a list of them. It is by no means finished but I thought I may as well post it for anyone who is still interested.

 

Looks much cleaner, code wise. Unfortunately I'm still not getting the addaction. Everything else shows; cloak bar, hint or initialization, etc. Just no addaction. I tried all 6 of the uniforms, protagonist and soldier VR. Any ideas? If it helps, I'm trying to run this on a private server for myself and friends. Exile 1.0.2, CUP, R3F, DMS, VEMFr, HVP, SMZombz.

Share this post


Link to post
Share on other sites
14 hours ago, SniperandChill said:

Looks much cleaner, code wise. Unfortunately I'm still not getting the addaction. Everything else shows; cloak bar, hint or initialization, etc. Just no addaction. I tried all 6 of the uniforms, protagonist and soldier VR. Any ideas? If it helps, I'm trying to run this on a private server for myself and friends. Exile 1.0.2, CUP, R3F, DMS, VEMFr, HVP, SMZombz.

Here we go.

 

I'm pretty sure the issue was respawn because, from what I remember, you respawn on start with Exile. Reworked it so respawn should be fine now. Additionally, the cloak will deactivate if you remove the required clothing while it is active.
 

Share this post


Link to post
Share on other sites
1 hour ago, hallyg said:

Here we go.

 

I'm pretty sure the issue was respawn because, from what I remember, you respawn on start with Exile. Reworked it so respawn should be fine now. Additionally, the cloak will deactivate if you remove the required clothing while it is active.
 

I admire your follow through. At work currently, but I will give it a go when I get home. I've been working with coding Arma related stuff for a few months now, I understand it can be frustrating. Thanks for taking the time to write this up for a complete stranger on the Internet, all while moving homes!

Share this post


Link to post
Share on other sites
On 1/4/2017 at 10:57 AM, hallyg said:

Well man, gave it a shot and now I don't even get the initialized message. I appreciate your help. It's not really a pressing matter so if you decide to play with it more that's cool, if not, no big deal.

Share this post


Link to post
Share on other sites
16 hours ago, SniperandChill said:

Well man, gave it a shot and now I don't even get the initialized message. I appreciate your help. It's not really a pressing matter so if you decide to play with it more that's cool, if not, no big deal.

Don't have my computer setup right now so I can't check. I think it might be because I, stupidly, have two variables with the same name in "cloaking\init.sqf". Try changing it to this:

if (!hasInterface) exitWith {};

if (isNil "HALs_cloak_init_done") then {
	{
		missionNamespace setVariable [
			_x select 0,
			compileFinal (preprocessFileLineNumbers (_x select 1))
		];
	} count [
		['HALs_cloak_cloak','cloaking\functions\HALs_cloak_cloak.sqf'],
		['HALs_cloak_gui','cloaking\functions\HALs_cloak_gui.sqf'],
		['HALs_cloak_handle','cloaking\functions\HALs_cloak_handle.sqf'],
		['HALs_cloak_init','cloaking\functions\HALs_cloak_init.sqf'],
		['HALs_cloak_progress','cloaking\functions\HALs_cloak_progress.sqf']
	];
	
	HALs_cloak_init_done = true;
};

Obviously you'll need to change the file paths if it's different in your setup.

Additionally change the bit in the initPlayerLocal.sqf from:

waitUntil {!(isNil "HALs_cloak_init")};

to:

waitUntil {!(isNil "HALs_cloak_init_done")};

 

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

×