Jump to content
Sign in to follow this  
Mabes

AI to use Binoculars

Recommended Posts

Okay, I tried and search for about an hour and I cannot get an AI unit to start out with his binoculars up, I have two units in a bunker and would like one of them to have his binoculars up "scanning" the area. Can someone please be nice enough to tell me how to do this?

Share this post


Link to post
Share on other sites

i tried it, that was the first thing that i did try, thanks though smile_o.gif

Share this post


Link to post
Share on other sites

He must be in safe mode.

Put this into the unit's Init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setBehaviour "safe"; this addWeapon "Binocular"; this selectWeapon "Binocular"

Hope that helped!

Share this post


Link to post
Share on other sites

I did that, and while he will switch to it for like a split-second then it switches back to his AK

Share this post


Link to post
Share on other sites

If you want to have it static and don´t mind that the unit is not useable anymore you could use animation from anim list at Biki and use it with switchmove. This way it will stay permanent most likely.

If you want the unit in the mission later on, just setpos a twin unit to the same position and delete the anim-unit.

Share this post


Link to post
Share on other sites

I tried the Binocular Anims a while back, but they just revert to normal once the anim has played, regardless of anim, switch or play move.

But this worked ok from an external point of view.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Officer01 SelectWeapon "Binocular";

Officer01 SwitchMove "AwopPercMstpSoptWbinDnon_pst";

Sleep 1;

Officer01 DisableAI "Anim";

Sleep 100;

Officer01 enableAI "Anim";

The unit (an officer already equiped with binoculars) held his binoculars for 100 seconds.

Although he did not actualy look through them, so no benefit was gained as far as detection is concerened.

I've yet to try other variations. But from my initial tests, the AI can only change his horizontal direction, he cant look up and down while using binoculars. So not much use on an ever changing battlefield sad_o.gif

Share this post


Link to post
Share on other sites

wouldnt the a.i officers in ofp use binoculars sometimes?

or was that just some scripted missions i remember that from? tounge2.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]wouldnt the a.i officers in ofp use binoculars sometimes?

or was that just some scripted missions i remember that from?

The AI will use binoculars every now and again, but it's a compromise. BI have to create thier AI to cope with the general situation. What Mabes wants is something specific.

It was possible in OFP, I created a Forward Observer addon that does exactly what he wanted and it worked quite well. But now Arma has changed the anims and behaviour, I will have to re-write it. The trouble is, there are loads more Binocular related anims and I have yet to figure out, if it's still possible with or without creating a specific addon.

The script I posted above only works for cutscenes. If someone can create a binocular addon that works like a weapon, then it could be done quite easily.

Share this post


Link to post
Share on other sites
He must be in safe mode.

Put this into the unit's Init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this setBehaviour "safe"; this addWeapon "Binocular"; this selectWeapon "Binocular"

Hope that helped!

So far this has been the best solution, but he doesnt keep the googles up!!!!

Anyone having a better idea??? I need that problem to be solved too!

Share this post


Link to post
Share on other sites

For visual purposes, could you take away all other weapons other than the binocs? Looks like he set his rifle down?

Also, when you say he doesn't keep them up... does he pick up the binocs and then put them below his face... then seconds later mov ethem up again?

Finally, in terms of using it as a Forward Observer... does the unit actually need to have the binocs up on his face to gain the advantage of seeing far distances? I mean the player obviously needs to... but an AI unit? You would think they get long distance viewing despite the animation simply because binocs are equiped. In that case, do as above and take all other weapons away.

Share this post


Link to post
Share on other sites
For visual purposes, could you take away all other weapons other than the binocs? Looks like he set his rifle down?

Also, when you say he doesn't keep them up... does he pick up the binocs and then put them below his face... then seconds later mov ethem up again?

Finally, in terms of using it as a Forward Observer... does the unit actually need to have the binocs up on his face to gain the advantage of seeing far distances? I mean the player obviously needs to... but an AI unit? You would think they get long distance viewing despite the animation simply because binocs are equiped. In that case, do as above and take all other weapons away.

let me try that..

no, with "removeAllWeapons this" and then giving him googles only he will do the same. He will take the googles, watch through them for a second, put them back, stand for 5 seconds, then take the googles again a.s.o!

Share this post


Link to post
Share on other sites

There is one way of doing it, but it's long winded.

First off, you have to identify which binocular animation you want to use, they all vary depending on the type of unit and it's starting stance. You can use this script to do that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier=_This Select 0;

_Soldier AddEventHandler ["AnimChanged",{Player SideChat (_This Select 1)}];

_Soldier SelectWeapon "Binocular";

The above script is run for an unarmed civilain, so you have to add this line to it's init field in the editor, to give him some binoculars.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">This AddWeapon "Binocular"

For the standing civilian, the animation in question is called:

Quote[/b] ]AWOPPERCMSTPSOPTWBINDNON_NON

Once you have the animation name, you can use this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier=_This Select 0;

_Soldier SelectWeapon "Binocular";

WaitUntil

{

(AnimationState _Soldier)=="AWOPPERCMSTPSOPTWBINDNON_NON";

};

Sleep 0.4;

_Soldier DisableAI "Anim";

This will now lock him into the binocular animation until you use enableAI

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier EnableAI "Anim";

You can use the switch and play move command to force a quick change, but they can conflict with the default head turning animations so the result are unpredicable. I found the above method gives the most consistent results. Also becuase of the head motion, the AI will not gain any advantage in long range spotting, so it's a cosmetic solution only.

I bet you thought getting the AI to look though binoculars should have been easy smile_o.gif

Edit: If you don't want to have to copy the animation name by hand, use this line of code in the event handler:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier AddEventHandler ["AnimChanged",{Player SideChat (_This Select 1); (_This Select 1) CreateVehicle [0,0,0]}];

Now open up your ARMA.rpt file. If you don't know where it is, read this thread:

http://www.flashpoint1985.com/cgi-bin....t=61190

You should then be able to open the rpt log file in note pad and just cut and paste the animation name.

Quote[/b] ]Finally, in terms of using it as a Forward Observer... does the unit actually need to have the binocs up on his face to gain the advantage of seeing far distances? I mean the player obviously needs to... but an AI unit? You would think they get long distance viewing despite the animation simply because binocs are equiped. In that case, do as above and take all other weapons away.

If it's like OFP. You have to be able to confirm the AI are actualy looking through the binoculars to be sure the are gaining an advantage from them. Holding them up to it's face was not enough. The switchCamera command, was the only way to confirm they are actualy using the binoculars properly.

In OFP this was the only optic that actualy increased the AI's view distance. Since Arma, sniper scopes (and perhaps others) will do the same thing, only in a slightly different way. You need more scripting to get the same results as Binoculars.

Despite many people moaning about super AI, they are rubbish at spotting units over long ranges compared to the player. Forcing the AI to use binoculars made a huge difference. Before that in OFP, a sniper would identify and open fire around 250m. When you group him with a special AI Forward Observer using binoculars it's upped to 900m+. From my inital tests, it looks like this kind of functionality not possible in Arma. I may be able to re-create it as an addon, but I'm not holding my breath sad_o.gif

Share this post


Link to post
Share on other sites

wow, thanks for the great effort! I realy appreciate that. Give me some time to test it!  smile_o.gif

Unfortunately I am realy a noob in scripting.

What I did was I created a soldier and gave him a waypoint to get to.

Then I put into the waypoint "this exec "google.sqs".

Into the google.sqs i put the following

Quote[/b] ]_Soldier=_This Select 0;

_Soldier SelectWeapon "Binocular";

WaitUntil

{

(AnimationState _Soldier)=="AWOPPERCMSTPSOPTWBINDNON_NON";

};

Sleep 0.4;

_Soldier DisableAI "Anim";

(I also could have chosen "AmovPercMstpSrasWrflDnon_AwopPercMstpSoptWbinDnon" as animation but that doesnt change anything.

What did I miss? Do I have to give the officer a name for the script to recognise him?

Share this post


Link to post
Share on other sites

I wish I could of posted a one liner smile_o.gif Perhaps CrashDome's suggestion will work? If not, it's certainly worth adding to the wishlist, it'll get my vote.

Share this post


Link to post
Share on other sites

@Albert Schweizer

If it's an officer your using, then I think the anim should be:

Quote[/b] ]AWOPPERCMSTPSOPTWBINDNON_PST

So you could try:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Soldier=_This Select 0;

_Soldier SelectWeapon "Binocular";

WaitUntil

{

(AnimationState _Soldier)=="AWOPPERCMSTPSOPTWBINDNON_NON";

};

Sleep 0.4;

_Soldier DisableAI "Anim";

But it looks like it's still a bit unpredictable.

Share this post


Link to post
Share on other sites
I wish I could of posted a one liner smile_o.gif Perhaps CrashDome's suggestion will work? If not, it's certainly worth adding to the wishlist, it'll get my vote.

Well your advise helped me to find a transitional solution. But googles alone arent the only problem, it is the same dilemma with most animations (except cargo, gunner, pilot and TV).

I wanted to do a film and focus onto the face and into the google where I would mirror the image of what he sees. I found a pretty ridiculous solution, it doesnt work all to well but for now it has to be sufficient.

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  

×