Jump to content
flyinpenguin

[Release] Tigris Flak Conversion Script

Recommended Posts

Tigris Flak Conversion Script by Flyinpenguin

Version 1.1

pSL9f2P.png

How to Use/Install:

This script works without any other mods and can be put inside any mission.

First you need to put the 'Flak' folder containing 'flak.sqf' inside your mission folder.

Next you need to add the following to the init of a Tigris vehicle

this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "Flak\flak.sqf";}];

Congratulations! You have now have a flak Tigris!

Features:

This script converts a Tigris into a flak firing demon meant to scare pilots flying over a sector.

This vehicle works for both AI and players. Players are restricted to same constraints as AI (IE distance and accuracy)

For player use, simply aim directly at whatever you want to fire flak at and fire!

AI will work as default and fire whenever a normal AI would fire. They can distrubute Flak over multiple targets even if they look like they are only shooting at one.

Flak accuracy is based upon speed of target and distance.

Customizable! Open flak.sqf with notepad to edit variables at the top!

Multiplayer Compatible!

Notes:

This script is customizable! Open flak.sqf and freely edit the variables at the top. It provides documentation on what they mean.

The Tigris is designed for air targets only. There is a variable in flak.sqf that will let it fire at ground vehicles. It was designed to simulate 'under the radar flight'.

Script was designed for private use within the 72nd Airborne Division. http://72ndad.enjin.com/

ChangeLog:

v1.0 - Initial Release!

v1.1 - Targeting fixes

Fixed- AI now respect Hills and trees and will not cheat

Changed- Targeting is now based upon AI skill

Changed- Adjusted default settings for firerate

Download: v1.1

Dropbox - https://www.dropbox.com/s/hspyrhmh7sslbti/TigrisFlakConversion.7z?dl=0

news_download_a3_3.png

Tigris Flak Conversion Script v1.1

Edited by flyinpenguin
  • Like 3

Share this post


Link to post
Share on other sites

Simple and effective. Thanks for the script man. Also, there is only little white smokes/clouds when I use it. We can clearly see dark ones on your screenshot. Maybe cause I'm using BlastcoreFX ? Anyway thanks you again

Share this post


Link to post
Share on other sites
Simple and effective. Thanks for the script man. Also, there is only little white smokes/clouds when I use it. We can clearly see dark ones on your screenshot. Maybe cause I'm using BlastcoreFX ? Anyway thanks you again

yes, that would change when using Blastcore. Also, because the screenshot was taken when in the VR map, the color/contrast is super exaggerated compared to a regular map.

Also, TY Foxhound!

Share this post


Link to post
Share on other sites

There will be an update in the future soon, found a few features that need to be improved.

These are the AI targeting method and the position used for center point of randomization of flak. Will have at least the second one done by next week if not both.

For now, I recommend setting the maximum range to below 1500m. Side note, setting the minimum height to 0 makes for some hilarious ground combat, though not implemented quite correct yet so it is a bit powerful at the moment. This should be fixed in the next update as well as long as I get the AI targeting method done.

Also, still in closed beta right now is an addon version of this! You will not need to put anything into the init of the tigris, so spawning them down mid-mission will not pose an issue. Should also improve performance with the addon version.

Edited by flyinpenguin

Share this post


Link to post
Share on other sites

Updated to v1.1

v1.1 - Targeting fixes

Fixed- AI now respect Hills and trees and will not cheat

Changed- Targeting is now based upon AI skill

Changed- Adjusted default settings for firerate

Found a bug as well. Script uses nearTargets which works fine usually. Unfortunately on Altis (not sure about stratis but im assuming) nearTargets picks up literally everything. So until I can work around this, use this only on addon maps.

Edit: It will work on Altis, just don't place it down where there is a lot of light fixtures. Aka, the main airfield. Fix is coming, I have not been able to focus on this mod yet. I already completed a proof of concept design and will be doing a final implemention hopefully next week. Good rule of thumb is to try out the spots you intend to place the tigris down before the mission and see if they fire at helo's. If they dont, you may need a new spot.

Edited by flyinpenguin

Share this post


Link to post
Share on other sites

I dont get this? I get no flak any way I run it. So. I have 0 mods running just vanilla Arma 3. I put your mission in my folder. Loaded it up in the VR and got in the tigris. I get in the gunner spot and shoot any nothing is happening.

---------- Post added at 04:11 ---------- Previous post was at 04:08 ----------

My ammo stay full but no flak is showing up and the rounds have no effect on my teamates or vehicles o even the ground.

Share this post


Link to post
Share on other sites
I dont get this? I get no flak any way I run it. So. I have 0 mods running just vanilla Arma 3. I put your mission in my folder. Loaded it up in the VR and got in the tigris. I get in the gunner spot and shoot any nothing is happening.

---------- Post added at 04:11 ---------- Previous post was at 04:08 ----------

My ammo stay full but no flak is showing up and the rounds have no effect on my teamates or vehicles o even the ground.

That sounds normal. You can only fire at targets, IE vehicles and AI or player units. You cannot fire just at the ground. Also, it prevents you from shooting at ground targets by default. There is a configuration to change this if you wish. Spawn a helicopter and have it fly over you and aim directly at it while firing. Let me know if you have any further issues.

Share this post


Link to post
Share on other sites

This script is a thing of beauty - thank you, flyingpenguin! I'm curious about what's happening under the hood. You mention that it's intended to scare pilots, and I would say mission accomplished. Does it change the traditional Tigris ammo in some way? I feel like it does less damage than your average AA cannon, which makes me very happy. For example, I flew the USAF C-130J back and forth over a Tigris with this script and it didn't take a lick of damage. The pilot occasionally got hurt, but that's about it. Likewise for an RHS Chinook; it took a lot of passes directly over the Tigris before it did enough damage to knock it out of the sky. Like I said, that is great news for me as it provides the fear factor without the automatic death sentence. Did you change something to reduce the lethality?

 

P.S. - Would this work with the RHS ZSU-234?

Share this post


Link to post
Share on other sites

@dishardfc, it does not reference the power of the ammunition whatsoever.  The damage comes from a default explosion effect type that Arma 3 has in it by default and looks somewhat like flak.  That is the thing that is damaging the aircraft, and it can be spawned inside the aircraft, which is why it can hurt the pilot.  Otherwise, there is no actual bullet coming towards the aircraft, it just simulates it.

 

And sadly, it will not work with the RHS ZSU-234 without some modifications.  I did not initially design it to be that modular, but it is a good idea to let it apply to a larger range of vehicles.

I have had another version of this in mod form that I have been sitting on for a while.  It makes the flak even more scary and realistic.  That version has a chance of killing instantly, but is not very likely at all unless the pilot flies at very slow speeds.  Currently it is only used privately within my community, but I do plan on releasing it at some point. Let me know if you are interested in beta testing it for your group and we can see about getting you a copy.

Share this post


Link to post
Share on other sites

Eden update broke this nice little script. Can anyone else confirm and may be fix too? I will post my script error when I get home.

Share this post


Link to post
Share on other sites

Well thats not good. Let me know if it is broken.  I will test my current version when I get the chance, thoughmy current version is a mod based version.  If this one is broken, sadly I won't update it and will only support the mod when I release it.

Share this post


Link to post
Share on other sites
//Maximum distance target can be for flak to activate
_maxDistance = 4000;

//When Flak Tigris has less than this ammo count (total ammo 680) it will spawn flak.  IE value 678 will spawn one flak per three shots.
_ammoCountForFlak = 678;

//Linear Dispersion when speed is zero, dispersion added is zero.  When speed is 100 km/h, dispersion will equal this variable
_speedDispersion = 20;

//Linear Dispersion when distance is zero, dispersion added is zero.  When distance is 500m, dispersion will equal this variable
_distanceDispersion = 10;

//Height target must be for flak to activate (IE target can fly "under the radar")
_targetMinHeight = 20;


//END Editable variables

_unit = _this select 0;
if (_unit ammo "autocannon_35mm" < _ammoCountForFlak) then {
    (_unit) setAmmo ["autocannon_35mm", 680];
    _tarPos = [];
    _target = 0;
    if (isPlayer (assignedGunner _unit)) then {
        _target = cursorTarget;
        if (_unit distance _target < _maxDistance) then {
            _tarPos = getPos _target;
        };
    } else {
        _possTar = _unit nearTargets _maxDistance;
        if ((count _possTar) > 0) then {
            _threat = 0;
            {
                if (_x select 3 > _threat) then {
                    _threat = _x select 3;
                    _target = _x select 4;
                    _tarPos = getPos _target;
                };
            } forEach _possTar;
            _unit fireAtTarget [_target];
        };
    };
    if ((count _tarPos) > 0) then {
        _tarX = _tarPos select 0;
        _tarY = _tarPos select 1;
        _tarZ = _tarPos select 2;
        if (_tarZ > _targetMinHeight) then {
            _flakDis = ((speed _target) * (_speedDispersion / 100)) + ((_unit distance _target) * (_distanceDispersion / 500));
            _disX = (random (_flakDis * 2)) - _flakDis;
            _disY = (random (_flakDis * 2)) - _flakDis;
            _disZ = (random (_flakDis * 2)) - _flakDis;
            _flak = "SmallSecondary" createVehicle [_tarX + _disX, _tarY + _disY, _tarZ + _disZ];
        };
    };
};

 error

14:06:35   Error Type Number, expected Object
14:06:35 File mpmissions\__CUR_MP.Altis\scripts\flak.sqf, line 40
14:06:36 Error in expression <s _target;
};
} forEach _possTar;
_unit fireAtTarget [_target];
};
};
if ((count>

Share this post


Link to post
Share on other sites
_unit = _this select 0;
if (_unit ammo "autocannon_35mm" < _ammoCountForFlak) then 
{
 (_unit) setAmmo ["autocannon_35mm", 680];
 _tarPos = [];
 _target = 0;

 if (isPlayer (assignedGunner _unit)) then 
 {
  _target = cursorTarget;

  if (_unit distance _target < _maxDistance) then 
  {
   _tarPos = getPos _target;
  };
 } 
 else 
 {
  _possTar = _unit nearTargets _maxDistance;
  if ((count _possTar) > 0) then
  {
   _threat = 0;
   {
    if (_x select 3 > _threat) then 
    {
     _threat = _x select 3;
     _target = _x select 4;
     _tarPos = getPos _target;
    };
            
   } forEach _possTar;

   _unit fireAtTarget [_target];
  };
 };

 if ((count _tarPos) > 0) then 
 {
  _tarX = _tarPos select 0;
  _tarY = _tarPos select 1;
  _tarZ = _tarPos select 2;

  if (_tarZ > _targetMinHeight) then 
  {
   _flakDis = ((speed _target) * (_speedDispersion / 100)) + ((_unit distance _target) * (_distanceDispersion / 500));
   _disX = (random (_flakDis * 2)) - _flakDis;
   _disY = (random (_flakDis * 2)) - _flakDis;
   _disZ = (random (_flakDis * 2)) - _flakDis;
   _flak = "SmallSecondary" createVehicle [_tarX + _disX, _tarY + _disY, _tarZ + _disZ];
  };
 };
};

i think the problem is located in line 28.

the variable _target contains 0 at this point but it should be the target object.

 

in line 10 this is done correct but only if the assigned gunner is _unit.

In the else case after line 18 there is no such object assignment for variable target.

because of that _target is the number as it was inited. In this case 0.

You cant get the position of a number.

 

that where wrong thoughts... just thinking about again.

Share this post


Link to post
Share on other sites

replace line 33 with the following code:

if (_thread > 0) then { _unit fireAtTarget [_target];};















the reason is that if _thread is 0 or lower, then all targets are friendly and will not handled by the if condition at line 24 where _target is asigned.

 

Please give a feedback if that works.

Share this post


Link to post
Share on other sites

Ah, this makes more sense now guys.  @jandrews1, you are using the old version of the script.  I recommend updating to version 1.1 of the script.  Course, if you want to keep using that version for some reason, try @sarogahtyp 's fix.  

Share this post


Link to post
Share on other sites

Does anyone know why this wouldn't be compatible with the IFA3 Flakverling 38's? I switched the ammotype in the flak.sqf but nothing seems to appear.

Share this post


Link to post
Share on other sites

I have managed to change the script so that it can work on all AA vehicles.

It automatically selects the weapon fired in the script.

 

Spoiler

Add the following to the init of the RHS ZSUs. Since ammo is infinite, I have chosen 680, as that is the maximum the Tigris can hold.

this setAmmo [weapons this select 0, 680];

this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "flak_all_infinite.sqf";}];

 

For any AA vehicle which has missiles remember to remove the missiles ammo using the removeMagazinesTurret otherwise the script won't work.

The script can be included within the mission folder or in a separate sub-folder within the mission folder.

 

All AA vehicles - Flak

 

Features:

  1. Works for any vehicle which has an autocannon.
  2. Type of explosion can be set at Line 83. Options are SmallSecondary and HelicopterExploSmall. SmallSecondary can be used for helicopters, while  HelicopterExploSmall can be used for planes. If there any other type of explosions which work then, please do tell, I'll update the code, or you can create a merge request.

For testing the mission as is in virtual reality, clone the repository to the missions folder in your Arma 3 profile folder. The profile folder will be present in Documents.

To test the mission, you will need these mods. In case that does not work, then use these mods.

 

Future Changes:

Allow editable variables to be changed via the Event Handler itself.

Share this post


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

 

Where did you paste that line of code?


I posted 
this removeMagazinesTurret ["4Rnd_Titan_long_missiles", {0}]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "scripts\flak.sqf";}];

In the init of the tigris

Share this post


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

this removeMagazinesTurret ["4Rnd_Titan_long_missiles", {0}]; this addEventHandler ["Fired", {deleteVehicle (_this select 6); _this execVM "scripts\flak.sqf";}];

It's supposed to be,

this removeMagazinesTurret ["4Rnd_Titan_long_missiles", [0]]

 

A square dictionary and not curly around the 0, _this can be passed to the script. It will work

 

for a different way of using flyinpenguin's script you can refer to the links below,

Tigris Usage

 

https://forums.bohemia.net/forums/topic/235667-update-and-release-aa-vehicle-flak-conversion-script/
 

The above is a separate post linking this post to the scripts which can be used via execVM. 

Edited by Orion1234
Based upon Harzach corrections, I have corrected my post
  • Like 1

Share this post


Link to post
Share on other sites
11 minutes ago, Orion1234 said:

_this will not work when using execVM

 

Sure it will, in a case such as this where it's "this" passed into the EH.

this removeMagazinesTurret ["4Rnd_Titan_long_missiles", {0}]; 
this addEventHandler 
[
	"Fired", 
	{
		deleteVehicle (_this select 6);
		_this execVM "scripts\flak.sqf";
	}
];

 

 

 

  • Thanks 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

×