UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Check if player still in trigger radius

broken avatar :(
Created 7 years ago
by battleduck
0 Members and 1 Guest are viewing this topic.
1,355 views
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 February 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
battleduck's Groups
battleduck's Contact & Social Links
Code Snippet
Plaintext
function switch_2()
{
radius_trig = GetEnt("radius_trig2", "targetname");
        switch_trig = GetEnt("switch_trig2", "targetname");
switch_trig SetHintString("Press and hold &&1 to connect Auxillary Power.");
switch_trig SetCursorHint("HINT_NOICON");
timer = 10;

radius_trig waittill("trigger", player);
switch_trig waittill("trigger", player);
if (timer > 0)
{
wait .5;
switch_trig setHintString("Connection in progress...");
wait timer;
}

switch_trig setHintString("Connection Re-established!");

level.switchesCompleted++;

        DO OTHER STUFF....
}


I have the above code... how would I check that the player is still within the trigger radius whilst the 10sec timer runs down.

I want the player to have to stay within the radius for the duration of the timer, and if they leave the radius, then the timer resets to 10.

Any help appreciated. Cheers
Last Edit: November 11, 2016, 03:02:16 pm by MZslayer11
broken avatar :(
×
broken avatar :(
OnionmanVere Bo21
Location: ieu dnt wnt 2 no
Date Registered: 27 September 2013
Last active: 1 year ago
Posts
1,864
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Mapper
My Groups
More
Personal Quote
ok
Signature
Aye mate you don't know me so y don't you shut tf up ok buddy :)

×
Scobalula's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Box Mappers Elite
Box Mappers Elite
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Scobalula's Contact & Social Links
You could use the isTouching function:

Code Snippet
Plaintext
  void <entity> IsTouching(<other entity>)

     [MANDATORY] <other entity> Entity.
  CATEGORY:
  CLIENT/SERVER: Server
  SUMMARY: Returns true if <other entity> is touching <entity>
  EXAMPLE: if( player IsTouching( e_goal_volume ) ) { //do something }
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 11 February 2014
Last active: 7 years ago
Posts
5
Respect
Forum Rank
Legless Crawler
Primary Group
Member
×
battleduck's Groups
battleduck's Contact & Social Links
Thanks for the suggestion, I'll give it a try later on today. Cheers

 
Loading ...