Jump to content
Sign in to follow this  
MacTheGoon

Attaching a trigger to every instance of an object

Recommended Posts

Hello,


I am currently tweaking a Liberation mission to suit our communities needs, I am nearly complete but I am stuck on one small detail.  I am trying to have a trigger attached to the huron medical containers that are build-able in liberation, and I would like that trigger to execute ACE's heal function for each player within that trigger.


I have the trigger setup in a normal mission and it works flawlessly, however that is placed in editor when the  aid station is in a fixed location.  With liberation, the medical facility could be built anywhere.  Any advice is appreciated!  Thank you.

Share this post


Link to post
Share on other sites

This will check for huron medical containers every  second  and you can add your stuff from there:

//initServer.sqf
_handleMedicalContainers = [] spawn {
	TAG_flag_medicalContainersActive = true;
	while {TAG_flag_medicalContainersActive} do {
		_containers = [];
		waitUntil {
			sleep 1;
			_containers = vehicles select {typeOf _x isEqualTo "B_Slingload_01_Medevac_F" AND alive _x};
			!(_containers isEqualTo [])
		};
		{
			//your ACE stuff here
		} forEach _containers;
	}
};

Depends on if this  needs to be a one time thing per container you'd need to lock them out, via setVariable/getVariable, like this:

//initServer.sqf
_handleMedicalContainers = [] spawn {
	TAG_flag_medicalContainersActive = true;
	while {TAG_flag_medicalContainersActive} do {
		_containers = [];
		waitUntil {
			sleep 1;
			_containers = vehicles select {typeOf _x isEqualTo "B_Slingload_01_Medevac_F" AND alive _x AND !(_x getVariable ["TAG_fnc_containerLockout",false])};
			!(_containers isEqualTo [])
		};
		{
			_x setVariable ["TAG_fnc_containerLockout",true];
			//your ACE stuff here
		} forEach _containers;
	}
};

Cheers

  • 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  

×