Jump to content
Sign in to follow this  
revenicus

Getting an AI stinger soldier to be aware

Recommended Posts

As part of a scripted sequence, I'm having a stinger soldier shoot a helicopter out of the sky. The problem is I can't get him to keep his stinger equipped and just be ready and aware for aircraft.

I've even tried removing all weapons, but a stinger and ammo, and telling him to equip his stinger, which he does, but then he immediately puts it away.

He does automatically see the heli and get his stinger out, but by that time, its too late.

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit disableAI "Anim"; unit playMove "AmovPknlMstpSrasWlnrDnon"

Then when you're done and you want him to resume his normal behavour, use enableAI "Anim" on him.

Share this post


Link to post
Share on other sites

ok i got around to trying it. and he just freezes when I get into game. he doesn't switch to the stinger

Share this post


Link to post
Share on other sites

Do it in a script and have him select the appropriate weapon before you use Kyle´s code in the script.

Share this post


Link to post
Share on other sites

I'm not sure how to time it right, he only has it out for a split second before he puts it back.

and i tried putting an enemy in front of him, he had his weapon of choice out aimed at the enemy but wouldn't fire. hes totally unaware

Share this post


Link to post
Share on other sites

Then you didn't use disableAI "Anim" correctly. It should prevent the AI from automatically changing animations, but won't interfere with playMove/switchMove. Do this right and once the unit plays the launcher move he will stay in that animation unless something beyond his control forces him to change animations. Also be aware that playMove is ineffective when used in a unit's init field, it must be executed somewhere else (script, waypoint, trigger, anywhere but an init field).

Share this post


Link to post
Share on other sites

heres what i tried:

a stinger soldier starts out on a trigger. that delays a couple seconds then does this:

stingerguy disableAI "Anim"; stingerguy playMove "AmovPknlMstpSrasWlnrDnon"

in the ini of the soldier, i have

this selectweapon "stinger"

he pulls out the stinger, aims it. and stays like that.

i have 2 helis fly right in front of him, he doesn't move or do anything.

Share this post


Link to post
Share on other sites

Well, disableAI "Anim" prevents him from turning (since that requires a new animation to be played), so he won't be able to aim and therefore engage. You need to use enableAI "Anim" on him when he's spotted the aircraft and is ready to engage it. Also, you should use reveal to get him to react quicker to the enemy aircraft if he's having trouble spotting it.

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  

×