Jump to content
Sign in to follow this  
pognivet

A trigger that is activated only by a specific unit seeing a side

Recommended Posts

I want to make a mission where there are civilian spies, but wherein not all civilians are spies. For instance: I would like there to be civilians walking around in Vietnam and many of them are loyal to the south, but there's one or two undercover NLF/Vietcong wearing civilian clothes collecting intel. I want it so that when these specific civilians see any BLUFOR it activates a trigger to perform another action such as the civilian sharing intel with armed squads or mortar batteries. I have never figured out a way to do this. Can someone please help me?

Share this post


Link to post
Share on other sites

Something like this could do:

//init.sqf
GOM_fnc_unitKnowsAboutSide = {
	params ["_unit","_side",["_range",viewDistance]];
	count (_unit nearTargets _range select {_x#2 isEqualTo _side}) > 0;
};

//simple loop to test:
_loop = [civ,west] spawn {
	waitUntil {
		hintSilent format ["Waiting for %1 targets...",_this#1];
		_this call GOM_fnc_unitKnowsAboutSide
	};
	hintSilent format ["%1 target found!",_this#1];
};

//to check from trigger:
[yourCiv,west] call GOM_fnc_unitKnowsAboutSide

The check is extremely fast, probably better to ditch the function (adds quite some overhead) and just use the count nearTargets line to match your needs.

 

Cheers

  • Like 1
  • Thanks 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  

×