Author Topic: Need help scripting.  (Read 6367 times)

Code: [Select]
%count = clientGroup.getCount();

for ( %i = 0 ; %i < %count ; %i++ )
{
        %client = clientGroup.getObject( %i );
        echo( %client.getPlayerName() );
}
Thank you so much.

if(distance1 > 1)
What would 1 be?
Millimeters in game?
How close is 1?

Also how do you edit a players position?
« Last Edit: June 27, 2012, 07:06:51 PM by zefoo »

player.setTransform(%coords);
The coords could be 1 0 1, or whatever.

player.setTransform(%coords);
The coords could be 1 0 1, or whatever.
Thanks
Now what is 1 distance wise when i use this.
Code: [Select]
%distance = vectorLen(vectorSub(%player1pos,%player2pos));
if(distance1 > 1)
What would 1 be?
Millimeters in game?
How close is 1?

The distance between the two coordinates you are getting the distance of?

It's just a value. Test it out in-game to get a grasp of how big or small something is.

there's still nothing preventing him from speaking correctly without obscure nicknames, slangs and expressions
L O L

It's obviously not obscure, you just have a specificity complex. Go take your needless foolishness elsewhere.

The distance between the two coordinates you are getting the distance of?

It's just a value. Test it out in-game to get a grasp of how big or small something is.
Would this work to find the distance to?
Code: [Select]
vectorDist(%player1.position,%player2.position);
Also how would you get the name of the person your aiming at?
« Last Edit: June 27, 2012, 07:41:04 PM by zefoo »

Would this work to find the distance to?
Code: [Select]
vectorDist(%player1.position,%player2.position);
Also how would you get the name of the person your aiming at?

Yes, and the name of the person is stored as a variable in their client. So if you have their player object then it would look like so:

%playerName = %playerObject.client.name;

With their client object:

%playerName = %clientObject.name;

Also how would you get the name of the person your aiming at?
Raycasting.

Raycasting.

Oh, didn't read that aiming part, lol.


Edit:

To shoot a raycast, here is the code below:

//%player should be defined above


%eyeVector = %player.getEyeVector();
%eyePoint = %player.getEyePoint();
%range = 100;
%rangeScale = VectorScale(%eyeVector, %range);
%rangeEnd = VectorAdd(%eyePoint, %rangeScale);
%raycast = containerRayCast(%eyePoint,%rangeEnd,$TypeMasks::PlayerObjectType, %player);
%object = %raycast.getId();

if(isObject(%object) && %object.getClassname() $= "Player")
{
   //Execute code if player is looking at someone.
   %objectName = %object.client.name;
}
« Last Edit: June 27, 2012, 07:54:55 PM by elm »

Yes, and the name of the person is stored as a variable in their client. So if you have their player object then it would look like so:

%playerName = %playerObject.client.name;

With their client object:

%playerName = %clientObject.name;

So if im aiming at them and
Code: [Select]
%playerName = %playerObject.client.name; is "Ran" then who ever im aiming at will be stored in the variable %Playername?

So if im aiming at them and
Code: [Select]
%playerName = %playerObject.client.name; is "Ran" then who ever im aiming at will be stored in the variable %Playername?

No, read my above post.

So if im aiming at them and
Code: [Select]
%playerName = %playerObject.client.name; is "Ran" then who ever im aiming at will be stored in the variable %Playername?
You need to do a Raycast first. I can't remember the exact function, but inb4port.

You need to do a Raycast first. I can't remember the exact function, but inb4elmedittoolate.

So if I want to see if %targetName = nothing then would i do  this?
Code: [Select]
if(%targetname = "")?