rtek 10 Posted September 27, 2014 (edited) //I was trying to find a cloaking script that works off an addaction, so I can put it into one of my Splinter Cell type missions. Did a google search and I found this. //ArmA 3 cloak script V 0.428: Edit: Thanks to the original maker of that video, Racketen, for contacting me on youtube and joining the forums to share his script. Racketen's script will be listed below this line. multiplayer compatible version (however it has CBA as a dependancy), initPlayerLocal.sqf PHP Code: ["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 PHP Code: // 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]; }; }; Below is what we came up with before Racketen shared his script: First want to say thank you to DreadedEntity and HallyG for all the help and information, especially for HallyG for showing up and completing the scripts. All of you guys here on the A3 Editing and Scripting section of the forums are always great. I'll post the final script below here in case anyone wants to use this in their missions or what not. If you find any better tweaks or things to add to this to make it better, by all means, let us know and I'll update this. Init.sqf put in: player addAction ["Cloak", "cloak.sqf", [], 6, false, true, ""]; cutRsc ["CLOAK_BAR","PLAIN"]; Description.ext put in: #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 will contain: ///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; Again, many thanks you guys. Here's a mission I made last night that has the cloaking and HallyG's EMP Grenade script in it so yall can try it out in a mission scenario. http://steamcommunity.com/sharedfiles/filedetails/?id=320152937 Edited October 3, 2014 by RTEK Putting in the final scripts with instructions on how to use them. Share this post Link to post Share on other sites
dreadedentity 278 Posted September 27, 2014 For invisibility you may be interested in hideObject and hideObjectGlobal. But for the wavy particle effects I have no idea. Share this post Link to post Share on other sites
rtek 10 Posted September 27, 2014 (edited) ok, so far I have this partially working. Player is named Sam_Fisher. Trigger 1 is currently set to activate with Radio Alpha, repeatedly, Present, Condition is this and ON ACT is: Sam_Fisher hideObject true; hint "cloak active"; Sam_Fisher setCaptive true; cloak = true; Now I am trying to reverse this cloak after 60 seconds. So I setup another trigger with the condition of cloak so it fires once the 1st trigger fires, and I set a countdown of 60 seconds so that it fires 60 seconds after the first trigger. the on act I set to: Sam_Fisher hideObject false; hint "cloak deactivated"; Sam_Fisher setCaptive false; The issue I am having is that the second trigger only fires once. I can't get it to fire everytime the first one fires. I need the cloak to last for a set time, every time, and deactivate. Any suggestions? EDIT: Ok, so I managed to get the 2 triggers to loop. The way I did it was the first trigger has cloaked = true; in the ON ACT. The second trigger has cloaked as the condition, and in the ON ACT. i added cloaked = false; I tested it and I can no cloak for whatever time I set in the 2nd trigger, then recloak and it will deactivate the cloak at the set timer. Greatness!!! Now to get the particle effect to work when the cloak activates. Another question, how can I set this up to be an addaction the player can use, without having to use the radio? As far as the effect goes, I believe, in the video, that he's using the heat refraction effect. something like that. At the bottom of the Effects page, it says: Specials Refraction (heat) effect You can create refraction effect which simulates movement of hot air (around exhausts, fires, etc.). There is special texture for this purpose. How to create refract effect: in config-defined particle effect set: particleShape = \A3\data_f\ParticleEffects\Universal\Refract; particleFSNtieth = 1; particleFSIndex = 0; particleFSFrameCount = 1; particleFSLoop = 0; in scripted particle effect set the first item in the ParticleArray (used by script command setParticleParams or drop) to: ["\A3\data_f\ParticleEffects\Universal\Refract",1,0,1] Important notes: First three items (RGB) in color array have no meaning with refract effect, last item (alpha) defines refraction index (basically visibility of effect). All other parameters have the same meaning as in any other particle effect. How can I set that effect to be on the player when he goes invisible? Any help with this would be so much appreciated. Edited: Ok, so I was able to, after watch a tutorial, get an addaction to cloak, and put the code into sqf into the mission folder. Currently, the addaction is setup in the player init as: this addaction ["cloak", "cloak.sqf"] i'd like to be able to have this action hidden unless the player scrolls their mouse wheel. How do I do this? I don't like it being visible near the weapon reticle. The cloak.sqf looks like this so far: Sam_Fisher hideObject true; hint "cloak active"; Sam_Fisher setCaptive true; sleep 60; Sam_Fisher hideObject false; hint "cloak deactivated"; Sam_Fisher setCaptive false; I'm currently trying to figure out how to add the heat refract particle effect to this cloak.sqf. At least for now, I can, in game through the addaction, activate the script, and reactivate it every 60 seconds. So that's great. Headed in the direction I want to so far. Edited September 27, 2014 by RTEK Share this post Link to post Share on other sites
rtek 10 Posted September 27, 2014 (edited) I got the particle effect to show up in game using the refraction (heat) effect from https://community.bistudio.com/wiki/Arma_3_Particle_Effects#Calling_of_effect I used the particle editor tool from armaholic. That helped me get the settings I need. I have the below code in a file called refract.sqf . I was thinking of trying to call it in the cloak.sqf when the cloak activates. I don't know yet how to attach it to the player when it happens. refract.sqf XXXPARTICLEEFFECTSOURCEXXX setParticleCircle [0, [0, 0, 0]]; XXXPARTICLEEFFECTSOURCEXXX setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; XXXPARTICLEEFFECTSOURCEXXX setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract", 1, 0, 1], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10.3, 7.8, 0.075, [1.2, 2, 4], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", XXXOBJECTXXX]; XXXPARTICLEEFFECTSOURCEXXX setDropInterval 0.05; interval = 0.05; CircleRadius = 0; CircleVelocity[] = {0,0,0}; particleShape ="\A3\data_f\ParticleEffects\Universal\Refract"; particleFSNtieth =1; particleFSIndex =0; particleFSFrameCount =1; particleFSLoop =0; angle =0; angleVar =0; animationName = ""; particleType = "Billboard"; timerPeriod = 1 ; lifeTime = 12.5; moveVelocity[] = {0, 0, 0.75}; rotationVelocity = 0; weight = 10.3; volume = 7.8; rubbing = 0.075; size[] = {1,1}; animationSpeed[] = {1}; lifeTimeVar = 0; positionVar[] = {0.25, 0.25, 0}; positionVarConst[] = {0, 0, 0}; moveVelocityVar[] = {0.175, 0.175, 0}; moveVelocityVarConst[] = {0, 0, 0}; rotationVelocityVar = 0; sizeVar = 0.25; colorVar[] = {0, 0, 0, 0}; randomDirectionPeriodVar = 0; randomDirectionIntensityVar = 0; sizeCoef = 1; colorCoef[]={0,0,0,0.1}; animationSpeedCoef = 1; destroyOnWaterSurface = 0; destroyOnWaterSurfaceOffset = 0; onSurface = true; keepOnSurface = false; surfaceOffset = 0; bounceOnSurface = 0.6; bounceOnSurfaceVar = 0.0; postEffects = ""; particleEffects = ""; Does anyone know how to attach an effect to the player? Edited September 28, 2014 by RTEK Share this post Link to post Share on other sites
dreadedentity 278 Posted September 28, 2014 i'd like to be able to have this action hidden unless the player scrolls their mouse wheel. How do I do this? I don't like it being visible near the weapon reticle. this addaction ["cloak", "cloak.sqf", [], 6, false, true]; addAction Look at "showWindow" and "hideOnUse" in the parameter explanations. As for the particle effects, I have no idea how to use them or set them up. We'll have to wait for someone else to come explain :p Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 Ah cool. Setting to 0 put it at low priority, so it's gone now from on screen till I scroll mouse wheel. thanks DreadedEntity. Share this post Link to post Share on other sites
dreadedentity 278 Posted September 28, 2014 Ah cool. Setting to 0 put it at low priority, so it's gone now from on screen till I scroll mouse wheel. thanks DreadedEntity. Priority sets how high it shows up in the action list, the next parameter after that makes it so the option shows up when you get close enough or you have to scroll your mouse wheel. Share this post Link to post Share on other sites
HallyG 239 Posted September 28, 2014 For a particle to be spawned you need to define a particle source (https://community.bistudio.com/wiki/ParticleTemplates) which you can do using this: Heat = "#particlesource" createVehicleLocal getpos player; So with this, you can put it amongst the rest of the code for the heat effect into a .sqf file which I named "HeatEffect.sqf": Heat = "#particlesource" createVehicleLocal getpos player; Heat setParticleCircle [0, [0, 0, 0]]; Heat setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0]; Heat setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract", 1, 0, 1], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10.3, 7.8, 0.075, [1.2, 2, 4], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", XXXOBJECTXXX]; Heat setDropInterval 0.05; interval = 0.05; CircleRadius = 0; CircleVelocity[] = {0,0,0}; particleShape ="\A3\data_f\ParticleEffects\Universal\Refract"; particleFSNtieth =1; particleFSIndex =0; particleFSFrameCount =1; particleFSLoop =0; angle =0; angleVar =0; animationName = ""; particleType = "Billboard"; timerPeriod = 1 ; lifeTime = 12.5; moveVelocity[] = {0, 0, 0.75}; rotationVelocity = 0; weight = 10.3; volume = 7.8; rubbing = 0.075; size[] = {1,1}; animationSpeed[] = {1}; lifeTimeVar = 0; positionVar[] = {0.25, 0.25, 0}; positionVarConst[] = {0, 0, 0}; moveVelocityVar[] = {0.175, 0.175, 0}; moveVelocityVarConst[] = {0, 0, 0}; rotationVelocityVar = 0; sizeVar = 0.25; colorVar[] = {0, 0, 0, 0}; randomDirectionPeriodVar = 0; randomDirectionIntensityVar = 0; sizeCoef = 1; colorCoef[]={0,0,0,0.1}; animationSpeedCoef = 1; destroyOnWaterSurface = 0; destroyOnWaterSurfaceOffset = 0; onSurface = true; keepOnSurface = false; surfaceOffset = 0; bounceOnSurface = 0.6; bounceOnSurfaceVar = 0.0; postEffects = ""; particleEffects = ""; Next you can use this script (imaginatively named "Cloak.sqf"), which you can call from an AddAction, to deal with the cloaking and to spawn the heat effect on the player. I also added in a timer. _Unit = _this select 0; timer = 60; _nil = [] execVM "HeatEffect.sqf"; _Unit hideObject true; SystemChat "Cloak Active"; _Unit 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; }; _Unit hideObject false; deleteVehicle Heat; SystemChat "Cloak Deactivated"; _Unit setCaptive false; I then added an AddAction into the player's init field such that I could call the Cloaking script. this addaction ["Cloak", "Cloak.sqf", [], 6, false, true]; There's probably room for improvement with my code and excuse any errors because I'm new to scripting :p. Here's a video of it in action: Excuse the poor quality, had to compress the video or I would never have been able to upload it with my poor internet speed. Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 (edited) That is awesome!!! //How did you get the effect to stick to the soldier. When I tested it on myself, the effect stays where I cloaked, but doesn't stay attached to me. Edit: I added Heat attachto [player,[0,0,0]]; to the HeatEffect.sqf and it worked. Awesome. Thank you to DreadedEntity and HallyG for all the help with this. If you guys don't mind, I gave you two credit in the 2 .sqf's that are going into my mission. I'll also give you two credit in the steam page of the mission as well. Thanks again. Edited September 28, 2014 by RTEK Share this post Link to post Share on other sites
dreadedentity 278 Posted September 28, 2014 excuse any errors because I'm new to scripting :p. You're new to scripting and you figured out how to use particle effects? I've been looking at the documentation for that shit for 3 days and couldn't figure it out. Well done Share this post Link to post Share on other sites
HallyG 239 Posted September 28, 2014 That is awesome!!! //How did you get the effect to stick to the soldier. When I tested it on myself, the effect stays where I cloaked, but doesn't stay attached to me. Edit: I added Heat attachto [player,[0,0,0]]; to the HeatEffect.sqf and it worked. Awesome. Thank you to DreadedEntity and HallyG for all the help with this. If you guys don't mind, I gave you two credit in the 2 .sqf's that are going into my mission. I'll also give you two credit in the steam page of the mission as well. Thanks again. No problem at all, it was interesting to solve! If you're making a Splinter Cell mission I may have another script you might be interested in, if you want me to send it to you? You're new to scripting and you figured out how to use particle effects? I've been looking at the documentation for that shit for 3 days and couldn't figure it out. Well done Eh, I'd word it as something more along the lines of: On the path to being slightly less confused by particle effects. ;) Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 (edited) Yeah sure. Here's the link to the mission. http://steamcommunity.com/sharedfiles/filedetails/?id=246184547 I'm now trying to figure out why the steerable parachute wants to always bank hard left everytime. It never used to do it. Besides that, it's a fun little mission. I even put in the old wirecutting script, think it's by BTK. I need to try out the new one that's up on Armaholic. ---------- Post added at 18:28 ---------- Previous post was at 17:34 ---------- Next I want to put into the cloak.sqf a restriction that the addaction gets removed(to prevent OP spamming of the cloak), and then have it sleep for 90 seconds after the cloak deactivates, during which there's still no addaction, then once those 90 seconds complete, the action becomes available for use again. Is it possible to do that inside the cloak.sqf? Would it be as simple as _unit removeaddAction ? then sleep 90 , then a message saying cloak available, then a _unit addaction ....? Edited September 28, 2014 by RTEK Share this post Link to post Share on other sites
HallyG 239 Posted September 28, 2014 At the top of Cloak.sqf put _id = _this select 2; followed by: player removeAction _id; At the end of the script put: sleep 90; player addaction ["Cloak", "Cloak.sqf", [], 6, false, true]; This should work as I did a quick test right now and it seemed to work for me! Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 I'm going to, when I have time, try to tweak those particle effects to make them more centralized on the body, and maybe make them a bit more intense just for visual purposes. Kind of like in that video how it envelopes the player when the player cloaks. I used this Particle Editor to create the particle effects parameter in game so I could see it in action. I had to add ["\A3\data_f\ParticleEffects\Universal\Refract",1,0,1], into the init.sqf so that the refract effect would be available for use. Share this post Link to post Share on other sites
HallyG 239 Posted September 28, 2014 I'm going to, when I have time, try to tweak those particle effects to make them more centralized on the body, and maybe make them a bit more intense just for visual purposes. Kind of like in that video how it envelopes the player when the player cloaks. I used this Particle Editor to create the particle effects parameter in game so I could see it in action. I had to add ["\A3\data_f\ParticleEffects\Universal\Refract",1,0,1], into the init.sqf so that the refract effect would be available for use. Awesome, let me know how it goes. I sent you that PM by the way. Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 Yeah that works perfect. Thanks. Share this post Link to post Share on other sites
dreadedentity 278 Posted September 28, 2014 One last quick note, if you want things to be invisible in multiplayer you should use hideObjectGlobal instead. hideObject only runs on the local client, meaning that you'll be invisible on your screen, but everybody else can still see you. Share this post Link to post Share on other sites
rtek 10 Posted September 28, 2014 One last quick note, if you want things to be invisible in multiplayer you should use hideObjectGlobal instead. hideObject only runs on the local client, meaning that you'll be invisible on your screen, but everybody else can still see you. Oh yeah that's right. I'll change that up right now. Thanks. ---------- Post added at 18:58 ---------- Previous post was at 18:53 ---------- I updated the script at the top of this thread with hideObjectGlobal. I also added a SystemChat message to let the player know when he can reuse the cloak again. Share this post Link to post Share on other sites
rtek 10 Posted September 29, 2014 (edited) I updated the script a bit. Put a sleep for 3 seconds after the heateffect starts, so the effect has time to envelope the player before the player blinks out of view. then a sleep after the player reappears so the effect has time to fade out. Next I want to get that effect to look better. More centralized on the character, and to have a better animation phase in the beginning and end, so it transitions more like a veil dropping from the head down to the feet, then in reverse when coming out of cloak. I also want to have a version that makes the cloak work only if the player is wearing a specific uniform. So basically the action is available if the uniform is on the player, and not available if any other uniform is on. <----does anyone know the easiest way to add that to the cloak.sqf script? "U_B_Protagonist_VR" and "U_B_Soldier_VR" and "U_C_Soldier_VR" "U_I_Protagonist_VR" "U_I_Soldier_VR" "U_O_Protagonist_VR" and "U_O_Soldier_VR" are the uniforms I want to set to be able to cloak with. Could it be done like this:??? //check on player _cloakArray = []; _uniform = position player nearObjects ["U_B_Protagonist_VR", 1]; _cloakArray = _cloakArray + _uniform; private ["_uniform","_uniformPos"]; if (count _cloakArray > 0) then { _uniform = _cloakArray select 0; _cloakPos = position _uniform; } else { _cloakPos = position player; }; Edited September 29, 2014 by RTEK Share this post Link to post Share on other sites
dreadedentity 278 Posted September 29, 2014 Could it be done like this:??? //check on player _cloakArray = []; _uniform = position player nearObjects ["U_B_Protagonist_VR", 1]; _cloakArray = _cloakArray + _uniform; private ["_uniform","_uniformPos"]; if (count _cloakArray > 0) then { _uniform = _cloakArray select 0; _cloakPos = position _uniform; } else { _cloakPos = position player; }; No, if this worked, it would only check if there was a uniform on the ground, not on your character. Here's how I would do it, using the "in" command. private = ["_acceptableUniforms"]; _acceptableUniforms = ["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 player) in _acceptableUniforms) then { //cloak player }else { hint "Your uniform is crap, get a better one."; }; Share this post Link to post Share on other sites
rtek 10 Posted September 29, 2014 (edited) Makes sense. I'll try that. In the IF section, thats where all the cloak script would go? Also, is it possible to add the addaction to any player wearing the uniform? Like say you, the player, finds the vr suit, you put it on, and the addaction becomes available. Take it off and the option goes away. I want to later take this further into a certain object placed on ground, but want to understand the wearable cloak first. I have some ideas for its use in a persistent type server as like rare items that have great benefits, but also drawbacks. Like a item thats placed on the ground. It has the addaction on it. When active, it projects an AOE cloak. Like 15m radius. Anything that enters the field gets cloaked, but inside you can see everyone, even others inside. But anyone outside the field cannot see anyone inside. Have it include vehicles. Not aure how possible any of that is, but I think it'd be cool to make work. Edited September 30, 2014 by RTEK Share this post Link to post Share on other sites
dreadedentity 278 Posted September 30, 2014 (edited) Makes sense. I'll try that.In the IF section, thats where all the cloak script would go? Also, is it possible to add the addaction to any player wearing the uniform? Like say you, the player, finds the vr suit, you put it on, and the addaction becomes available. Take it off and the option goes away. I want to later take this further into a certain object placed on ground, but want to understand the wearable cloak first. I have some ideas for its use in a persistent type server as like rare items that have great benefits, but also drawbacks. You can use the code I posted to make it so the action only shows up if you're wearing the right uniform. There are a lot of optional arguments when you use addAction, one of them is a condition. Example: player addAction ["Action Name", { code }, priority, arguments, showText, hideOnUse, shortcut, CONDITION]; // ^1 ^2 //1: Everything past here is optional. //2: Everything past here is for Take On Helicopters ONLY // What your action should look like: player addAction ["Cloak", "cloak.sqf or whatever name", 6, [], false, true, "", {(uniform player) in ["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"]}]; //Action will ONLY show up if condition is true, so you can delete the uniform checking from the script. You may have to use quotes in the condition, but try it like that. If that doesn't work then you have to replace { and } with quotes. Now, anytime you are trying to use quotes inside quotes you need to use double quotes ( " ""stuff"" " ) so the compiler understands what you mean correctly. This is why I hate the stupid "code strings". Edited September 30, 2014 by DreadedEntity Share this post Link to post Share on other sites
rtek 10 Posted September 30, 2014 (edited) If I were to put that addaction in the init.sqf, would that work? or would it have to be written differently? I tried out several different ways, but it's always saying missing [ Edited September 30, 2014 by RTEK Share this post Link to post Share on other sites
dreadedentity 278 Posted September 30, 2014 Putting it in init.sqf will work just fine. In the error message it should say #, tell me where that is or post a picture of the error message. Share this post Link to post Share on other sites