Jump to content
Sign in to follow this  
Sqeemin

How do you get any civilian unit to follow you when you get close to them

Recommended Posts

I'm trying to get any civilian from 25 meters away to start to follow me but I can't get it to work, here's the code:

_civs = nearestObjects [player, ["Men"], 25];

hint format ["%1", _civs];

if(side _civs == civilian) then
{
_civs doFollow player;
};

Can anyone help me?

Share this post


Link to post
Share on other sites

You could give your player a join and lead waypoint and give your civvie a join waypoint, sync both those waypoints together and once you reach him or he reaches your point he will now be part of your group good luck its all i can think of just now.

Share this post


Link to post
Share on other sites

That isn't exactly what I want, I want for every civilian unit inserted into the map to be affected and I don't want them running at you right when the mission starts

Edited by Sqeemin

Share this post


Link to post
Share on other sites
while {true} do
{
  _civs = player nearEntities ["Man",25];//faster than near objects and I believe it's 'Man' not 'Men' as you had it

  {
     if((side _x isEqualTo CIVILIAN) && !(_x getVariable ["isFollowingPlayer",false])) then
     {
        _x doFollow player;
        _x setVariable ["isFollowingPlayer",true,true];
     };
  } forEach _civs;

  sleep 10;
};

Edited by JShock

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  

×