Euh... Libriut99 we are talking about two different scripts.
The one I'm talking about is V2.0
;**credits to MI_Fred @OFPEC forum**
;**original script by MI_Fred
;**original script name below**
;==MIF_FieldGunArty v.0.5==;
;**additional changes by Chris Death
;**altered the script to be used by a single machinegun
;**further additional tweaking by Silverfoot for crazy D-Day madness!
;**An afterthought by Blanco, combined with General Barron's manmg script
; ** Further tweaking by Blanco
_enemylist = _this select 0
_gun = _this select 1
; extra gunners are ** OPTIONAL **
?count _this == 2 : goto "jump"
_xtra = _this select 2
#jump
_rmax = 50
_rcount = 0
_rmax = _rmax / 1.2 + random 10
_mag = (magazines (_gun) select 0)
#waitforenemies
@count _enemylist !=0
goto "pickavictim"
#reset
_rcount = 0
#fireloop
_gunner = gunner _gun
_aimpoint = [(getPos _sucker select 0)+10*(sin(getDir _gun)),(getPos _sucker select 1)+10*(cos(getDir _gun)),(getPos _sucker select 2)-5]
_ax = _aimpoint select 0
_ay = _aimpoint select 1
_az = _aimpoint select 2
_gun doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)]
;gunner-check
?count _enemylist == 0 : goto "waitforenemies"
?!alive _sucker : goto "pickavictim"
?!alive _gunner : goto "nogunner"
;gun-functionality-check
? (getDammage _gun) >= 1 : goto "dammaged"
_gun doWatch [(_ax)-5+(random 5*10),(_ay)-5+(random 5*10),(_az)-2+(random 2*10)]
~0.05
_gun fire (weapons (_gun) select 0)
~0.05
?random 10 < 0.2: goto "wait"
;ammo-check
?_gun ammo (weapons _gun select 0) < 2 :goto "lowammo"
_rcount = _rcount + 1
? _rcount < _rmax : goto "reset"
goto "fireloop"
#pickavictim
_r = random count _enemylist
_r =_r - _r %1
_sucker = _enemylist select _r
~1
goto "fireloop"
#lowammo
_gun addmagazine _mag
~3
goto "fireloop"
#wait
_r = random count _enemylist
_r =_r - _r %1
_sucker = _enemylist select _r
;hint format ["%1",_sucker]
~2 + random 3
goto "fireloop"
#nogunner
?"alive _x" count units _xtra <= 0 :exit
;if the group manning the machine gun has no units left, exit the script
_gunner = units _xtra select (count units _xtra - 1)
;select the last unit in the group
_gunner assignAsGunner _gun
[_gunner] orderGetIn TRUE
;make him get in the gun
;; when the new gunner got shot on his way to the mg, make sure a new gunner is selected!
#lifecheck
?!alive _gunner : goto "nogunner"
~1
?!(_gunner in _gun) && alive _gun: goto "lifecheck"
;hint "gunner in"
;The new gunner must unjoin the EXTRA_gunners group,because if he dies the next man won't be selected anymore, i dunno why.
[_gunner] join grpnull
goto "waitforenemies"
The use of it is different than the first version
Every machinegun need a trigger in front if it , it represent it's firesector. Since this is only meant for static machineguns, you can perfectly define his firesector. It's a pity we cant "draw" the shape of a trigger in OFP, maybe in OFP2 ...
That trigger should be :
Dimensions : It's up to you! Don't make it to big (wide)
Shape : mostly oval, in streetfights I use rectangle, just covering the street
Activation : (Opposite side of MG) detected by (side of MG),ONCE
condition : this
On activation : [thislist,MG1,Xgnrs] exec "MG_salves_manmg2.sqs"-
thislist, just leave it like that
-
MG1 is the name of machinegun
-
Xgrns is the group name of a group of soldiers seperate to the M2 machine gun. These guys will sieze control of the M2 if/when the gunner dies. This time it's optional.
** CHANGES **- I removed the rounds parm, the salvo's are randomised and more realistic imo.
- It should work with all third party static machineguns without changing the script.
- The player is not always targetted like in the previous version, The gunner will pick a random victim in his sector adn he will pick another guy between every salvo or reload.
** TIPS **- It works best when the machinegun is on higher ground;
- You can hide your mg's in bunkers, houses, treehouses, whatever... He will schoot every enemy target in his firesector, no matter what.
Known Issues :- Works in SP and MP, but not recommended in MP, because it uses a tight loop (~0.05)
- The gunner will target every enemytype in his firesector. he will shoot men,tanks, planes, heli's... It think it should be better if he only target men and cars.
Not solved yet.