Jump to content
Sign in to follow this  
rebelsupertrooper

How do you make the AI kill a specific target?

Recommended Posts

I'm trying to make a assasination mission, where an AI sniper will wait for a spefic soldier to appear then take him out, and youve got to locate the sniper etc etc. I've got the basics of the mission down all i need is a script to get the AI to stay and wait for the target to appear and shoot him.

I've tryed the Destroy or seek and destroy waypoints but its not working, and I can't find a script for it. Is it possible? If so can someone help me?

Share this post


Link to post
Share on other sites

The easiest way to achieve this would propably be using the doFire command. When the target is wherever you want him to get shot, run the following lines by script, trigger or other means (the target getting off a vehicle or similar maybe?):

group sniper1 reveal target1

sniper1 doFire target1

Sniper1 and target1 are naturally whatever names you have given to the units. Not on a Flashpoint computer now so I can't check whether the reveal command required one to use a group like I did, but no harm in that (even lone units are "groups")

Share this post


Link to post
Share on other sites

hi,

I'm trying to make a assasination mission, where an AI sniper will wait for a spefic soldier to appear then take him out, and youve got to locate the sniper etc etc. I've got the basics of the mission down all i need is a script to get the AI to stay and wait for the target to appear and shoot him.

I've tryed the Destroy or seek and destroy waypoints but its not working, and I can't find a script for it. Is it possible? If so can someone help me?

Same as Sepe with reveal, doTarget and doFire.

Maybe make it in a loop in case the sniper forget about his target :)

Execute this script in a waypoint or a trigger or in another initlike script of your choice.

dofire.sqs

;***************************************
;Unit Fire Script by Nikiller v0.9b
;Make a unit fire on a target
;contact: nikillerofp@hotmail.fr
;[unitName,targetName] exec "dofire.sqs"
;example: [sniper1,guy1] exec "dofire.sqs"
;in this example sniper1 will fire on guy1
;***************************************

_u = _this select 0
_t = _this select 1

if (local _u) then {} else {goto "ende"}

_u setSkill 1
_d=0.5

#l
~_d
_u reveal _t
~_d
_u doTarget _t
~_d
_u doFire _t
if (alive _t) then {goto "l"}

#ende

exit

In ofp sometimes the shooter can turn in another direction for an unknown reason say me if it happens I have a fix for that.

cya.

Nikiller.

Edited by Nikiller
added links to wiki page

Share this post


Link to post
Share on other sites

The script works great, thanks. I tested the mission and the ai did exactly as he was supposed to each time. Only issue is he was to close to town, and got caught to fast. When I moved him futher out and ran the script, he just stares directly at the target but never fires. Is there a distance issue? Becuase when AI shoots at me, they can get a headshot twice as far away as this.

Edited by rebelsupertrooper

Share this post


Link to post
Share on other sites

hi,

The script works great, thanks. I tested the mission and the ai did exactly as he was supposed to each time. Only issue is he was to close to town, and got caught to fast. When I moved him futher out and ran the script, he just stares directly at the target but never fires. Is there a distance issue? Becuase when AI shoots at me, they can get a headshot twice as far away as this.

It is maybe related to the viewdistance, try to increase it. Type setViewDistance 1600 in a unit's initfield or in the init.sqs

I guess you allready thought about that but be sure the sniper have a clear shot on his target.

If it doesn't work upload the mission on multiupload or send me it by mail and I wil have a look at it. :)

cya.

Nikiller.

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  

×