Jump to content
Sign in to follow this  
Major_Dandelion

Auto accept SecOp mission?

Recommended Posts

Hi,

I tried asking this in the SOM thread, but no answers. :(

So, does anyone know how to auto accept SecOp missions? So they wouldn't be voluntary, but mandatory.

Thanks! And sorry for the new thread, but I really am waiting for an answer! :confused:

Share this post


Link to post
Share on other sites

There is no easy official method of doing that (yet?), but if you're into scripting you might find the following information useful:

_mySOM getVariable "secOpScopes";

This will retrieve the list of currently active SecOps from the SOM in an Array. It returns the scopes, which are objects that contain all information / variables about a SecOp instance.

_mySecOpScope setVariable ["decision", _myDecision]

Once you have the SecOp scope you can set the decision to be accepted. Accepted values for decision are:

0 - accepted

1 - not accepted

2 - timeout

Share this post


Link to post
Share on other sites

Im trying to get this to work...

Do i insert this code into the init as it is? i tried that and it didnt work

_mySOM getVariable "secOpScopes";

_mySecOpScope setVariable ["0", _myDecision];

Or does it go somewhere else, or am i completely of track?

Edited by Katipo66

Share this post


Link to post
Share on other sites

Tried the following in init

s1 getVariable "secOpScopes";
_mySecOpScope setVariable ["decision", 0]

Also having trouble getting it to work.

Share this post


Link to post
Share on other sites

Putting this in the SOM init field might work.

Or if putting it in an init.sqf, replace "this spawn" with "mySom spawn" (mySom being the player's SOM).


Automatically accept all SecOps: 

Spoiler

 

 


if (isServer) then 
{
	autoSecOpsDecision = this spawn 
	{
		waitUntil {Sleep 0.25; !isNil {_this getVariable "secOpScopes"}};
		Private ["_scopes"];
		while {true} do 
		{
			sleep 0.25;
			_scopes = _this getVariable "secOpScopes";
			if (Count _scopes > 0) then 
			{
				{
					Private ["_code"];
					_x setVariable ["decision",0];
					if (Count (_this getVariable "activeTopics") > 0) then
					{
						_code = 
						{
							Private "_mainScope";
							_mainScope = _this select 0;
							_mainScope setVariable ["activeTopics",[],true];
							["secop",_mainScope] call BIS_SOM_updateCommsMenuFunc;
						};
						[[_this getVariable "leader"],[_this],_code] call BIS_SOM_sendCodeFunc;
					};
				} forEach _scopes;
			};
		};
	};
};

 

 

 

Try this to automatically accept certain SecOps, but not others:
The _secOps list are those that will be automatically accepted.  Remove from the list any that should require a player decision.

 

Automatically accept certain SecOps:

Spoiler

 



if (isServer) then
{
	autoSecOpsDecision = this spawn
	{
		waitUntil {Sleep 0.25; !isNil {_this getVariable "secOpScopes"}};
		Private ["_secOps","_scopes"];
		_secOps = 
		[
			"ambush",
			"attack_location",
			"defend_location",
			"destroy",
			"escort",
			"patrol",
			"reinforce",
			"rescue",
			"search",
			"trap"
		];
		while {true} do
		{
			sleep 0.25;
			_scopes = _this getVariable "secOpScopes";
			if (Count _scopes > 0) then
			{
				Private ["_name"];
				{
					_name = _x getVariable "name";
					while {isNil "_name"} do {sleep 0.01; _name = _x getVariable "name";};
					if (_name in _secOps) then
					{
						Private ["_code"];
						_x setVariable ["decision",0];
						if (Count (_this getVariable "activeTopics") > 0) then
						{
							[_name, _this] call BIS_SOM_unregisterTopicFunc;
						};
					};
				} forEach _scopes;
			};
		};
	};
};

 

 

Edited by opusfmspol
updated code
  • Like 1

Share this post


Link to post
Share on other sites

Thanks for help opusfmspol. 

But there's one issue.  It doesn't accept reinforce when squad gets killed and can't accept it manually anymore as it no longer shows up in the menu. 

 

Share this post


Link to post
Share on other sites

The code in the post above is updated.

It was hanging on a "while do", changed it to an "if then".

 

// --- edit

After more testing, finding it was clearing the option to accept those missions not auto-selected, the second code set was revised again; using BIS_SOM_unregisterTopicFunc removes only the selected topic instead of all.

Edited by opusfmspol
as stated
  • Like 1

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  

×