Jump to content
Raining6

Make a small barrier object invisible to player, but "visible" to the AI

Recommended Posts

I'm working on a "hide in grass" script where small barrier object is spawned in the line of sight of the AI (https://forums.bohemia.net/forums/topic/241358-towards-the-ai-cant-see-through-the-grass-holy-grail/).  At the moment, I'm using small wall objects from the editor, e.g., Land_Shoot_House_Wall_Long_Prone_F.  I need to make the barriers completely transparent for the player, but not transparent for the AI (to make them lose track of the player behind that barrier). 

 

[] spawn {_a = [[1818,6050.38,0], [1817.65,6103.3,0], [1817.65,6113.3,0]];  //some coords where 3 walls will be spawned
 _walls =[];  
 { createWall = createVehicle["Land_Shoot_House_Wall_Long_Prone_F ",  _x, [], 0, "CAN_COLLIDE"];
   hideObject createWall;
   createWall enableSimulation true;
   _walls pushBack createWall;
  } forEach _a;  

makes the barrier disappear not only for the player's eyes, but also the AI "vision" - the AI shoots though the hidden barrier. How could I make this barrier transparent for the player only?

 

Share this post


Link to post
Share on other sites

You can look for an object that has textures you can set.  For example you can make the zodiac invisible with this command, but it is still a real usable object (that I assume ai can't see through).  Most static objects like walls probably do not have settable textures. Try the following on any vehicle.  For many you can still see wheels and other parts, but zodiac completely disappears. One problem though is objects hidden this way still cast shadows.  Maybe one of those bill-board like objects that posters can be set on (the ones that have no physical poles or boards), I don't think they have shadows.  You can also try the invisible barrier object that can be used to block AI pathing.  I do not know if the barrier blocks line of sight though.  This works on the zodiac:

 _y=0; 
{
	myVehicle setobjecttextureGlobal [_y,'']; 
	_y=_y+1;
} foreach getObjectTextures myVehicle;

Another option is an eachFrame loop using forgetTarget constantly to make AI forget about the unit while your hiding condition true.

  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks, the boat trick works! It is completely transparent and the AI stops shooting when I am behind it.

cw = "B_Boat_Transport_01_F" createVehicle [1818,6050.38,0];
publicVariable "cw";
cw enableSimulation false;
_y=0;
{cw setObjectTextureGlobal [_y,""];
_y=_y+1;} foreach getObjectTextures cw;

But! 😞 Boat 's shadow is not the biggest problem. I can not shoot through the transparent boat myself, the bullets hit the boat with both simulation enabled or disabled. Being able to shoot through the invisible wall is crucial for grassy hill shootouts like below. Which is why I was using the plywood Land_Shoot_House_Wall_Long_Prone_F wall and hoping to make it transparent.

normals-working.jpg

 

The invisible wall which is available in the editor Land_InvisibleBarrier_F does not stop the AI shooting, neither does bill-board Land_Poster_01_F. 

7 hours ago, johnnyboy said:

Another option is an eachFrame loop using forgetTarget constantly to make AI forget about the unit while your hiding condition true.

ForgetTarget was something PierreMGI and myself tried in my main thread (https://forums.bohemia.net/forums/topic/241358-towards-the-ai-cant-see-through-the-grass-holy-grail/) . It completely breaks the AI squad logic. The current best solution is Pierre's disableFSM, but this also damages AI's logic and they hardly ever attempt to flank the player. A working invisible wall with bullet penetration would tick all the boxes on the other hand - AI can't see through grass, but will flank etc.

Share this post


Link to post
Share on other sites

Oh well.  I admire your tenacity.  A modded object with the specific properties you desire would likely work (above my pay grade though).   Here's another thought:  Smoke.   Units can't see through smoke, but can shoot through it.  I wonder if its possible to make invisible smoke particles that block view?  Also try the Tarp object (you can set it vertical), and see if they can see through it.  I know you can set texture on tarps.

Share this post


Link to post
Share on other sites

@Raining6

Have a look at @dmarkwick JTD_HIDE from A2. 

I downloaded this one years ago, but never got around to messing with it.

Might be down the route you're looking for.  Don't remember how it exactly worked (whether there where "holes" to shoot out, etc.)

  • Like 1

Share this post


Link to post
Share on other sites
20 hours ago, johnnyboy said:

Also try the Tarp object (you can set it vertical), and see if they can see through it.  I know you can set texture on tarps.

Tarp is a great idea! I could partly sink it underground to grass height too. Will try it tomorrow or day after.

I've already created a 3d 4.5m x 0.7m x 0.05m barrier .OBJ, but you're right about the paygrade - importing it into Arma is super convoluted. I've wasted a couple of hours today and still pretty much where I've started. Tarp way sounds much easier.

4 hours ago, panther42 said:

Have a look at @dmarkwick JTD_HIDE from A2. 

I downloaded this one years ago, but never got around to messing with it.

Might be down the route you're looking for.  Don't remember how it exactly worked (whether there where "holes" to shoot out, etc.)

Sounds interesting, but, like with my .OBJ, the transparent donut requires extracting and changing in Arma Object Builder to fit my purposes... That's assuming that his method with textures and what not works in Arma3 :)

Share this post


Link to post
Share on other sites

Nope, tarp and tents also do not seem to have settable textures.

With the B_Boat_Transport_01_F boat

_tgtAGL = [1818,6050.38,0]; 
cw = createVehicle["B_Boat_Transport_01_F",  _tgtAGL, [], 0, "CAN_COLLIDE"];
publicVariable "cw";

getObjectTextures cw

returns ["a3\boat_f\boat_transport_01\data\boat_transport_01_co.paa"]. 

With tarp (Tarp_01_Large_Green_F) and tents (Land_TentA_F) I get empty [ ] . They also do not become transparent with johnnyboy's code above.

So it looks like I do need a modded object: a simple barrier with settable textures and paper-like bullet penetration.

Share this post


Link to post
Share on other sites

Sorry about the bum steer on the tarp, I though I had used it in the past for textures.  I found one that works: "GalleryLabel_01_F".  It makes a little sign which you can set texture to "" to make it invisible (also set allowDamage false on it else it explodes when hit too many times).  It's small, but if you use setObjectScale to make it bigger it can hide the player.  It's invisible, units can't see you through it, and you can shoot through it.  But it still has problems:

  • It casts a shadow.
  • It blocks movement, so you would want to attach it to player so it moves with him (like the donut idea).

Here's the label object after scaling it up to 10 before hiding it:

after.jpg

 

Here's how it looks after hiding it.  You can see the shadow:

before.jpg

 

I named the object ss2, and used this code for the experiment:

ss2 setObjectScale 10;
ss2 setObjectTexture [0,""];
ss2 allowdamage false;
ss2 enableSimulation false;
bob doTarget player;
player addrating -99999999; // make player enemy of bob

Maybe since you are in grass, the shadow isn't too obnoxious?

  • Thanks 1

Share this post


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

It casts a shadow.

 

Would require a small mod but....

A simple config edit can disable object shadows...

8pxFFmO.png

Alhvhbi.jpg 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 3/7/2023 at 10:22 PM, johnnyboy said:

I found one that works: "GalleryLabel_01_F".  It makes a little sign which you can set texture to "" to make it invisible

A truly wonderous find! I've done a coup[le of quick tests tonight  and it it perfect, it is exactly what the script needs. I can now uninstall Arma Object Builder/Mikero Tools and try to forget the whole thing as a bad dream 🙂

 

On 3/7/2023 at 10:22 PM, johnnyboy said:

It casts a shadow.

Grass does obscure the shadow somewhat, but the shadow only become apparent as the sun moves away from its zentih. So at 12 noon the shadow is nearly unnoticeable and at 6am/pm it is pretty obnoxious.

 

On 3/7/2023 at 10:22 PM, johnnyboy said:

It blocks movement,

Not an issue at all with

player disableCollisionWith ss2;

I will put the whole script together tomorrow, but it does seem that all the parts are finally in place (Hooraaay!). Apart from the shadow, but that's more of a niggle than a showstopper.

On 3/7/2023 at 11:47 PM, EO said:

Would require a small mod but...

A simple config edit can disable object shadows...

Will try 0 spawn BIS_fnc_configViewer (is that what you are using?) tomorrow, thanks for the cool tip!

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, Raining6 said:

Will try 0 spawn BIS_fnc_configViewer

 

Config viewer (among other things) is available in the editor under the "Tools" tab.

  • Thanks 1

Share this post


Link to post
Share on other sites
8 hours ago, Raining6 said:

Will try 0 spawn BIS_fnc_configViewer (is that what you are using?) tomorrow, thanks for the cool tip!

 

I used the Config Viewer screenshot only to show that there is in fact a property that can be edited, in this case shadow=0 , by default this is shadow=1.

Once edited the config needs to be packed into a pbo to produce the second screenshot.:icon_biggrin:

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

All is well, here is a vid of the (still visible for testing, but it works when invisible too) GalleryLabel_01_F in action. Massive thanks again, Johnnyboy!:

 

I have also made the small mod to remove the shadow (Massive thanks thanks also, EO!:).

A little guide for posterity: add shadow=0 to GalleryLabel_01_F class in config.cpp in props_f_aow\a3\props_f_aow\Civilian\Gallery, put the config.cpp into some folder and make pbo of the folder with PboManager, create folder structure like steamapps/common/Arma3/!Workshop/@MyLittleMod/Addons, put the newly made pbo into the Addons folder, launch Arma, select add local mod, choose and activate the @MyLittleMod.  (I've used PboManager as Mikero's PboProject I could not get to work, all it does is throw errors and play sad Pachelbel's music 🙂 ).

 

I will test some more and will add the full script code to my main thread: https://forums.bohemia.net/forums/topic/241358-towards-the-ai-cant-see-through-the-grass-holy-grail/?page=2

  • Like 1

Share this post


Link to post
Share on other sites

Looks great!  Glad I could help.  Have you tried it in those beautiful Livonia grass fields?  I'm curious how it works there.  The grass is close to a meter high I think.

Share this post


Link to post
Share on other sites
2 hours ago, Raining6 said:

I have also made the small mod to remove the shadow (Massive thanks thanks also, EO!:).

A little guide for posterity: add shadow=1 to GalleryLabel_01_F class in config.cpp in props_f_aow\a3\props_f_aow\Civilian\Gallery, put the config.cpp into some folder and make pbo of the folder with PboManager, create a folder structure like steamapps/common/Arma3/!Workshop/@MyLittleMod/Addons, put the newly made pbo into the Addons folder, launch Arma, select add local mod, choose and activate the @MyLittleMod.  (Mikero's PboProject I could not get to work, all it does is throw errors and play sad Pachelbel's music 🙂 ).

 

Here is an edited config that disables the shadow on the GalleryLabel object....

Spoiler

class CfgPatches
{
	class Invisible_Shadow
	{
		addonRootClass="A3_Props_F_AoW";
		requiredAddons[]=
		{
			"A3_Props_F_AoW_Civilian"
		};
		requiredVersion=0.1;
		units[]={};
		weapons[]={};
	};
};
class CfgVehicles
{
	class NonStrategic;
	class Items_base_F;
	class GalleryLabel_01_base_F: NonStrategic
	{
		scope=0;
		scopeCurator=0;
		model="\a3\Props_F_AoW\Civilian\Gallery\GalleryLabel_01_F.p3d";
		DLC="Aow";
                shadow=0;
		icon="iconObject_1x1";
		editorCategory="EdCat_Signs";
		editorSubcategory="EdSubcat_Gallery";
		displayName="$STR_A3_CfgVehicles_GalleryLabel_01_base_F0";
		hiddenSelections[]=
		{
			"Camo_1"
		};
		hiddenSelectionsTextures[]=
		{
			"a3\props_f_aow\civilian\gallery\data\gallery_label_01_f_co.paa"
		};
		class Attributes
		{
			class ObjectTextureCustom0
			{
				displayName="$STR_3den_object_attribute_objecttexturecustom0_displayname";
				tooltip="$STR_3den_object_attribute_objecttexturecustom_tooltip";
				property="ObjectTextureCustom0";
				control="Edit";
				expression="_this setObjectTextureGlobal [0,_value]";
				defaultValue="(getObjectTextures _this) param [0,'',['']]";
			};
			class ObjectMaterialCustom0
			{
				displayName="$STR_3den_object_attribute_objectmaterialcustom0_displayname";
				tooltip="$STR_3den_object_attribute_objectmaterialcustom_tooltip";
				property="ObjectMaterialCustom0";
				control="Edit";
				expression="_this setObjectMaterialGlobal [0,_value]";
				defaultValue="(getObjectMaterials _this) param [0,'',['']]";
			};
		};
	};
};

 

 .....you can pack the config into an addon if it helps, or alternatively here is a link to the mod itself, packed and unpacked for your pleasure...

https://www.dropbox.com/scl/fo/bs9a1544xs7u9o6mrw83h/h?dl=0&rlkey=lqmnewjpcoj9anf0mtykpqzrj :rthumb:   

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
1 minute ago, EO said:

..you can pack the config into an addon if it helps, or alternatively here is a link to the mod itself, packed and unpacked for your pleasure...

EO is da man!!!!  😁

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites
3 hours ago, johnnyboy said:

Have you tried it in those beautiful Livonia grass fields? The grass is close to a meter high I think

I don't (yet? ) have the Contact DLC, so no Livonia - I'm very new to Arma, having never played Arma2/1/OFP, so saving shooting Aliens for (much?) later 🙂 However, the mod should still work, it only needs correct ASL, AGL coords and grass textures with string "grass" being part of the texture name. The height of grass=invisible wall is easy to adjust in the script.

 

2 hours ago, EO said:

Here is an edited config that disables the shadow on the GalleryLabel object....

Thanks! A much more elegant solution than mine, I've simply copied the entire config and added the shadow=0 bit to the relevant class (But it also worked, which was cool as none of my previous attempts at a mod ever resulted in anything more than mournful Pachelbel music coming out from PboProject. And yes, my PDirve is set up, etc. PboManager was the saviour in the end :))

  • Like 2

Share this post


Link to post
Share on other sites

 

On 3/7/2023 at 10:22 PM, johnnyboy said:

if you use setObjectScale

Hmm, setObjectScale turns out to be limited to Eden Editor missions only: https://community.bistudio.com/wiki/setObjectScale. It does not work in campaigns' missions or scenarios, for example. Is there a way to make it work, or am I back to "make your own 3d object" stage?

Share this post


Link to post
Share on other sites

I've created my own wall object, here it with Arma's GalleryLabel_01_F .

own-contraption.jpg

 

It appears in the game and in the editor menu, it stops the AI from seeing me, it lets in bullets, has no shadow - so it ticks all the boxes. All the boxes, but one.  I'm having a hard time making it invisible. I've made it with settable textures, just like Arma GalleryLabel_01_F again, but the magic 

ss2 setObjectTexture [0,""];

still does not seem to work.

Usually, if the getObjectTextures command returns a non empty [ ], the setObjectTexture command above turns the object transparent. But not in this case, I get paths to textures, but no transparency. 

here is config.cpp

Spoiler

#define _ARMA_

class CfgPatches
{
	class HIG_wall
	{
		units[] = {"land_HIG_wall"};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"a3_data_f"};
	};
};
class CfgEditorSubcategories
{
	class EdSubcat_HIG_wall
	{
		displayName = "HIG Walls";
	};
};
class CfgVehicles
{
	class All;
	class HouseBase;
	class Ruins: HouseBase{};
	class HIG_mywall: HouseBase
	{
		model = "\HIG_wall\BarrierG3.p3d";
		displayName = "A magic wall for hiding";
		editorCategory = "EdCat_Walls";
		editorSubcategory = "EdSubcat_HIG_wall";
		nameSound = "";
		mapSize = 8;
		icon = "iconStaticObject";
		accuracy = 0.2;
		armor = 99;
		destrType = "DestructNo";
		scope = 2;
		scopeCurator = 2;
		hiddenSelections[] = {"Camo_1", "Camo_2"};
		hiddenSelectionsTextures[] = {"\HIG_wall\barrierTex.paa","\HIG_wall\barrierTex1.paa"};
	};

};

 

model.cfg

Spoiler

 


class CfgModels
{
};
class CfgSkeletons
{
};

 

 

 

Link to the unpacked .pbo: https://app.box.com/s/63755308m0zto9pau5wrb20vo4mrut42

Any tips and advice would be much appreciated 🙂

Share this post


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

Couldn't you just set a texture, that is invisible (0 alpha value)? Either make a .paa, or a procedural texture. Or am I missing something?

Do you mean like that?

0-CA-builder.jpg

 

The object is indeed transparent while still being there (you can just about see its yellow outline in the editor). however, this makes the wall transparent not only to the player, but to the AI too - the AI keeps on shooting when I am behind it.

0-CA.jpg

 

Need settable textures like with the Arma Gallery label above to make it transparent to player only.

 

Share this post


Link to post
Share on other sites

The solution was to create a wall object with empty LOD 0, empty Geometry, empty Fire Geometry, and have the correct wall dimensions in ViewGeometry (as this is what the AI "see"). Many thanks to @HorribleGoat for the advice!

He also recommends setting

sbsource=none

in the Geometry LOD to save on performance.

Pics from Object Builder

Spoiler

0-CA-builder-2.jpg0-CA-builder-3.jpg

 

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

@Raining6 Absolutely amazing, I was looking for something like this! Could I please have your permission to include the invisible wall object and config in one of my mods? Of course I will give credit in the mod description where it is due.
I plan on using it to block AI line of sight with custom WP cover smoke effects, it would work perfectly if I make the wall a bit bigger and set a random direction. Would save immense amounts of FPS too, as I wouldn't need to have every particle block AI LOS.

Share this post


Link to post
Share on other sites
22 hours ago, garrett said:

@Raining6 Absolutely amazing, I was looking for something like this! Could I please have your permission to include the invisible wall object and config in one of my mods? Of course I will give credit in the mod description where it is due.
I plan on using it to block AI line of sight with custom WP cover smoke effects, it would work perfectly if I make the wall a bit bigger and set a random direction. Would save immense amounts of FPS too, as I wouldn't need to have every particle block AI LOS.

Happy to hear someone else found it useful! Feel free to use my invisible walls and I look forward to trying your mod :)

  • Like 1

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

×