Jump to content
Sign in to follow this  
jimsolo

Keeping a MG manned...

Recommended Posts

Looked around but couldnt find a solution for this.

Im trying to keep a machine gun manned so that when the gunner dies another guy walks up and replaces him.

I been trying things like this but the AI wont respond at all:

_mg = _this select 0
_crew = _this select 1

#loop1
?!Alive _mg : loop2
goto "loop1"

#loop2
_crew assignasgunner _mg
_crew moveingunner _mg

#exit
exit

I also tried using groups and without still no luck.

Do I need the script to watch for the static weapon to die or the crewman?

If its the crewman does that mean I need to start him out seperate so I can name him and then have him mount the weapon?

thx in advance,

Jim

Edited by JimSolo

Share this post


Link to post
Share on other sites

Try this:

private ["_mg","_crew","_count","_unit"];

_mg = _this select 0;
_crew = _this select 1;

while { (alive gunner _mg) } do
{
      sleep 1;
};

_count = 0;

while { (_count < count crew) } do
{
      _unit = (_crew select _count);

      _count = _count + 1;

      If (alive _unit) exitWith
      {
             _unit assignasgunner _mg;
      };
};

Note: This is .sqf so call it with execVM

Share this post


Link to post
Share on other sites

eh how would I call this exactly? I get a error when I use this as a .SQF

I tried calling with:

_mg = mg1 execVM "nest1.sqf"
and the script runs but the "_mg = mg1" part makes no sense to me because I am use to
[mg1,mg2] exec "nest1.sqs"
format

Its dropping multiple errors with this one.

Can someone show me how to do this with a SQS or give further details as the wicki is waaay too vague on proper use of .sqf files.

thx

Edited by JimSolo

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  

×