Blockland Forums > Modification Help
Need help scripting.
Treynolds416:
--- Quote from: Port on June 27, 2012, 05:56:25 PM ---there's still nothing preventing him from speaking correctly without obscure nicknames, slangs and expressions
--- End quote ---
L O L
It's obviously not obscure, you just have a specificity complex. Go take your needless foolishness elsewhere.
zefoo:
--- Quote from: HellsHero on June 27, 2012, 07:28:42 PM ---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.
--- End quote ---
Would this work to find the distance to?
--- Code: ---vectorDist(%player1.position,%player2.position);
--- End code ---
Also how would you get the name of the person your aiming at?
elm:
--- Quote from: zefoo on June 27, 2012, 07:39:19 PM ---Would this work to find the distance to?
--- Code: ---vectorDist(%player1.position,%player2.position);
--- End code ---
Also how would you get the name of the person your aiming at?
--- End quote ---
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;
Ipquarx:
--- Quote from: zefoo on June 27, 2012, 07:39:19 PM ---Also how would you get the name of the person your aiming at?
--- End quote ---
Raycasting.
elm:
--- Quote from: Ipquarx on June 27, 2012, 07:47:33 PM ---Raycasting.
--- End quote ---
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;
}