Jump to content
Sign in to follow this  
Lq.Snake

Capturing an AI

Recommended Posts

Is there a way to set an AI to be capturable by simply using a command?

What I've done so far is create a .sqf file that looks like this:

capture.sqf

//Simple capture script

[officer1] join group1;

player1 removeAction 0;

f2 removeAction 0;

f3 removeAction 0;

f4 removeAction 0;

f5 removeAction 0;

Of course, there is a trigger in the mission with a blufor present condition where the ON ACT field reads: player1 addAction ["Capture officer", "capture.sqf"];

But what I want is, only trigger the addAction command when near the officer(AI). I've tried using the nearestobjects command in another .sqf file:

if (count (nearestObjects [officer1, ["USMC_Soldier"], 1]) > 0) then

{

capture = player1 addAction ["Capture officer","capture.sqf"];

};

But for some reasons, it does not work. I also tried changing "USMC_Soldier" to "man" and it triggered the addAction command but it did it wherever I was in the map not just when I'm near the officer. Can someone help me out?

Share this post


Link to post
Share on other sites

Why not using:

//--- player1's near officer1 (10 meters radius).
(player1 distance officer1) < 10

Share this post


Link to post
Share on other sites

that's a good question... why am I over complicating things? HAHA

Thanks, Benny. That's so much more simpler. I can put that command in just one trigger and it works perfectly. But now, I'm having trouble removing the action if the player1 is a distance greater than 2. This is what I've tried:

First, I set a trigger to add the action as stated above:

Condition: (player1 distance officer1) < 2;

On Act. : capture = player1 addAction ["Capture Officer","capture.sqf"];

Then, I set a trigger to remove the action if greater than 2 meters:

Condition: (player1 distance officer1) > 2;

On Act. : player1 removeAction capture;

Nothing happens... it adds the action but does not remove!

Edit: Nevermind... I set the activation to ONCE instead of REPEATEDLY. Now, works perfectly! Thanks, again for the quick response! I hope this thread will help someone in the future.

Edited by Lq.Snake

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  

×