mattxr 9 Posted January 28, 2007 Can anyone help me get this script so the ai actually shoots at the target, i dont no if my codes wrong for arma somewhere or what? :S Quote[/b] ];?!(local Server): exit ~4 _unit = _this select 0 _target1 = _this select 1 _target2 = _this select 2 ? Battlefield : goto "loop" exit #loop ~10 + random 10 _unit knowsabout _target1 == 4 ~2 _unit doTarget _target1 _unit dofire _target1 ~1 + random 1 _unit setcombatmode "yellow" ~1 + random 1 _unit setcombatmode "blue" _target1 setdammage 0 _unit knowsabout _target2 == 4 ~10 + random 10 _unit setcombatmode "yellow" _unit doTarget _target1 _unit dofire _target2 ~1 + random 1 _unit setcombatmode "yellow" ~1 + random 1 _unit setcombatmode "blue" _target2 setdammage 0 goto "loop" init of the Ai Quote[/b] ][sniper1,targetg,targetg1] exec "distractionfire1.sqs" Share this post Link to post Share on other sites
kronzky 5 Posted January 28, 2007 I assume the two targets you're passing as parameters are actual enemies of the unit that's supposed to shoot at them? Because if they're just objects or friendly/neutral units your unit is not going to shoot, no matter how often you tell them to. Also, it seems that you're trying to use the knowsAbout to tell the unit something about the target? That's not how knowsAbout works though - you can only use it to read the knowledge one unit has about the other. Reveal is probably more what you need. Share this post Link to post Share on other sites
mattxr 9 Posted January 28, 2007 That will be my problem then, the two targets are pop up targets.. anyway i could get him to shoot them? Share this post Link to post Share on other sites
kronzky 5 Posted January 28, 2007 Search for "invisible targets". I think Lester did them a while ago for OFP, and AFAIK they're compatible with ArmA. I don't have a download link, but they've been mentioned here several times. Share this post Link to post Share on other sites
mattxr 9 Posted January 29, 2007 i cant use an addon.. but i found another flashpoint script which creates a guy randomly firing from a mg but it doesnt work... Quote[/b] ]; ***************************************************** ; ** Operation Flashpoint Script File ; ***************************************************** ;**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 ;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. _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" Share this post Link to post Share on other sites