Jump to content
Sign in to follow this  
usbstuck

Detect players entering and exiting area

Recommended Posts

setTriggerArea is the size of the radius for the trigger to "search", and if your using a marker as the center point in Feruz Abad replace the marker name below with the name of that marker

_trigger = createTrigger ["EmptyDetector", getMarkerPos "mrkName"];    //replace "mrkName" with the marker of your choosing
_trigger setTriggerArea [1000, 1000, 0, false];    //circle with a 1000m radius; tilted by 0°; "false" for being a circle and not a rectangle
_trigger setTriggerActivation ["WEST", "PRESENT", false];    //activated by "WEST" aka blufor units; activated only once (hence repeating is "false")
_trigger setTriggerStatements
[
   "this",    //using the keyword "this", the above statements will be considered for checking whether the trigger is (de)activated
   "
       0 = [] spawn
       {
           uiSleep 300;
           ['Blufor units have entered the area!', 'hint', EAST, false, true] call BIS_fnc_MP;
       };
   ",
   ""
];

Share this post


Link to post
Share on other sites

well thinking about it now i dont want a marker visible so perhaps I should use a trigger. Now what if I wanted to a marker aswell as the hint but say it will only last for 10 minutes?

Share this post


Link to post
Share on other sites

If you want a marker appearing when the hint appears, but want it to last only for 10 minutes, you forumlate your trigger statements like this:

_trigger setTriggerStatements
[
   "isServer && this",
   "
       0 = thisTrigger spawn
       {
           uiSleep 300;
           ['Blufor units have entered the area!', 'hint', EAST, false, true] call BIS_fnc_MP;

           _marker = createMarker ['marker_faruzAbad', getPos _this];
           _marker setMarkerShape 'ICON';
           _marker setMarkerType 'hd_warning';
           _marker setMarkerText 'Enemy forces here!';

           uiSleep 600;
           deleteMarker _marker;
       };
   ",
   ""
];

As you're obviously creating an MP mission, I corrected my previous and this code a bit as I forgot to mention that in this very scenario, the activation should happen server side only (using "isServer" in the condition) as the BIS_fnc_MP statement would otherwise be executed on each client which would result in multiple overlapping events which at some point could become messy. Also, you should create triggers only server side for certain game logic reasons.

Edited by Heeeere's Johnny!

Share this post


Link to post
Share on other sites

FYI Johnny we are (we being me and Dreaded) handling a lot of this in the PCSL (Scripters Lounge) and he is using an editor created trigger (already server-side), and here is the code that we finished off with last night (or at least the last version that I have) in the trigger's onAct:

0 = thisTrigger spawn 
{
   uiSleep 150; 
   [parseText "<t color='#ffffff' size='2' align='center' >Infidels have been spotted in Feruz Abad, YALA YALA go make waste of them!</t>","hintSilent",INDEPENDENT,false,false] call BIS_fnc_MP;
   ["cse_thor3_beep1","playSound",INDEPENDENT,false,false] call BIS_fnc_MP;
_blueHint = 0 spawn
{
	uiSleep 150;
	[parseText "<t color='#ffffff' size='2' align='center' >You have been spotted in Feruz Abad!</t>","hintSilent",WEST,false,false] call BIS_fnc_MP;
	["SomeSound","playSound",WEST,false,false] call BIS_fnc_MP;
};
   _feruz = createMarker ["feruz", getPos _this]; 
   _feruz setMarkerShape "ICON"; 
   _feruz setMarkerType "hd_warning";  
   _feruz setMarkerColor "ColorBlue"; 
   _feruz setMarkerText "Blufor Have been spotted here!";  
   uiSleep 300; 
   deleteMarker _feruz;
};

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  

×