So I know that you can get the direction of a bot with
%obj.hActivateDirection = %dir;
How do I go about getting the direction the player is facing when throwing an item? I am trying to make a serverCommand that throws a number of items in the direction the player is facing, but with a slightly random velocity of the initial direction.
Here is my code
function serverCmdTossGITEM(%client, %input)
{
%velocity = %client.player.getVelocity();
%position = %client.player.getTransform();
%item = GTHISItem;
if(isObject(%client.player) && %input >= 1)
{
%item = new Item()
{
datablock = %item;
position = %position;
};
%item.schedulePop();
%itemVel = %item.setVelocity(vectorAdd(%velocity, getRandom(8,-8) SPC getRandom(-8,8) SPC 8));
%item.spawnBrick = %position + %item.Vel;
//%item.BL_ID = %client.BL_ID;
}
}
//Any help is greatly appreciated!
Currently, it only throws one item at a time regardless of %input and in random directions of wherever I am standing.