Game Development Community

Get players position (multiplayer)

by Kiyaku · in Torque Game Engine Advanced · 09/04/2008 (1:24 pm) · 1 replies

Hi,
i'm trying to script a chat where i can send messages in a specific range. I know how to check for objects in a specific radius but i can't get the players position so i can place the "scanner" at his position.

I read it should work with %client.player.getPosition()" but that doesnt work. "%player.getPosition()" doesnt work either.

So how can i check for the clients position?

I use the Stronghold level as playground.

#1
09/04/2008 (2:22 pm)
Okay i got it to work with the help of Juason from IRC, thanks again mate.

function serverCmdTeamMessageSent(%client, %text)
{
   if(strlen(%text) >= $Pref::Server::MaxChatLen)
      %text = getSubStr(%text, 0, $Pref::Server::MaxChatLen);

   %count = ClientGroup.getCount();
   
   for(%i = 0; %i < %count; %i++)
   {
      %client2 = ClientGroup.getObject(%i);
            
      if(VectorDist(%client.player.getPosition(), %client2.player.getPosition()) < 100)
      {
         ...