Jump to content
mostly

Activate Script when enemy units less than 20

Recommended Posts

Hi,

 

I'm pretty sure this must have been done before but I can't find it anywhere. I want to activate a script from a scripted trigger when the enemy numbers drop below 20. So far I've got:

 

Quote

_Spawn = createTrigger ["EmptyDetector", getPos HVT];
_Spawn setTriggerArea [500, 500, 0, false];
_Spawn setTriggerActivation ["WEST", "PRESENT", true];
_Spawn setTriggerStatements [ "{ alive _x && side _x == EAST } count thislist <20", "nul = [] execVM 'Spawn\Spawn2.sqf'",""];

 

 

The script is activated regardless of the number of enemies in the area. Could someone tell me what I'm doing wrong please?

 

Thanks.

 

  • Haha 1

Share this post


Link to post
Share on other sites

The trigger activation is "WEST" so that's probably one problem. also make sure HVT is in right position

 

could it be that the trigger condition is ran at mission start where there is no enemies at that point?

 

 

Share this post


Link to post
Share on other sites

Thanks for taking a look gc8 and making some suggestions.

The trigger activation is set to "WEST" so that it only initiates when the player is present in the area. HVT is in the right position. 

Regarding when the trigger condition runs, there are more than 20 east units placed on the map, so I'm confident it's not that.

 

Do I need to define this anywhere else: "{ alive _x && side _x == EAST } count thislist <20".

I thought that _x == EAST would be sufficient. Any ideas?

 

 

Share this post


Link to post
Share on other sites

Got it working. Think it was just a stupid error of missing ";". This works for anyone finding a similar problem..

_Spawn = createTrigger ["EmptyDetector", getPos HVT];
_Spawn setTriggerArea [500, 500,0, false];
_Spawn setTriggerActivation ["ANY", "PRESENT", false];
_Spawn setTriggerStatements [ "{ alive _x && side _x == EAST } count thislist < 5;", "nul = [] execVM 'Spawn\Spawn2.sqf';",""];

 

  • Like 2

Share this post


Link to post
Share on other sites
16 minutes ago, mostly said:

Got it working. Think it was just a stupid error of missing ";".

 

you shouldn't really need ; in the "last line"

 

but anyway glad you got it working

  • Like 1

Share this post


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

Got it working. Think it was just a stupid error of missing ";".

 

It works because you changed "WEST" to "ANYBODY". Your condition statement never evaluated true, since thisList only contained WEST units.

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites
On 12/7/2021 at 1:40 AM, mostly said:

Got it working. Think it was just a stupid error of missing ";". This works for anyone finding a similar problem..


_Spawn = createTrigger ["EmptyDetector", getPos HVT];
_Spawn setTriggerArea [500, 500,0, false];
_Spawn setTriggerActivation ["ANY", "PRESENT", false];
_Spawn setTriggerStatements [ "{ alive _x && side _x == EAST } count thislist < 5;", "nul = [] execVM 'Spawn\Spawn2.sqf';",""];

 

 

 

I have a problem that's similar to yours... The sqf is passed an array with all sorts of group data information from markers and automated names.
However, my issue is kind of lame, but simple:
One unit enters the trigger and it works, but the trigger is stuck on and I can't do much to pass it variables to carry on.
I thought about running a sqf on deact. but I can't pass it anything so that doesn't help. 

I want it to go off every time a unit enters, either by boolean presence which can be controlled by arrays, or with 

the time. Using get and set variables. 
I could probably get by running a sqf through deact, and having that set/get variables 
That's what I want to do actually. 
What should I put in the CONDITION STATEMENT other than "this"? 
 

 

Spoiler

params [ "_beefyArray"] ; 


 _arrayOfGoodsT = _beefyArray select 0 ;
 _groupLogicZT =  _beefyArray select 1 ;
 _usedMarksT =    _beefyArray select 2 ;
 _arrayGoToT =    _beefyArray select 3 ;
 _arrayDoneT =    _beefyArray select 4 ;
 _unitsDroppedT = _beefyArray select 5 ;
 _arrayGroupsT =  _beefyArray select 6 ;
 _desertT = 	  _beefyArray select 7 ;

_headsupT = 	 ( _arrayOfGoodsT select 0 )  ;
_droppingAltZT = ( _arrayOfGoodsT select 1 ) ; 
_groupsManyT =   ( _arrayOfGoodsT select 2 ) ;
_groupTypeT =    ( _arrayOfGoodsT select 3 ) ;
_groupFashionT = ( _arrayOfGoodsT select 4 ) ;




_countOfTrigs = count _desertT ;
_countOfTrigsZ = _countOfTrigs - 1 ;
hint (str _arrayGoToT) ; 
sleep 5 ;

_hool = [] ;
for [{ _h = 0 }, { _h < _countOfTrigsZ }, { _h = _h + 1 }] do
{
	_markInfo = [] ; 
	_markerNam = ( _arrayGoToT select _h  ) ;
	_markZ = _markerNam ; 
	_markSize = markerSize _markZ  ;
	_markSizeX = ( _markSize select 0 )  ;
	_markSizeY = (_markSize select 1 ) ; 
	_markSha = markerShape _markZ ; 
	_markPos = markerPos _markZ ;
	_markDir = markerDir _markZ ; 
	
	_markInfo pushBack [ _markerNam , _markZ , _markSize , _markSizeX , _markSizeY , _markSha , _markPos , _markDir ] ;

	_trigN = 'trigger.' + _markerNam ;
	_trigNZ = _trig ;
	_trigNZ = createTrigger ['EmptyDetector', _markPos] ;

	_fact = false ;
	if( _markSha == 'RECTANGLE') then
	{ 
		_fact = true ;
	}; 

	_trigNZ setTriggerArea [_markSizeX , _markSizeY , _markDir , _fact, -1] ;
	_trigNZ setTriggerActivation ['ANY', 'PRESENT', true] ;
	_trigNZ setTriggerTimeout [12, 12, 12, false];
	_trigNZ setTriggerInterval 1 ;
	_wordz = ( _arrayGoToT select _h) ;
	_wordzc = count _wordz ;
	_wordzc =_wordzc  - 2 ;
	_areaNumb =  ( _wordz  select [ 10 , _wordzc ]) ; 

	hint (str _areaNumb) ;
 	sleep 1 ;
	hint ("trig state");
	sleep 1;
	
	_trigNZ setTriggerStatements 
	["this",
	 "	
		hint (str _desertT) ;
		_fool = [] ; 
		_gool = [] ;
		{
			_plex =  _x ;
			_enteredFool = groupId (group _plex ) ; 
			_enteredFool = ( _enteredFool select [0] ) ;
			

			_catSize = count ( _enteredFool  ) ;
			_popWord = '' ;
			_bing1 = 1 ;
			_bong1 = 0 ;
			_markGx = 0 ;
			_markGy = 0 ;
			for [{ _i = 0 }, { _i < _catSize  }, { _i = _i + 1 }] do
			{
				
				private _chaCat = ( _enteredFool select  [_i,1]  ) ;
				private _chaCatZ = '.' ;
				private _chaCatTZ = '_' ;
				
				if ( _chaCat == _chaCatTZ  ) then
				{

					
					
					if( _bing1 == 1 && _bong1 == 0 ) then
					{
						_markGx = _i   ;
						_bong1 = 1 ;
						
					};

					if( _bing1 == 2 ) then
					{
						
						_catSa = _i ;
						_catSa = _catSa  - ( _markGx ) ;
						
						_markGy =  _catSa - 1  ;
						_markGx   = _markGx + 1  ;
						_catW = ( _enteredFool select [ _markGx  , _markGy  ] );

						_popWord = _catW ;
						_gool pushBack _popWord ;
						_bing1 = 1 ;
						_bong1 = 2 ;
						_markGx = 0 ;
						_markGy = 0 ;
					
					};

					
					_bing1 = _bing1 + 1 ;
					
					if(_bong1 == 2) then 
					{
						_bong1 = 0 ;
						_bing1 = 1 ;
					};
					
					

				};

				if ( _chaCat == _chaCatZ  ) then 
				{
					_wordA = 'LX' ;
					_worS = _i - (2) ;
					
					private _chaC = ( _enteredFool select  [_worS ,2]  ) ;
					
					if( _chaC == _wordA) then 
					{

						_lasty = _catSize ;
						_lasty = _lasty - ( _i ) ;
						_lasty = _lasty  ;
						_fasty = _i + 1 ;
						_sauce = ( _enteredFool select [ _fasty  , _lasty ] ) ;
						_popWord = _sauce ;
						_gool pushBack _popWord ;
						

					};


				};

			};
			
		} forEach thisList ;
		
		hint (str _gool) ;
		
		 
	 ",
	""
	] ;
	
	sleep 5 ; 
}; 

A units enters with a callsign "pactZ_4_groupZ_83_zol_188_LX.1123'" and the string is parsed... his pact is the people he vectors with, his group a predetermined size and forms up the pact, zol is just his unit count, and LX is the landing zone he came from.
His pact takes him to his vector(marker + tag) from any landing zone. 

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

×