Jump to content
Sign in to follow this  
Kydoimos

AI Cancel Targets?

Recommended Posts

Hello all - wondering if anyone can help me with this? Basically, I have _unit DoTarget _Target; _unit DoFire _Target. Now what I want to do, is to stop the unit firing at the target I've assigned. It's a shooting range target. I've tried Dowatch ObjNull and disableai "Target" but none of these things appear to work. I would just set the ammunition to 0 but I need the unit to be able to target enemy units. :p I bet the answer's dead simple and I've missed something glaringly obvious.

Share this post


Link to post
Share on other sites

Well I was gonna sugest you use assigntarget insteed, but was just reading the wiki and someone has said:

"It appears doTarget objNull can not be used to stop a unit targeting a previously assigned target. Using doWatch objNull will achieve the desired result. (ArmA v1.12Beta) "

So i guess thats problem solved?

Share this post


Link to post
Share on other sites

I think you can only give them a new target but that won't take effect until the clip is empty.

Share this post


Link to post
Share on other sites

Tried doWatch objNull, but it didn't work. And I don't really want to assign a new target, either. Thanks for the suggestions though, chaps. I do appreciate it!

Share this post


Link to post
Share on other sites

I'm using a trigger to make ai aim at player when he enters using doTarget in the onAct box and setBehavior "safe" in the onDeact box seems to be working.

Share this post


Link to post
Share on other sites
I'm using a trigger to make ai aim at player when he enters using doTarget in the onAct box and setBehavior "safe" in the onDeact box seems to be working.

That's not quite the issue, the problem is after the DoFire command has been used they empty the full clip.

Setting behavior has no effect and they will keep firing until it runs out of ammo.

On the subject of shooting ranges how do you get them to shoot a target with a gun, mine just throw grenades at all targets.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

F2K Sel, I don't know! :p I'm using the commands with a machine gun mounted Strider. I think the FireatTarget might work for what you need.

Share this post


Link to post
Share on other sites

Well I don't know if it's convenient for what you're doing, but you could use fireAtTarget in the first place to 'fake' that it is firing at it.

[] spawn {
       _shooter dowatch _target; 
       sleep 1; 
       for "_i" from 0 to 10 do {
               _handle = _shooter fireAtTarget [_target]; 
               sleep 0.1;
       };
}; 

Tested that on a Strider. It makes it fire a full-auto burst at the target.

Share this post


Link to post
Share on other sites

I see I've used useweapon before but it's more trouble than it's worth, if there are several targets it ends up missing everything.

FireatTarget isn't that more like what your after as it only seems to work for vehicles. It will fire one shot and stop.

Beaten to it by Ranger.

Share this post


Link to post
Share on other sites

Interesting guys, thanks for that! I'll try it out. :)

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  

×