Jump to content
Sign in to follow this  
jasonb

How do I make an invisible man that takes gun fire damage?

Recommended Posts

Hey guys, I'd like to know how to make an invisible man take regular damage? 

You can't set all of the infantry unit to have no texture (face and some clothes still show) and using hideobject true makes them immune to gun fire (but funny enough, not explosions).

I need an invisible man that can take regular damage by guns etc. Anyone know how to do this?

Cheers

Share this post


Link to post
Share on other sites

have you tried _soldier hideObjectGlobal true; 

 

I'm not sure does it take damage after that?

Share this post


Link to post
Share on other sites
{_unit hideSelection [_x, true]} forEach selectionNames _unit;

Just a wild guess: Maybe it works by hiding all selections instead of hiding the whole unit.

 

I don't think it will, but it's worth a try.

Share this post


Link to post
Share on other sites

Idk if it breaks any rules but i dont like that u open the same topics at armaholic and here...

http://www.armaholic.com/forums.php?m=posts&q=35377

Back to topic:

Why do u need that? Maybe there is another way or a workaround...

What is wrong with asking both here and there? I'd like to create a Predator mission. An invisible man that stalks his prey on Tanoa. The idea is that one team must use their senses (other than eyes) to kill it. Right now, they cannot even if they directly shoot it. 

 

I created this predator mission a while back for Arma 3. I'd like to give it another crack on Tanoa with some much better scripting.

 

Share this post


Link to post
Share on other sites

You could try if the hidden unit will still trigger a hit eventhandler when being shot at, and go from there.

Although that's rather unlikely.

 

Cheers

Share this post


Link to post
Share on other sites

did u try both hideObject (on each client with remoteExec) and hideObjectGlobal (on server only) ? Maybe there is a difference between both methods.

Another way could be to undress a soldier and then use tajins suggestion because u said some clothes can be seen.

Share this post


Link to post
Share on other sites

Eventhough you can't kill the hidden man, do you know if the Hit or Damage eventhandlers occur when shot?  If so, you could write your own handler to apply damage when shot.

Share this post


Link to post
Share on other sites

I attached an eventhandler to all units to track bullets and then decloack the unit when bullet get near:

var_bullets = [];
{
	if(side _x == west) then
	{
		_firedId = _x addEventHandler ["fired", {
			_this spawn {
				//_this [obj:unit, str:weapon, str:muzzle, str:mode, str:ammo, str:magazine, obj:projectile]
				_bullet = _this select 6;
				var_bullets pushBack _bullet;
				while {alive _bullet} do {sleep 0.1;};
				var_bullets = var_bullets - [_bullet];
			};
		}];
	};
} foreach allUnits;

And then check via the Draw3D if any get close, decloack if they do. 

addMissionEventHandler ["Draw3D", {
    if(isObjectHidden player) then
	{
		{
			if(_x distance player < 2 && _x distance2D player < 0.2) then
			{
				palyer hideObjectGlobal false;
			};	
		} forEach var_bullets ;
	};
}];

I know it's not super fancy and accurate but it's something :). 

 

Ofcourse this does decloack the unit, so I suggest also changing his collor a bit like this for example:

player setObjectTextureGlobal [0,'#(argb,1,1,1)color(0,0,0,0.1,ca)']; 

This requires to remove gear to look fancy though, which again requires a custom damage handler to not mare your 'predator' die within 1 hit.

Share this post


Link to post
Share on other sites

The Spelling Bee has seen the above post and removed you from their Christmas card list. :face_palm:

palyer
  • Like 1

Share this post


Link to post
Share on other sites

Hmm. Is there no way to completely retexture a model as nothing? You can do this with a Dog. But not a man? And, also noticed something weird. When I removed my characters clothes, those textures that did change to invisible, changed right back. E.g. I got his legs to be invisible and then removing clothes made his legs visible again. 

Share this post


Link to post
Share on other sites

did u try both hideObject (on each client with remoteExec) and hideObjectGlobal (on server only) ? Maybe there is a difference between both methods.

Another way could be to undress a soldier and then use tajins suggestion because u said some clothes can be seen.

 

Hide object works fine, it's just that he doesn't take bullet damage when shot at.

Share this post


Link to post
Share on other sites

Eventhough you can't kill the hidden man, do you know if the Hit or Damage eventhandlers occur when shot?  If so, you could write your own handler to apply damage when shot.

 

I'll look into this, thanks.

Share this post


Link to post
Share on other sites
{_unit hideSelection [_x, true]} forEach selectionNames _unit;

Just a wild guess: Maybe it works by hiding all selections instead of hiding the whole unit.

 

I don't think it will, but it's worth a try.

 

I don't understand how this works exactly? I put a Blufor Present Trigger over my character and put {Player hideSelection [_x, true]} forEach selectionNames Player; and nothing at all happened? What is this meant to do exactly? Cheers.

Share this post


Link to post
Share on other sites

You could try if the hidden unit will still trigger a hit eventhandler when being shot at, and go from there.

Although that's rather unlikely.

 

Cheers

 

Just tested it and confirmed it does not work. What about some kind of Trigger or something that detects bullets close by the _unit? Something like Bullet Distance Predator <0.5, Predator setdamage getdamage Predator +0.01    If you get what i mean?

 

 

Do I really need to go to all the trouble to make the player Hide Object True,  spawn a dog in, set it's texture to nothing (because you can), attach it to the Predator, Group it to the Predator, annd when the dog dies the predator goes down with it all over again? ;P  The work arounds are real...

Share this post


Link to post
Share on other sites

Hide object works fine, it's just that he doesn't take bullet damage when shot at.

The intention was not to get hideObject work but to test different methods of hiding an object because its possible that damage is handled in a different way...

desciption of tajins solution:

1. selectionNames - returns an array of all selection names of _unit

2. forEach goes through all elements of that array and _x represents the current element.

3. _unit hideSelection [_x, true] - hides the selection with the current selection name (_x) for the object _unit.

this methods ensures that u hide all hidable selection of an object.

Edited by sarogahtyp

Share this post


Link to post
Share on other sites

Do I really need to go to all the trouble to make the player Hide Object True,  spawn a dog in, set it's texture to nothing (because you can), attach it to the Predator, Group it to the Predator, annd when the dog dies the predator goes down with it all over again? ;P  The work arounds are real...

 

Yes you do. There's no other way unless you want to model your own player model which you can hide with setObjectTexture.

Share this post


Link to post
Share on other sites

Out of curiosity- is there no way to make a copy of the human VR entity and increase alpha transparency more? In worst case, with a new config class or something?

Share this post


Link to post
Share on other sites

Out of curiosity- is there no way to make a copy of the human VR entity and increase alpha transparency more? In worst case, with a new config class or something?

 

Change the 0.1 to 0 for invisible. It doesn't hide everything though (gear, gun).

player setObjectTextureGlobal [0,'#(argb,1,1,1)color(0,0,0,0.1,ca)']; 

Share this post


Link to post
Share on other sites

Hmm back in the alpha I used setObjectTexture with PiP to project a view of the terrain unter the feet of a unit as camoflage texture.

 

It worked surprisingly well. Consider using that if you want high-tech cloaking instead of magical invisibility. ^^

 

Here is an old screenshot of that.

stealth.jpg

 

 

Hmm maybe I'll make a new script for it now that those texture selections are more widely available.

Share this post


Link to post
Share on other sites

Hmm back in the alpha I used setObjectTexture with PiP to project a view of the terrain unter the feet of a unit as camoflage texture.

 

It worked surprisingly well. Consider using that if you want high-tech cloaking instead of magical invisibility. ^^

 

Here is an old screenshot of that.

stealth.jpg

 

 

Is there a way to texture the face though?

Share this post


Link to post
Share on other sites

Use a VR entity. I'm pretty sure you can texture those completely.

Share this post


Link to post
Share on other sites

@tajin:

could u post how u did that chameleon style cloaking? This is an amazing feature for future soldiers and I th8nk bout implementing it 8n a mission.

I think the best implementation would be to not just project the underground but the background behind the soldier seen from players point of view. So it could be a wall or the heaven as well.

Same projection could be done on vehicles. I think ur idea has great potential. A script snippet would be wonderful.... :)

Share this post


Link to post
Share on other sites

Interesting idea, never thought about it like that. It may look rather weird though due to texture wrapping.

 

I'm sure I still have it somewhere.

Share this post


Link to post
Share on other sites

I attached an eventhandler to all units to track bullets and then decloack the unit when bullet get near:

var_bullets = [];
{
	if(side _x == west) then
	{
		_firedId = _x addEventHandler ["fired", {
			_this spawn {
				//_this [obj:unit, str:weapon, str:muzzle, str:mode, str:ammo, str:magazine, obj:projectile]
				_bullet = _this select 6;
				var_bullets pushBack _bullet;
				while {alive _bullet} do {sleep 0.1;};
				var_bullets = var_bullets - [_bullet];
			};
		}];
	};
} foreach allUnits;

And then check via the Draw3D if any get close, decloack if they do. 

addMissionEventHandler ["Draw3D", {
    if(isObjectHidden player) then
	{
		{
			if(_x distance player < 2 && _x distance2D player < 0.2) then
			{
				palyer hideObjectGlobal false;
			};	
		} forEach var_bullets ;
	};
}];

I know it's not super fancy and accurate but it's something :). 

 

Ofcourse this does decloack the unit, so I suggest also changing his collor a bit like this for example:

player setObjectTextureGlobal [0,'#(argb,1,1,1)color(0,0,0,0.1,ca)']; 

This requires to remove gear to look fancy though, which again requires a custom damage handler to not mare your 'predator' die within 1 hit.

Hi mindstorm how can I use this code? Just paste it in the init? I could not get this to work.

 

Also, could the second decloak part of the script be modified so that instead of the predator unit decloaking for a second, it takes damage instead. So, like Predator setdamage {getDamage Predator} +0.01; to simulate the damage done by bullets. Also, instead of applying the damage to all units, how do I just apply it to either all opfor units or a unit names Predator?

 

I believe this code is on the right track to what i'm looking for.

Cheers.

 

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  

×