Jump to content

Sign in to follow this  
Krofton

Force small arms fire on armored targets?

Recommended Posts

I am currently creating a mission in which a Stryker team must reach a destination through Corazol with enemy infantry in ambush positions throughout the path. For an ambience effect I would like to have the rifle and machine gun troops fire at the Strykers (yes even though it wont do anything), not just the AT troops. Is there any way to implement this? Help would be MUCH appreciated as I am pretty much at a standstill because of this problem. Search has done nothing for me, I apolagize if this is a dumb question.

Share this post


Link to post
Share on other sites

Did u tried the

_unit doTarget _stryker

_unit doFire _stryker

?

Share this post


Link to post
Share on other sites

Yes I am currently using the following init line:

{_x doFire Stryker1} foreach units group this

I tried adding the doTarget to it as well but to no avail.

Any Ideas?

Share this post


Link to post
Share on other sites

You can use the "useWeapon" action to force a unit to fire a weapon. This will happen whether the unit is ready or not, even if the weapon is on his back.

unit2 action ["useWeapon",vehicle,unit1,index]

unit2 = any man or gameLogic unit that is NOT the one to shoot. If you use a man, he will bend down as if to pick something up. This unit must not be in a vehicle.

vehicle = the vehicle to execute the action (shoot). If you just want a unit who is not in a vehicle to shoot, this should be the same as the unit.

unit1 = the unit to execute the action. In this case he will shoot his gun.

index = Muzzle/Mode index. A number. I don't know exactly how this works, 0 tends to be a single shot from the rifle, but not always.

Share this post


Link to post
Share on other sites

Yeah its confirmed, doFire will still not make them fire at the stryker...if I replace the stryker with a civilian and leave it the same name, voila, the AI fires at him. It looks like I'm going to have to change a value in the Stryker's vehicle config maybe...to make AI think it is a light vehicle (such as a hummer) so they will fire their small arms at it but yet still have the Stryker immune. Anyone up to the task of figuring this out for me? I'm really desperate at this point and I would really appreciate it.

Share this post


Link to post
Share on other sites

You *could* use an invisible target of a type the troops would fire at, and have it in an updating loop of code to setpos it onto the strykers position. Then use the dofire etc commands for the small arms armed troops to fire at the invisible target.

I did something similar in OFP, I'll see if I can dig it out for you.

Share this post


Link to post
Share on other sites

Yeah I was thinking something with an invisible target might work, the hard part would be to have it be attached to the Stryker itself...and I would have no clue how that would work. I would really appreciate it man, thank you!

Share this post


Link to post
Share on other sites

all you'd need is a script running simply looping all the time, maybe on a 1-2 second loop. Something like this

#Loop

?!(alive stryker):exit

invTarget setpos (getpos stryker)

~1 or 2

goto "Loop"

I don't know what the performance hit would be. You could of course change it to run many instances of the same script, but again, that'd probably not be good performance wise.

Code's not guaranteed to work. I'm just getting back into this.

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  

×