Jump to content
bolbies

Execute Script on Unit

Recommended Posts

I am trying to implement the modified Bardosy Automedic with ACE script in the Liberation mission. The problem is the way you buy/hire units. You use a menu that detects the type of units available by going through the config files, not just a simple spawning script. Because of this I don't have an init field for spawned units. Is there a way I can get the mission to autodetect if a player has a medic in the squad and then turn on the automedic script? Thanks!

Share this post


Link to post
Share on other sites

Hi

I don't know what is bardosy Automedic but here's a simple script that detects medics of certain type in player's group:

 

_group = group player;

{
if((typeof _x) in ["B_medic_F", "B_recon_medic_F"]) exitwith
{
 // _x is medic, rest of code here
};

} foreach (units _group);

 

it only works on vanilla medics of west side, edit the medic list for more support.

 

hope that helps

Share this post


Link to post
Share on other sites

here's a better way (now without the medic list, checking "attendant" variable instead):

 

 

_group = group player;
{
if( getnumber (configfile >> "CfgVehicles" >> (typeof _x)  >> "attendant") == 1 ) exitWith
{
  // _x is medic, rest of code here
};
} foreach (units _group);

 

I'm little unsure if "attendant" is in fact what determines medic but this code worked for me.

 

Share this post


Link to post
Share on other sites
11 minutes ago, gc8 said:

Hi

I don't know what is bardosy Automedic but here's a simple script that detects medics of certain type in player's group:

 


_group = group player;

{
if((typeof _x) in ["B_medic_F", "B_recon_medic_F"]) exitwith
{
 // _x is medic, rest of code here
};

} foreach (units _group);

 

it only works on vanilla medics of west side, edit the medic list for more support.

 

hope that helps

Another way would be to use: _x getUnitTrait "Medic"

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, mrcurry said:

Another way would be to use: _x getUnitTrait "Medic"

 

cool didn't know that. I see its a new command..

Share this post


Link to post
Share on other sites

Sorry for the late reply but thank you both! I used gc8's first method but with mrcurry's getUnitTrait suggestion. It works great!

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

×