Here is the function i have. Basically this function animates a gun when the left mouse button is clicked. Btw this code is in a different .wdl file.
var gun_percent = 0;
function run_weapons()
{
wait(1);
while(player!=NULL)
{
while(mouse_left)
{
while(int(gun_percent)<98)
{
ent_animate(gun0,"shoot",gun_percent,ANM_CYCLE);
gun_percent=(gun_percent+10*time)%100;
wait(1);
}
gun_percent=0;
wait(1);
}
wait(1);
}
}
Now i want to use this function for my player, so in the p1biped action on the first line of it i add, run_weapon();
But then when i run the game, i click and the animation doesnt happen, nor does a sound i have added which is supposed to play(its not in the code up there). What wrong? Any suggestions?
Thanks!