Can you convert it to the lite-c
action mgun_function()
{
mgun = my; // I'm weapon1
var player1_pos; // stores the initial position of the player
var player2_pos; // stores the position of the player after a frame
var weapon_offset;
var weapon_height;
var front_offset = 30;
set(my,PASSABLE); // the weapon model is passable
while (!player) {wait (1);} // wait until the player is created
while (vec_dist (player.x, my.x) > 100) { wait (1);} // wait until the player comes close to pick up the weapon
while (1)
{
weapon_1=1;
vec_set (player1_pos.x, player.x); // store the initial player position
// place the weapon 50 quants in front, 18 quants to the right and 20 quants below camera's origin
vec_set (weapon_offset.x, vector (front_offset, -10, -10));
if (vec_dist (player1_pos.x, player2_pos.x) != 0) // the player has moved during the last frame?
{
weapon_height += 30 * time_step; // then offset weapon_height (30 = weapon waving speed)
weapon_offset.z += 0.3 * sin(weapon_height); // (0.3 = weapon waving amplitude)
}
// rotate weapon_offset according to the camera angles
vec_rotate (weapon_offset.x, vector (camera.pan, camera.tilt, 0));
vec_add (weapon_offset.x, camera.x); // add the camera position to weapon_offset
vec_set (my.x, weapon_offset.x); // set weapon's coords to weapon_offset
my.pan = camera.pan; // use the same camera angles for the weapon
my.tilt = camera.tilt;
vec_set (player2_pos.x, player.x); // store the new player coordinates after 1 frame
wait (1);
}
}