Jump to content
Mebeover

Activating a trigger with any combination of multiple conditions

Recommended Posts

Hi, I'm relatively new to mapmaking and have been so far learning through trial and error (mostly error), but am currently rather stumped with a problem vastly outside my base of experience. I am trying to set a trigger to activate when players collect any 3 pieces of intel (of 6 available), regardless of the combination of intel collected.

 

Only 3 pieces need to be found, and currently I am referencing their collection via a seperate trigger with 'thisNull objectName', as the intel is deleted on pickup, and then trying to get another trigger to check 'triggerActivated triggerName' (horribly inefficient, I know).

 

Apologies if this doesn't make much sense, its 3am and mission making has fried my brain.

 

Any help would be greatly appreciated. 

Share this post


Link to post
Share on other sites

Here is an example of a solution, even if the trigger could have been omitted. The whole thing is not particularly variable in use, but it offers a good basis.

Just take a look at it:
https://ufile.io/3xkho8j3

Share this post


Link to post
Share on other sites

Tweaked this from a script @Larrow some time ago. Tweak it to suit your needs.

 

{
	_x addAction ["<t align='left' color='#F7D358'>READ CONTENTS</t>", {
			params[ "_target", "_caller", "_ID", "_args" ];
			
			//Set this examined intel as found, so the action on it is no longer active
			//Also PV to all clients so their action for this box is no longer active
			_target setVariable ["isFound", true, true];
			
			//Get the number of boxes found, default 0
			_currentFoundBoxes = _caller getVariable[ "boxesFound", 0 ];
			//Increase count by 1
			_currentFoundBoxes = _currentFoundBoxes + 1, execVM "scripts\yourscript.sqf";
			//Update callers variable
			_caller setVariable [ "boxesFound", _currentFoundBoxes ];			
			//Maybe do something when # of intel have been found
			if ( _currentFoundBoxes isEqualTo 3 ) then {
				["<t color='#ff0000' size = '1.5'>Intel found...STAND-BY.</t>",-1,-1,8,1,-1,789] spawn BIS_fnc_dynamicText;	
				sleep 10;				
				execVM "scripts\yourscript.sqf"; //CHANGE THIS TO WHEN ALL INTEL FOUND
			};
		},
		[],
		6,
		true,
		true,
		"",
		//_target (unit to which action is attached to) and _this (caller/executing unit)
		"!( _target getVariable [ 'isFound', false ] )", //NOT found ( default false ) !false == true
		4	//distance for action
	];
}forEach [ intel0, intel1, intel2 ];

When intel isEqualTo 3 it must match the amount of forEach. You can change it the amount to suit. That's all I have to offer.

 

Good luck.

Share this post


Link to post
Share on other sites
3 hours ago, Mebeover said:

 I am trying to set a trigger to activate when players collect any 3 pieces of intel (of 6 available), regardless of the combination of intel collected.

 

Welcome on forum.

If you named the 6 intel pieces, say Int1, Int2, Int3...
You just need a trigger none, none , not repeatable,

the condition is: {isNull _x} count [Int1,Int2,Int3,Int4,Int5,Int6] > 2


If  there is no name on them:
count (allMissionObjects "all" select {"intel" in toLowerANSI getText (configFile /"cfgVehicles" / typeOf _x / "vehicleClass")}) <4

 

  • Like 3

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

 

If you named the 6 intel pieces, say Int1, Int2, Int3...
You just need a trigger none, none , not repeatable,

the condition is: {isNull _x} count [Int1,Int2,Int3,Int4,Int5,Int6] > 2


 

 

 

 

As he said, use that.

.

 

 

 

Share this post


Link to post
Share on other sites
Posted (edited)
11 hours ago, pierremgi said:

 

Welcome on forum.

If you named the 6 intel pieces, say Int1, Int2, Int3...
You just need a trigger none, none , not repeatable,

the condition is: {isNull _x} count [Int1,Int2,Int3,Int4,Int5,Int6] > 2


If  there is no name on them:
count (allMissionObjects "all" select {"intel" in toLowerANSI getText (configFile /"cfgVehicles" / typeOf _x / "vehicleClass")}) <4

 

 

Thanks so much!

Edited by Mebeover
quoted wrong person

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

×