UGX-Mods

Call of Duty 5: World at War => Help Desk => Topic started by: nabaro on March 29, 2014, 03:57:02 pm

Title: How to check how many players are touching a certain object at a time?
Post by: nabaro on March 29, 2014, 03:57:02 pm
Title says it all.  :)
Title: Re: How to check how many players are touching a certain object at a time?
Post by: YaPh1l on March 29, 2014, 04:51:15 pm
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.
Title: Re: How to check how many players are touching a certain object at a time?
Post by: jjbradman on March 29, 2014, 04:51:46 pm
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