Jump to content
Blitzen88

How to use unit classname in addaction title

Recommended Posts

How can I pull and use a unit's classname in the title of an addaction?  For instance:

 

{

_Object addaction ["How do I add the classname here", {[_this select 0] execVM "Scripts\Blah.sqf"}];

} foreach units group1;

 

Share this post


Link to post
Share on other sites

Just get unit class name and use it in the title:

_Object addAction [format ["How do I add the %1 here", typeOf _x], "Scripts\Blah.sqf"];

 

Share this post


Link to post
Share on other sites

How would you do it if you were pulling from an array? For instance:

 

_array = [

	Vehicle1
	Vehicle2
	Vehicle3

];


{

_Object addaction ["How do I add the name here", {[_this select 0] execVM "Scripts\Blah.sqf"}];

} foreach _array;

 

Share this post


Link to post
Share on other sites
17 minutes ago, Blitzen88 said:

How would you do it if you were pulling from an array?

Looks like you haven't tried my code. Try it -- replace forEach's body.

Pay attention to the second arg for addAction -- just passing the path to the script is enough.

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

×