I think I know where your problem lies. For throwing another rock, it overwrites the previous rock's variables, right?
The ppl who developed c_script were smart enough for that though. Each entity has it's own 100 variables, called skills. you access them by using "entity.skill1" - "entity.skill100".
so, instead of h, you could write my.skill2, for example.
Just so you can keep track of what the skill does, what variable it represents, you could do this:
define h, skill2;
and delete your var h; statement that you probably have somewhere in your code right now.
now, you can use "myh" instead of just h, and thus each entity has it's own set of variables, that don't interfere with the other's variables.
Now you'll run into another problem. "my" gets overwritten every time you throw a new rock, by the statement "my = ent_create(...);".
so... what I'd do is, let every entity run it's own action. basically, put everything the entity is supposed to do into it's own action, that get's executed automatically if in this line " my=ent_create("kepa.mdl",zac,NULL);" you replace null by the function name.
inside this function (or, in this case, i used an action, which for our purpose is the same deal), "my" is always referring to the entity that runs the action, unless you redefine it (using my = ...;)...
Code:
var k;
define h,skill1;
define i,skill2;
action the_rock
{
my.pan=camera.pan;
my.tilt=camera.tilt;
k += 1; //programmers are slack. k+=...; is the same as writing k=k+...;
my.h=zac_h;
my.i=1;
while (1)
{
dist.x=my.h*time;
if (my.h>0)
{
my.h -= 0.15;
}
my.i += 0.12;
dist.z=my.i*time*-1;
move_mode=ignore_passable;
camera.tilt = clamp(camera.tilt,-10,10);
camera.pan=clamp(camera.pan,-10,10);
vec_set(camera.x,vector(my.x + fcos(camera.pan,temp),my.y +
fsin(camera.pan,temp),my.z + 8 + fsin(camera.tilt,-camera_distance)));
ent_move(dist,nullvector);
wait(1);
}
}
function naredi_entity()
{
vec_for_vertex(zac,snezak,589);
ent_create("kepa.mdl",zac,the_rock); //the function "the_rock" must be somewhere before this line,
//otherwise it won't find it when it get's to this line, and give you an error message.
}
try this. not tested, hope it works....
if you've got any questions as to why i wrote something the way i did, please ask!
Micha