Jump to content
Sign in to follow this  
Lucasmnunesk

Detector Trigger

Recommended Posts

Here's the idea of my trigger. When a player is with the Mine Detector, and within a distance of the object (in this case some weapon boxes) a sound should play. Here is how i've made it.

while {(alive player) and ({_x=="MineDetector"} count items player > 0) and (alive c1)} do {
   _dr = floor(player distance c1);
   if (_dr <= 100)then{player say3D "beep"};
   if (_dr < 5)then  {sleep 0.2};
   if (_dr < 10 and _dr >= 5)then {sleep 0.8}; 
   if (_dr < 20 and _dr >= 10 )then {sleep 2}; 
   if (_dr < 40 and _dr >= 20)then {sleep 3}; 
   if (_dr < 60 and _dr >= 40 )then {sleep 4}; 
   if (_dr < 80 and _dr >= 60)then {sleep 5};
   if (_dr < 100 and _dr >=80)then {sleep 6};
   };

But it seems that the sleep isn't working properly. The sound plays, but it plays at the same period independent of my distance, and if dr becomes > 100 it keeps playing, my guess is that the sleep is queuing the executions.How would i make it work? I just want it to play faster if the player is getting closer. My english isn't the best and i'm kinda of new to scripting, if you didn't understand something feel free to ask me and i'll try to explain again.

Thank you for your attention !

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  

×