Jump to content
anusmangler

forcing a unit to fire at target

Recommended Posts

Ive been trying to get a single unit to fire at a target. I atleast got him to look at it, trigger on act : person selectWeapon "arifle_MX_F"; person lookAt markerPos "targetmarker"; person fire ["arifle_MX_F","30Rnd_65x39_caseless_mag_Tracer"]; person being the units name and targetmarker is the marker with the name i would like him to shoot at. any help or something im doing wrong?

Share this post


Link to post
Share on other sites

need to target first

u1 dotarget e1;

u1 dofire e1;

example is with two units named e1 and u1 lines of code go in onact feild of a trigger

Share this post


Link to post
Share on other sites

So now i have this "u1 dotarget e1; u1 dofire e1; u1 selectWeapon "arifle_MX_F"; person lookAt markerPos "e1"; u1 fire ["arifle_MX_F","30Rnd_65x39_caseless_mag_Tracer"]; " and the unit only throws grenades at the target...anyway of him firing his rifle?

Share this post


Link to post
Share on other sites

place 2 riflemen near eachother and name one unitShooter and the other unitTarget.

Then add a radio trigger with the below on act works for me:

mainMuzzle = ((weapons unitShooter) select 0);

unitShooter selectWeapon mainMuzzle;

unitShooter doFire unitTarget

Share this post


Link to post
Share on other sites

the "unitShooter" still only throws grenades....which blows my mind because i took them from him. so idk how that happens. any other solutions? or something i could be doing wrong. I dont want them to shoot another unit....I want them to fire at a static target like "simple target 1" so when you walk by it looks like guys are in a firing drill session.

Share this post


Link to post
Share on other sites

I use this to have a unit fire a RPG at a predefined target.

In this case a battery above the tail rotor of a heli.

//nul=[AAMan1,TestBird] execvm "FireMissile.sqf"

_AAMan1 = _this select 0; //AT/AA man who will fire missile missile
_Heli = _this select 2;
_fakeTarget = "Land_Battery_F" createVehicle (getPos _Heli); 
_fakeTarget attachTo [TestBird, [0, -6, -10]];

doStop _AAMan1;
_AAMan1 setUnitPos "up";
_pWeap = primaryWeapon _AAMan1;
_AAMan1 selectWeapon _pWeap;
_AAMan1 doTarget _Heli;
_AAMan1 doFire _Heli;

Code was adapted from http://www.kylania.com/ex/?p=21

Share this post


Link to post
Share on other sites

Phaedin can you go into a little bit more detail here. I'm figuring this is in a SQF. How about something for a rifleman shooting a target? thanks so far guys

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

×