Jump to content

Recommended Posts

I searched around the forum a bit but couldnt find a good flak simulation script for arma/arma2, so i made this one:

; Flak simulation script by *[600]*The Itch
;
; usage (in a trigger or in the units init line): [plane1, 150] exec "flak.sqs" 
; where plane is the name of the unit and 150 is the amount of flak rounds

_flaktype = "SmallSecondary"
_unit = _This Select 0
_amountflak = _This Select 1
_amountflak = _amountflak / 2
_i = 0

#flakrun
_flakLoc = GetPos _unit
_flakLocX = _flakLoc select 0
_flakLocY = _flakLoc select 1
_flakLocZ = _flakLoc select 2

_flak1 = _flaktype createVehicle[_flakLocX + random 80, _flakLocY + random 50, _flakLocZ + random 50]
~0.7
_flak2 = _flaktype createVehicle[_flakLocX + random 60 - random 20, _flakLocY + random 50 - random 10, _flakLocZ + random 50 - random 30]
_i=_i+1
? _amountflak > _i: goto "flakrun"

exit

This will spawn explosions around the unit (like a flying plane or helicopter) but it will not hit it or damage it so it simulates flak like in this movie:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/watch?v=v3xPX3K0iHk&hl=de&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/watch?v=v3xPX3K0iHk&hl=de&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

Share this post


Link to post
Share on other sites

Good idea with SmallSecondary :)

Share this post


Link to post
Share on other sites

another update of the script, instead of spawning explosions around a moving object, this version will spawn explosions randomly in a circle from a gamelogic or trigger:

; Flak area simulation script by *[600]*The Itch
;
; usage (in a trigger or in the units init line): [flakarea1, 150, 100, 500] exec "flak.sqs" 
; where flakarea1 is the name of the gamelogic or trigger and 150 is the amount of flak rounds, 
; 100 is approximate height of the explosions and 500 is the circle of explosions

_flaktype = "SmallSecondary"
_unit = _This Select 0
_amountflak = _This Select 1
_amountflak = _amountflak
_height = _This Select 2
_radius = _This Select 3
_center = 0

_i = 0

_flakLoc = GetPos _unit
_flakLocX = _flakLoc select 0
_flakLocY = _flakLoc select 1
_flakLocZ = _height

#flakrun
_fheading = random 360 
_frange = random _radius

_exploslocx = _flakLocX + ((random _radius) * (sin(_fheading)))
_exploslocy = _flakLocY + ((random _radius) * (cos(_fheading)))
_exploslocz = _height + random 30

_flak1 = _flaktype createVehicle[_exploslocx, _exploslocy, _exploslocz]
~0.02
_i=_i+1
? _amountflak > _i: goto "flakrun"

exit

my math isnt that good but this works for me

Edited by [BnB]The Itch

Share this post


Link to post
Share on other sites

Oh man this is great, but when you connect this script and flak script created by SUPR3ME KILL3R and Updated for Arma 2 Zu-23 by Recoilless its even better, you see aa fire from ground up to sky and then explosions in the midair. Now only need WWII mod ;]

Share this post


Link to post
Share on other sites

yea i WISH it would damage the planes, but somehow it doesnt do that. Right now only thing i can think of is make a couple of other triggers in the AA field where it would do random damage to a plane to simulate hitting flak explosions. You wouldnt be able to dodge anything in such flak fields anyways, its just pure luck to make it or not.

Share this post


Link to post
Share on other sites

you can easily spawn bullets at the point of the explosion to simulate flak, depending on type could cause damage to the aircraft if hit :)

Share this post


Link to post
Share on other sites

I know what you do just not how exactly, you need to create a bomb instead of the explosion. That's easy enough but it will fall to the ground and explode.

What it needs is an invisible object to collide with it, that's the part I'm stuck on.

I can't seem to set off the bomb.

Share this post


Link to post
Share on other sites

I've made one for arma1 where artillery shells are shot up in the air. After an random time a small object is then spawned in front of them to make them explode midair.

Worked quite well and was damn painfull to fly through.

It did however produce some desync if used on large areas.

Another alternative, though not as powerful would be to use timed charges like handgrenades and let them rain down from above.

ps.: the modeltoWorld command works wonders if you want something to appear in front of the shell

Share this post


Link to post
Share on other sites
I've made one for arma1 where artillery shells are shot up in the air. After an random time a small object is then spawned in front of them to make them explode midair.

Worked quite well and was damn painfull to fly through.

It did however produce some desync if used on large areas.

Another alternative, though not as powerful would be to use timed charges like handgrenades and let them rain down from above.

ps.: the modeltoWorld command works wonders if you want something to appear in front of the shell

I tried modeltoworld but gave up as I can't work out the right brackets when giving a location.

I also did one the other day that spawns a sam site and sticks one up your ass.

Anyway I have got it working but it needs other stuff like height and if !alive checks, I also made it into an SQF as I need the practice.

;// Flak simulation script by *[600]*The Itch
;//
;// usage (in a trigger or in the units init line): nul=[plane1, 150] execVM "flak.sqf" 
;// where plane is the name of the unit and 150 is the amount of flak rounds
;// works better in a trigger 


_unit       = _This Select 0;
_amountflak = _This Select 1;
_amountflak = _amountflak / 2;
_range = 1;

//_flaktype   = "SmallSecondary";
_flaktype   = "grenade";


for [{_i = 0},{_i < _amountflak},{_i = _i + 1}] do
{
_flakLoc = GetPos _unit;
 _flakLocX = _flakLoc select 0;
  _flakLocY = _flakLoc select 1;
  _flakLocZ = _flakLoc select 2;

if ((random 2) > 1.87) then {
hint"Hit";
_range = 10;
//_speed = random 11;
//dir = getdir _unit;
// _dir = random 359;
//_zvel = (random 10) +3;
//_unit setVelocity [_speed * sin(_dir), _speed * cos(_dir), _zvel];  



};
  _flakLocX = _flakLocX + ((random 50)-25)/_range ;
  _flakLocY = _flakLocY + ((random 50)-25)/_range ;
  _flakLocZ = _flakLocZ + ((random 40)-20)/_range ;

  _flak1   = _flaktype createVehicle [_flakLocX,_flakLocY ,_flakLocZ];
   _hammer = "weaponholder" createVehicle [_flakLocX,_flakLocY ,_flakLocZ];
   _hammer  setpos [_flakLocX,_flakLocY ,_flakLocZ];
   sleep (random 0.7);
_range = 1;  
};

I had to play about with the accuracy as the bombs used in this way seem to have a very small radius of damage.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

Believe it or not, flak is still used against low-tech aircraft or slow-moving aircraft.

big badda BOOM!!!!!! :yay:

Share this post


Link to post
Share on other sites
I know what you do just not how exactly, you need to create a bomb instead of the explosion. That's easy enough but it will fall to the ground and explode.

What it needs is an invisible object to collide with it, that's the part I'm stuck on.

I can't seem to set off the bomb.

i said bullets, not bombs :)

doesn't _bomb setdamage 1 make them explode ?

Share this post


Link to post
Share on other sites
Believe it or not, flak is still used against low-tech aircraft or slow-moving aircraft.

big badda BOOM!!!!!! :yay:

I just tried it on the C130 limited speed and 500meters it didn't stand a chance.

Share this post


Link to post
Share on other sites

But how does yours work, thing is it just spawns grenades that fall down, but any missed grenade will explode on the ground. I cant seem to make it work so they explode midair (thats why i used smallsecondary because i couldnt get anything else to explode midair). And i dont know how to spawn ammo midair like perhaps one shilka round

Share this post


Link to post
Share on other sites
The Itch;1401985']But how does yours work' date=' thing is it just spawns grenades that fall down, but any missed grenade will explode on the ground. I cant seem to make it work so they explode midair (thats why i used smallsecondary because i couldnt get anything else to explode midair). And i dont know how to spawn ammo midair like perhaps one shilka round[/quote']

Your right thanks for pointing that out, I posted the wrong version and updated the post.

The grenades or set off by creating an invisible object in this case "weaponholder" at the same point as the grenade so it thinks it's hit something.

That's the problem, different ammo will fail to work unless you find the right point to place the ammo.

It's also why it's difficult to blow up a plane in flight with a bomb, you really need to find the centre which isn't always 0,0,0.

It still needs work,

Stop firing when below a certain altitude or killed.

More damage from grenades.

More accurate maybe.

Add effects to physically nudge the plane or chopper, I did a bit but disabled it with //

Edited by F2k Sel

Share this post


Link to post
Share on other sites

ahh thanks F2k Sel, now its perfect :) anyways sometimes in missions you want flak simulation that doesnt damage (i have one mission where troops are being transported and the players are not flying themselves). And im working on a flying mission where damaging flak like this is good. The small amount of damage is good as well because its so hard to dodge the flak anyways. And it doesnt have to be more accurate, you can just fire more grenades by lowering the delay interval, that increases the accuracy as well

Share this post


Link to post
Share on other sites

Yea I still use yours for effect, I'll have a look tonight and see if I can clean it up a bit.

Share this post


Link to post
Share on other sites

ok im new to downloading stuff for Arma so can anyone tell me where i extract this stuff to? I've fiddled around with it but i keep getting an error message pop up.

Share this post


Link to post
Share on other sites

What are you downloading?

Where are you placing it?

What error are you getting?

The only thing here are scripts which you copy and paste into a text editor (note pad) or better still an arm script editor such as ArmA Edit. If you do use note pad make sure your not saving it as a txt file.

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  

×