Jump to content
Sign in to follow this  
Alviar

AI follow player, companion style

Recommended Posts

ive been searching for something like this but i havent find any topics

The thing is, i want to make an RPG styled mission, where i have 1 or two companion like NPC's, that isnt in my group, have them following me like companions Half life NPC style or something like that

It has actualy been archived in arma 2 singel player campaign, where you escort or rather a female suspected of being a chedaki informant follows you around and you have to take her to a helicopter for extraction

She can even jump in the same car as you witouth having to order her around

does anyone know how to archieve this?

ive tried, with domove get pos player and similiar commands like that, but that revolves in having a radio trigger on repeat, and press it several times, i just want to make a script or make that trigger repeat it self, or if anyone has any better idea

Share this post


Link to post
Share on other sites

Pop open the map you played where it happened and see how they did it.

A while (alive payer) loop might work for you instead of radio.

Share this post


Link to post
Share on other sites

If you're not into making SQF or SQS files you can do this with two triggers.

First trigger:

Is "Repeatable"

Condition: myVariableOne AND !myVariableTwo

On Activation: myCompanion doMove getpos player; myVariableOne = false; myVariableTwo = true;

Second trigger:

Is "Repeatable"

Condition: !myVariableOne AND myVariableTwo

On Activation: myCompanion doMove getpos player; myVariableOne = true; myVariableTwo = false;

You must put a timeout/countdown in these triggers (maybe 5 to 20 seconds, experiment and see) or they'll run too fast.

When you want the companion to start following simply activate this code:

myVariableOne = false; myVariableTwo = true;

It can go in the init field if you want the following to happen straight away.

I know this idea works as I've done something similar in a mission. However I could be forgetting to mention something, or I could have gotten some details wrong, as I'm not at my gaming PC at this point in time -- this is from memory.

Share this post


Link to post
Share on other sites
If you're not into making SQF or SQS files you can do this with two triggers...

Thanks! that worked perfectly man :)

Another thing i need help with, is some kind of condition check that will trigger the companion to mimic my posture, so if i kneel down, he kneels down, i stand up, he stands up, and if possible, some kind of condition when i enter a vehicle, he enters it too, aswell as exits it

anyone know any good ideas to accomplish this?

Share this post


Link to post
Share on other sites

Alternativly there is a "dofollow" script by hoz.

http://www.ofpec.com/ed_depot/index.php?action=details&id=541&game=ArmA

I havent looked at the script but with some minor modification it would work. This script allows the follower to jump in the same vehicle as the leader.

as for position, you could use the "unitpos" command but that only works if you have given the unit a "setunitpos" command. VBS has a getunitpos, but to my knowledge..I dont think ARMA2 does. Would be a nice feature however. Also I dont think there is a position for crouch...only kneel which is "Middle".

Thanks

Frosty

Share this post


Link to post
Share on other sites
anyone know any good ideas to accomplish this?

I think j_frost is correct. There is no way to get the game to tell you what posture you are in (as far as I know)... only what posture you are ordered to be in. And if you don't have any squadmates you can't be issuing any orders along these lines.

You could change the behaviour of the companions -- "careless" will make them stand up, "combat" will cause them to stay in cover and often go prone, etc. You could tie these to radio command triggers, or action menu, or other things.

It's not quite what you were after but it may be the best bodge available.

Share this post


Link to post
Share on other sites
I think j_frost is correct. There is no way to get the game to tell you what posture you are in (as far as I know)... only what posture you are ordered to be in. And if you don't have any squadmates you can't be issuing any orders along these lines.

You could change the behaviour of the companions -- "careless" will make them stand up, "combat" will cause them to stay in cover and often go prone, etc. You could tie these to radio command triggers, or action menu, or other things.

It's not quite what you were after but it may be the best bodge available.

Mando getPos, returns the unit position you are in. Checking the bounding box heights can also return whether you are laying down or standing quite easily.

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  

×