Jump to content

Sign in to follow this  
scottb613

[SOLVED] Action Menu to Run a Script?

Recommended Posts

Hi Folks,

 

I'm trying to get the hang of editing (SP) scrolling Action Menu.

 

I tried placing this in the players init - to simply call a script (just removes defective AI from player group).

_actionText = "<t color='#FF0000'>Remove AI</t>"; 
_actionExpression = "execVM 'Scripts\SCOremove.sqf'"; 
player addAction [_actionText, _actionExpression, [], -1, true, true, ""]; 

The addAction shows up fine and will execute the script - however - I need to have AI units selected as input for the script. As soon as I select some units the addAction menu item vanishes. 

 

Thanks.

 

Regards,
Scott

Share this post


Link to post
Share on other sites

Hi Folks,

 

Resolved - I needed to move the add action to each squad member. The add action line needed is commented in the code:

 

//SCOunitDel.sqf
//Insert the following into [Init Field] of AI squad members to delete unit when it runs AMOK.

//this assignteam "RED"; this addAction ["<t color='#00FFFF'>Unit Del</t>","Scripts\SCOunitDel.sqf","ALL",1.5,true,true,"","true",3];

// Test to see if global group "deadPool" exists - if not - create it.
if (isNil "deadPool") then {
    deadPool = createGroup west; // Create the group if it doesn't exist
} else {
    // Group already exists, you can use it
};

// Get the selected unit into array
_unitArr = [_this];

// Get the selected unit
_unit = _this select 0;

// Add the units to the new group
[_unitArr] join deadPool;
	
// Max out the unit's damage to disable it
_unit setDamage 1;

// Display contents of _unit
hint format ["Kill %1", _unit];

 

Regards,
Scott

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  

×