Hi, i am creating a weapon shoot in the player action:
Code:
if (MY._weapon)
{
if (my._FIRING_WEAPON == TRUE)
{
vec_for_vertex (temp.x, MY._weapon, 1465);
temp.z -= 0.3;
you = ent_create ("ball0.055.mdl", temp.x, projectile_function);
}
my._FIRING_WEAPON = FALSE;
}
And then the projectile function:
Code:
function projectile_function()
{
proc_late();
my.pan = camera.pan;
my.tilt = camera.tilt;
var old_x;
var old_y;
var old_z;
MY.scale_x = 3;
MY.scale_y = 3;
MY.scale_z = 3;
my.enable_entity = ON;
my.enable_block = ON;
my._LIFE_SPAN = 300;
my._FORCE_Y = 0;
my._FORCE_X = 170 * time_step;
my._FORCE_Z = 0;
while (my._LIFE_SPAN != 0)
{
my._LIFE_SPAN -= 1;
c_move (my, my._FORCE_X, nullvector, ignore_passable);
my._FORCE_Z - = 0.5 * time_step;
if( my.x != old_x || my.y != old_y || my.z != old_z)
{
old_x = my.x;
old_y = my.y;
old_z = my.z;
if( my.x == 0)
{
SEND_SKILL( my.x, SEND_VEC + SEND_ALL);
SEND_SKILL( my.pan, SEND_VEC + SEND_ALL);
}
else
{
SEND_SKILL( my.x, SEND_VEC + SEND_ALL | SEND_UNRELIABLE);
SEND_SKILL( my.pan, SEND_VEC + SEND_ALL | SEND_UNRELIABLE);
}
}
wait (1);
}
sleep(.1);
ent_remove(my);
}
It works ok, except the camera direction, the bullet always assume the player1.pan (server) and not the direction of the client camera.
If i call ent_create ("ball0.055.mdl", temp.x, null); and then the project_function right after ent_create it just works.
what a hell is going on, why the camera pointer does not pass to the function called inside ent_create?
Thanks.