my problem, is... when i put the action in my models, they dont do what they are supposed to do, and i cant use the flashlight at all. there are no errors at all with the code, but for some reason its not working. can anyone help?
code:
var max_dist = 10000; // use it for distances smaller than 10,000 quants
var energy = 100; // the energy for the batteries that come with the flashlight

var battery = 200; // the energy for the batteries that can be picked up
action battery_pickup
{
my.passable = on;
while (player == null) {wait (1);}
while (vec_dist (player.x, my.x) > 100) {wait (1);}
energy += battery;
ent_remove (me);
}
action flashlight_pickup
{
while (player == null) {wait (1);}
my.passable = on;
while (vec_dist (player.x, my.x) > 100) {wait (1);}
my.invisible = on;
my.lightred = 250;
my.lightgreen = 250;
my.lightblue = 170;
while (1)
{
while (energy > 0 && key_f == 1) // press the "F" key to use the flashlight
{
my.lightrange = 200;
temp.x = max_dist * cos(player.pan) * cos(camera.tilt) + player.x;
temp.y = max_dist * sin(player.pan) * cos(camera.tilt) + player.y;
temp.z = max_dist * sin(camera.tilt) + player.z;
trace_mode = ignore_models + use_box;
my.skill1 = trace (player.x, temp);
if (my.skill1 != 0)
{
temp.x = (my.skill1 - 30) * cos(player.pan) * cos(camera.tilt) + player.x;
temp.y = (my.skill1 - 30) * sin(player.pan) * cos(camera.tilt) + player.y;
temp.z = (my.skill1 - 30) * sin(camera.tilt) + player.z;
vec_set (my.pos, temp);
}
energy -= 0.5 * time;
wait (1);
}
my.lightrange = 0;
wait (1);
}
}