Jump to content
Sign in to follow this  
antoineflemming

Invisibility Effect Help

Recommended Posts

Hi guys. I'm trying to achieve an adaptive camo effect similar to what's seen in Ghost Recon Future Soldier. I have three problems. First problem is that I'm trying to make a class UserActions to add an action to a vest, character, and or uniform, but it's not showing up in-game. Not sure what, if anything, I'm doing wrong. Second problem is that I really want the userAction attached to only one item, but I want the invisibility effect (basically a texture change) to affect uniform, vest, headgear, weapon, and skin (replacing all the textures with a transparent texture). Third problem is that I tried addAction in the editor to add the action, and it showed up, but the transparent (or translucent) replacement texture (replaced the uniform texture) wasn't transparent.

So I need help with the 1) code (to get the userAction to show up in the menu ingame), 2) applying the effect to everything touching the player, and 3) getting the transparent texture (currently "adaptiveCamo_ca.paa") to actually be transparent. Any help would be greatly appreciated.

Here's an example:

596626765.jpg

Edited by antoineflemming

Share this post


Link to post
Share on other sites

It has been a long time since I messed with adding actions to units via configs/scripting, but from what I can recall, you need would need to add an addAction to the unit via an (extended) init event handler. The addAction would need to have a condition to only display the action if the unit had a specific item in inventory. Here is some example init EH code using a wet suit just as example pirposes (change to whatever is applicable -- does not have to be a uniform) to give the action (untested):

_this addAction ["Activate Adaptive Camo", "adaptiveCamo.sqf", (arguments, 6, false, false, "", "uniform caller == ""U_B_Wetsuit""")]

Then of course you need code for adaptiveCamo.sqf to change the texture of everything. I do not what you were trying before, but setObjectTexture might be an option but depending on the selections, I am not sure how much is replaceable. You would have to capture everything the unit is wearing and holding and then re-apply texttures or mod every possible item with the texture variants and switch them out for their counterparts. You know a lot more about textuing than I do so I defer to you on texturing issues.

I hope this helps a little!

Share this post


Link to post
Share on other sites

wrong thread i think

Edited by Thromp

Share this post


Link to post
Share on other sites
It has been a long time since I messed with adding actions to units via configs/scripting, but from what I can recall, you need would need to add an addAction to the unit via an (extended) init event handler. The addAction would need to have a condition to only display the action if the unit had a specific item in inventory. Here is some example init EH code using a wet suit just as example pirposes (change to whatever is applicable -- does not have to be a uniform) to give the action (untested):

_this addAction ["Activate Adaptive Camo", "adaptiveCamo.sqf", (arguments, 6, false, false, "", "uniform caller == ""U_B_Wetsuit""")]

Then of course you need code for adaptiveCamo.sqf to change the texture of everything. I do not what you were trying before, but setObjectTexture might be an option but depending on the selections, I am not sure how much is replaceable. You would have to capture everything the unit is wearing and holding and then re-apply texttures or mod every possible item with the texture variants and switch them out for their counterparts. You know a lot more about textuing than I do so I defer to you on texturing issues.

I hope this helps a little!

Well, it helps me bind the action to a specific item. So that's helpful. Anyway to run a script from a config file without creating a userAction class?

Share this post


Link to post
Share on other sites

Ok, well, I'm trying to add this effect again, but this time only through configs. I think I've figured out a way to get at least some R2T effect going via scripting. But I'd like to do so ONLY using config files. I've got this script:

cam = "camera" camCreate (position player);
trg = "Sign_Sphere10cm_F" createVehicle position player;
hideObject trg;
cam attachTo [player,[0,0.2,0.1]];
trg attachTo [player,[0,0.21,-1]];
cam camSetTarget trg;
cam cameraEffect ["INTERNAL", "BACK", "rendertarget99"];
cam camSetFov 2;
cam camCommit 1;
player setObjectTexture [0, "#(argb,256,256,1)r2t(rendertarget99,1.0)"];
player setObjectTexture [1, "#(argb,256,256,1)r2t(rendertarget99,1.0)"];
"rendertarget99" setPiPEffect [3, 1.0, 0.8, 1.1, 0, [0.3, 0.3, 0.3, -0.5], [1.0, 0.0, 1.0, 1.0], [0, 0, 0, 0]]; 

I'd like to do this in a config file and only affecting a uniform (in this case, the Iranian/CSAT uniform). How, if possible, could I do this in a .cpp file? Or, if possible, how could I link this script to a uniform such that whenever I wear the uniform it automatically changes to PiP?

Edited by antoineflemming
Fixed script

Share this post


Link to post
Share on other sites

you can launch a script via the init eventhandler of a soldier for instance

class eventhandlers

{

init = "_init = _this execvm ""\Modfolder\scripts\my_script.sqf"";";

};

.

In your script, you need to add then something to check if the soldier is wearing your custom uniform (

If((uniform soldier) == "my_uniform") then {...};
) and check this condition all the time (which i don't like and it would be nice to have a better solution):

_soldier = _this select 0

while {true} do

{

If((uniform _soldier) == "my_uniform") then

{

cam = "camera" camCreate (position _soldier);

trg = "Sign_Sphere10cm_F" createVehicle position _soldier;

hideObject trg;

cam attachTo [_soldier,[0,0.2,0.1]];

trg attachTo [_soldier,[0,0.21,-1]];

cam camSetTarget trg;

cam cameraEffect ["INTERNAL", "BACK", "rendertarget99"];

cam camSetFov 2;

cam camCommit 1;

player setObjectTexture [0, "#(argb,256,256,1)r2t(rendertarget99,1.0)"];

player setObjectTexture [1, "#(argb,256,256,1)r2t(rendertarget99,1.0)"];

"rendertarget99" setPiPEffect [3, 1.0, 0.8, 1.1, 0, [0.3, 0.3, 0.3, -0.5], [1.0, 0.0, 1.0, 1.0], [0, 0, 0, 0]];

};

sleep 0.1;

};

This is a brutal way of doing things and it can be improved, but it could be a start.

Another issue is that to make this work for every soldiers, you would need to write over the BIS soldiers (to add the eventhanlder).

PS:I think a nice addition would be to pop some "heat wave" particles around, to distord a bit the image. It would also be nice to add a transition when the camo is activated, but maybe camcommit is enough for that matter?

Edited by super-truite

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
Sign in to follow this  

×