Jump to content

Recommended Posts

I was wondering if it's possible to pop smoke from any other seat in a tank other than commander? I prefer to drive and have AI commander and gunner. Is it possible to script?

 

Thank you.

Share this post


Link to post
Share on other sites

Hi @pazuzu

 

You sure can! You'll need to use the BIS_fnc_fire command:

 

For example, to force an M2A1 Slammer (variable name Tank) to fire it's smoke launcher:

[Tank, "SmokeLauncher"] call BIS_fnc_fire;

 

For modded vehicles, you'll probably need to comb through config viewer to find the "muzzle" name of the smoke launcher. You could then in theory use addAction or other commands to bind it to a key - but that's a different conversation.

 

Hope this helps! 😎

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

I'll look into this. Thank you.

  • Like 1

Share this post


Link to post
Share on other sites

Or, if you want to try and go a little bit crazier, add this to the init checkbox of the vehicle (in editor) or execute in the pause menu debug/script console.
It will add an action to spawn a nice collection of flares on the pilot/driver's menu.

If it doesn't work at first attempt, replace "this" with "_this", or point the cursor to the cabin of the vehicle you want to add this action and replace "this" with "cursorObject".

 

	this addAction // (you might need to replaced this to _this instead;
		[
			"<t color='#cb8f0f'>Night FLARES</t>",
			{
				
	if (!isNil "flaresLastSpawned" && {flaresLastSpawned > time - 42}) exitWith { // (a little cooldown to avoid spawning them insanely;
		hint "Cooldown 42 secs";
	};
	flaresLastSpawned = time;
	
			flareN = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,50,150]); 
			flareN setVelocity [0,25,-5];
			flareNE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,25,150]);
			flareNE setVelocity [5,15,-15];
			flareE = "F_20mm_Red" createvehicle ((player) ModelToWorld [15,0,150]);
			flareE setVelocity [10,25,-5];
			flareSE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,-25,150]);
			flareSE setVelocity [-5,-15,-15];
			flareS = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,-50,150]);
			flareS setVelocity [0,-25,-5];
			flareSW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,-25,150]);
			flareSW setVelocity [-5,-15,-15];
			flareW = "F_20mm_Red" createvehicle ((player) ModelToWorld [-15,0,150]);
			flareW setVelocity [-10,25,-5];
			flareNW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,25,150]);
			flareNW setVelocity [-5,15,-15];
			},
			nil,
			-3,
			false,
			true,
			"User16",
			"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 150", // the [-1] means it will show only for pilot/driver;
			10,
			false
		];

 

  • Thanks 1

Share this post


Link to post
Share on other sites
9 hours ago, JCataclisma said:

Or, if you want to try and go a little bit crazier, add this to the init checkbox of the vehicle (in editor) or execute in the pause menu debug/script console.
It will add an action to spawn a nice collection of flares on the pilot/driver's menu.

If it doesn't work at first attempt, replace "this" with "_this", or point the cursor to the cabin of the vehicle you want to add this action and replace "this" with "cursorObject".

 


	this addAction // (you might need to replaced this to _this instead;
		[
			"<t color='#cb8f0f'>Night FLARES</t>",
			{
				
	if (!isNil "flaresLastSpawned" && {flaresLastSpawned > time - 42}) exitWith { // (a little cooldown to avoid spawning them insanely;
		hint "Cooldown 42 secs";
	};
	flaresLastSpawned = time;
	
			flareN = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,50,150]); 
			flareN setVelocity [0,25,-5];
			flareNE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,25,150]);
			flareNE setVelocity [5,15,-15];
			flareE = "F_20mm_Red" createvehicle ((player) ModelToWorld [15,0,150]);
			flareE setVelocity [10,25,-5];
			flareSE = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [15,-25,150]);
			flareSE setVelocity [-5,-15,-15];
			flareS = "F_20mm_Green" createvehicle ((player) ModelToWorld [0,-50,150]);
			flareS setVelocity [0,-25,-5];
			flareSW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,-25,150]);
			flareSW setVelocity [-5,-15,-15];
			flareW = "F_20mm_Red" createvehicle ((player) ModelToWorld [-15,0,150]);
			flareW setVelocity [-10,25,-5];
			flareNW = "F_20mm_Yellow" createvehicle ((player) ModelToWorld [-15,25,150]);
			flareNW setVelocity [-5,15,-15];
			},
			nil,
			-3,
			false,
			true,
			"User16",
			"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 150", // the [-1] means it will show only for pilot/driver;
			10,
			false
		];

 

 

Thank you. I'll give this a try and see how it works. I did only want tank smoke to work from driver seat but I'll relace the flares with whatever the tank smoke is called and see if it will protect the tank from AT missiles. I'll let you know how it goes.

I appreciate it.

  • Like 1

Share this post


Link to post
Share on other sites

My apologies! Don't know where my mind was, and I have completely messed up: my idea was to suggest the ACTUAL smoke, not the flares!

Dang it!

Regardless, here is a SMOKE spawning, instead of flares.
Cheers!

 

_thids addAction
	[
	"<t color='#24c048'>SMOKE</t>",
		{
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-7,5,1]);
		chemLitN = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,7,1]);
		chemLitE = "SmokeShell" createvehicle ((player) ModelToWorld [7,0,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [7,5,1]);
		chemLitS = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,-16,1]);
		chemLitSW = "Chemlight_yellow" createvehicle ((player) ModelToWorld [-5,-13,1]);
		chemLitSE = "Chemlight_yellow" createvehicle ((player) ModelToWorld [5,-13,1]);
		chemLitW = "SmokeShell" createvehicle ((player) ModelToWorld [-7,0,1]);
		
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,17,1]);
		chemLitN2 = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,19,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [19,0,1]);
		chemLitE22 = "SmokeShell" createvehicle ((player) ModelToWorld [19,17,1]);
		chemLitS2 = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,-13,1]);
		chemLitSW2 = "Chemlight_yellow" createvehicle ((player) ModelToWorld [-17,-19,1]);
		chemLitSE2 = "Chemlight_yellow" createvehicle ((player) ModelToWorld [17,-19,1]);
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,0,1]);
		},
		nil,
		-3,
		false,
		true,
		"",
		"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16",
		10,
		false
	];

 

Share this post


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

My apologies! Don't know where my mind was, and I have completely messed up: my idea was to suggest the ACTUAL smoke, not the flares!

Dang it!

Regardless, here is a SMOKE spawning, instead of flares.
Cheers!

 


_thids addAction
	[
	"<t color='#24c048'>SMOKE</t>",
		{
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-7,5,1]);
		chemLitN = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,7,1]);
		chemLitE = "SmokeShell" createvehicle ((player) ModelToWorld [7,0,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [7,5,1]);
		chemLitS = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,-16,1]);
		chemLitSW = "Chemlight_yellow" createvehicle ((player) ModelToWorld [-5,-13,1]);
		chemLitSE = "Chemlight_yellow" createvehicle ((player) ModelToWorld [5,-13,1]);
		chemLitW = "SmokeShell" createvehicle ((player) ModelToWorld [-7,0,1]);
		
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,17,1]);
		chemLitN2 = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,19,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [19,0,1]);
		chemLitE22 = "SmokeShell" createvehicle ((player) ModelToWorld [19,17,1]);
		chemLitS2 = "SmokeShellGreen" createvehicle ((player) ModelToWorld [0,-13,1]);
		chemLitSW2 = "Chemlight_yellow" createvehicle ((player) ModelToWorld [-17,-19,1]);
		chemLitSE2 = "Chemlight_yellow" createvehicle ((player) ModelToWorld [17,-19,1]);
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,0,1]);
		},
		nil,
		-3,
		false,
		true,
		"",
		"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16",
		10,
		false
	];

 

 

Ok, I took what you posted here and changed it to:

_this addAction
	[
	"<t color='#24c048'>SMOKE</t>",
		{
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-7,5,1]);
		chemLitN = "SmokeShell" createvehicle ((player) ModelToWorld [0,7,1]);
		chemLitE = "SmokeShell" createvehicle ((player) ModelToWorld [7,0,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [7,5,1]);
		chemLitS = "SmokeShell" createvehicle ((player) ModelToWorld [0,-16,1]);
		chemLitSW = "SmokeShell" createvehicle ((player) ModelToWorld [-5,-13,1]);
		chemLitSE = "SmokeShell" createvehicle ((player) ModelToWorld [5,-13,1]);
		chemLitW = "SmokeShell" createvehicle ((player) ModelToWorld [-7,0,1]);
		
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,17,1]);
		chemLitN2 = "SmokeShell" createvehicle ((player) ModelToWorld [0,19,1]);
		chemLitE2 = "SmokeShell" createvehicle ((player) ModelToWorld [19,0,1]);
		chemLitE22 = "SmokeShell" createvehicle ((player) ModelToWorld [19,17,1]);
		chemLitS2 = "SmokeShell" createvehicle ((player) ModelToWorld [0,-13,1]);
		chemLitSW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-17,-19,1]);
		chemLitSE2 = "SmokeShell" createvehicle ((player) ModelToWorld [17,-19,1]);
		chemLitW2 = "SmokeShell" createvehicle ((player) ModelToWorld [-19,0,1]);
		},
		nil,
		-3,
		false,
		true,
		"",
		"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16",
		10,
		false
	];

 

This is close to what I want but the wrong smoke ammo. I can't seem to find the rnds for the tank smoke screen. I checked at https://community.bistudio.com/wiki/Arma_3:_CfgVehicles_WEST

 

I'll keep fooling with it. Thanks again for the help.

  • Like 1

Share this post


Link to post
Share on other sites

I was also wondering if instead of using addaction, it could be bound to key?

Share this post


Link to post
Share on other sites
4 hours ago, pazuzu said:

I was also wondering if instead of using addaction, it could be bound to key?

 

Hey @pazuzu

 

CBA3 has a function to do this called CBA_fnc_addKeybind, although I've never tried it. You could (in theory) bind it to C, the same default keybind as the smoke launcher from the commander seat. Just make sure you have a condition that checks you're in the vehicle and maybe not in the commander seat.

 

Hope this helps 😎

  • Like 1

Share this post


Link to post
Share on other sites
On 5/10/2024 at 2:58 PM, Mr Elusive said:

 

Hey @pazuzu

 

CBA3 has a function to do this called CBA_fnc_addKeybind, although I've never tried it. You could (in theory) bind it to C, the same default keybind as the smoke launcher from the commander seat. Just make sure you have a condition that checks you're in the vehicle and maybe not in the commander seat.

 

Hope this helps 😎

 

I'll check that out. Thank you.

 

Quote

If it doesn't work at first attempt, replace "this" with "_this"

 

Thanks for that. I never really knew what the difference was but I guess it does matter. I tried making that change on some other code that I wanted to use and it made it work. Why does this make a difference?

Share this post


Link to post
Share on other sites
On 5/10/2024 at 2:27 PM, pazuzu said:

I was also wondering if instead of using addaction, it could be bound to key?


There is a parameter which allow you to define a custom key for any "addAction" you put in your scripts.
Take a look at this last part of the code I have previously posted, but now I have added a "user16" . That will tell the script that whenever the player uses the key configured as the "custom16" (see settings -> controls -> custom), it will execute this action.
You can have several "addActions" with the same key set, so they will trigger simultaneously once the custom control is pressed, but it can also be the same key already set for a mod, for instance, so there might be and easy-to-solve conflict. But you just need to check those control settings prior to set a "user" key, and everything is fine.

 

		},
		nil,
		-3,
		false,
		true,
		"user16",   // here you chose which custom key will trigger your action;
		"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16",
		10,
		false
	];


Oh, and I also forgot to mention that you don't exactly need the whole line bellow, as everything after the "&&" is there just because I wanted to avoid the action showing unless vehicle was flying bellow 17 meters height.

So you could NOT use this:
 

"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16"

...and just replace it for this instead:
 

"_this == _target turretUnit [-1]"

 

  • Like 1

Share this post


Link to post
Share on other sites
On 5/10/2024 at 2:16 PM, pazuzu said:

This is close to what I want but the wrong smoke ammo. I can't seem to find the rnds for the tank smoke screen. I checked at https://community.bistudio.com/wiki/Arma_3:_CfgVehicles_WEST

 

I'll keep fooling with it. Thanks again for the help.


I think you might NOT achieve the result you're looking for by using this method, because as far as I remember, the original smoke screen on tanks is actually a weapon, not a "feature".
There are ways to create "fake" weapons on vehicles to make them shoot pretty much any types of weapons we want, but I have never tried it for this. 🤔

I will mess with it a little bit and inform here in case of any good news!

Share this post


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

There is a parameter which allow you to define a custom key for any "addAction" you put in your scripts.

 

I completely forgot that was a thing in addAction and might be easier if you don't use CBA3, or don't want to rely on it.

 

On 5/11/2024 at 10:53 PM, pazuzu said:
Quote

If it doesn't work at first attempt, replace "this" with "_this"

 

Thanks for that. I never really knew what the difference was but I guess it does matter. I tried making that change on some other code that I wanted to use and it made it work. Why does this make a difference?

 

I've notice "this" works for init boxes within the editor, while "_this" works for pretty much everything else. I imagine there's a technical reason for it relating to passing parameters, but I'm not a software developer or computer programmer. 🤷‍♂️ Perhaps someone more knowledgeable than me can answer that.

Share this post


Link to post
Share on other sites
On 5/12/2024 at 7:06 PM, JCataclisma said:


There is a parameter which allow you to define a custom key for any "addAction" you put in your scripts.
Take a look at this last part of the code I have previously posted, but now I have added a "user16" . That will tell the script that whenever the player uses the key configured as the "custom16" (see settings -> controls -> custom), it will execute this action.
You can have several "addActions" with the same key set, so they will trigger simultaneously once the custom control is pressed, but it can also be the same key already set for a mod, for instance, so there might be and easy-to-solve conflict. But you just need to check those control settings prior to set a "user" key, and everything is fine.

 


		},
		nil,
		-3,
		false,
		true,
		"user16",   // here you chose which custom key will trigger your action;
		"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16",
		10,
		false
	];


Oh, and I also forgot to mention that you don't exactly need the whole line bellow, as everything after the "&&" is there just because I wanted to avoid the action showing unless vehicle was flying bellow 17 meters height.

So you could NOT use this:
 


"_this == _target turretUnit [-1] && (getPosATL _target) select 2 < 16"

...and just replace it for this instead:
 


"_this == _target turretUnit [-1]"

 

 

I'll give it a try. Thanks.

Share this post


Link to post
Share on other sites
23 hours ago, Mr Elusive said:

 

I completely forgot that was a thing in addAction and might be easier if you don't use CBA3, or don't want to rely on it.

 

 

I've notice "this" works for init boxes within the editor, while "_this" works for pretty much everything else. I imagine there's a technical reason for it relating to passing parameters, but I'm not a software developer or computer programmer. 🤷‍♂️ Perhaps someone more knowledgeable than me can answer that.

 

I'm running this stuff through zeus enhanced. It's strange that before I started using the enhanced version the underscore wasn't required. Now with enhanced the underscore has to be used.

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

×