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

How to check how many players are touching a certain object at a time?

broken avatar :(
Created 10 years ago
by nabaro
0 Members and 1 Guest are viewing this topic.
1,351 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 22 January 2014
Last active: 3 years ago
Posts
143
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Member
My Contact & Social Links
More
×
nabaro's Groups
nabaro's Contact & Social Linkschelseafan122099nabarogamerblast11
Title says it all.  :)
Last Edit: March 29, 2014, 04:27:30 pm by nabaro
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 4 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Community Scripter Elite
My Groups
More
×
YaPh1l's Groups
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
You can use a trigger_multiple or an info_volume. Once you need to check, loop through all players, and for each test if he IsTouching(object), in which case you want to count him.

- Phil.
Marked as best answer by nabaro 10 years ago
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 4 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
i think you know how to include scripts if not just put this line after zombiemode in your map.gsc    
Code Snippet
Plaintext
thread maps\_players_touching::init();
and then make the file in maps folder with the name of
Code Snippet
Plaintext
 _players_touching
remember that it need the gsc extension
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;
init()
{
players_touching = get_players_touching( multiple );
wait 1;
iPrintLn(players_touching.size);
}

get_players_touching( ent )
{
players = get_players();

arrayed = [];
for(i=0;i<players.size;i++)
{
if(players[i] IsTouching(ent))
{
arrayed[arrayed.size] = players[i];
//iPrintLn(players[i].playername);
}
}
return arrayed;
}
this code just gets how many players are touching a trigger multiple and then print the number in game
also, in radiant make a trigger>multiple with the "targetname" "multiple" and sorround with the trigger the area that you want to know the number of players inside
Last Edit: March 29, 2014, 05:23:45 pm by jjbradman

 
Loading ...