I port the laser script found in User Contribution to lite-c, but I always got E1515 in particle routine.
Code:
function laser_top()
{
VECTOR temp; vec_zero(temp);
my.pan=you.pan;
set(my,PASSABLE);
var shooting=0;
VECTOR mytarget;
var rotation_radius = 1500;
while (1)
{
my.pan=90;
my.tilt=-30;
shooting=0;
my.skill1 += 20 * time_step;
temp.x = my.x - rotation_radius * cos(my.skill1);
temp.y = my.y - rotation_radius * sin(my.skill1);
//temp.z = my.z - rotation_radius * sin(my.skill1);
c_trace(my.x, temp, IGNORE_ME|IGNORE_PASSABLE);
if (result != 0) // the player has hit something
{
if (you != NULL)
{
if((you != NULL)&&(you.skill11==2))
{
while((you != NULL)&&(you.healthpoints>0))
{
mytarget.x=you.x;
mytarget.y=you.y;
mytarget.z=you.z;
vec_set (temp.x,mytarget.x);
vec_sub (temp.x, my.x);
vec_to_angle (my.pan, temp);
if(shooting<=0)
{
snd_play(laser_wav,50,NULL);
vec_for_vertex(temp,my,38);
ent_create(lsrbolt_mdl,temp,laser_bolt);
shooting=random(20);
}
else
{
shooting-=1;
}
wait(1);
}
wait(10);
my.tilt=0;
}
}
}
wait (1);
}
}


function laser_bolt()
{
my.skill20=0;
set(my,TRANSLUCENT);
set(my,BRIGHT);
my.alpha=40;
my.red = 255;
my.green = 0;
my.blue = 0;
my.lightrange = 100;
VECTOR my_vertex;
VECTOR my_vertex2;
var hit_target=0;
my.pan=you.pan;
my.tilt=0;
my.emask |= (ENABLE_ENTITY);
my.event=im_gone;
while ((hit_target==0)&&( my.skill20<100))
{
vec_for_vertex(my_vertex,my,5);
vec_for_vertex(my_vertex2,my,6);
c_trace(my_vertex, my_vertex2, IGNORE_ME|IGNORE_PASSABLE);
if (result == 0)
{
ent_animate(my, "fire", my.skill20, ANM_CYCLE);
my.skill20 +=.2 * time_step;
}
else
{
if (you != NULL)
{
//if ((you != NULL)&&(you.skill11==2))
if (you.skill11==2)
{
you.healthpoints-=75;
vec_scale(normal,10);
effect(sparks,100,my_vertex,normal);
}
}
hit_target=1;
}
//wait(1);
}
wait(10);
ent_remove(me);
}

function sparks(PARTICLE *p)
{
VECTOR temp;
temp.x = random(20) - 10;
temp.y = random(20) - 10;
temp.z = random(20) - 10;
vec_add(p.vel_x, temp);
p.alpha = 70 + random(30);
p.red=255;
p.blue=0;
p.green=0;
p.size = 2;
my.flags |= (BRIGHT|MOVE);
p.lifespan = 20;
my.event = fade_sparks;
}

function fade_sparks(PARTICLE *p)
{
p.alpha -= 20*time_step;
if (p.alpha<=0)
{
p.lifespan=0;
}
}



If I take out the "PRACTICLE *p" in sparks function, and remove all p. attribute, no error occur.

Code:
function sparks()
{
VECTOR temp;
temp.x = random(20) - 10;
temp.y = random(20) - 10;
temp.z = random(20) - 10;
//vec_add(p.vel_x, temp);
//p.alpha = 70 + random(30);
//p.red=255;
//p.blue=0;
//p.green=0;
//p.size = 2;
/*my.flare = on;
my.bright = on;
my.move = on;*/
my.flags |= (BRIGHT|MOVE);
//p.lifespan = 20;
my.event = fade_sparks;
}



Why?

Last edited by Frederick_Lim; 08/23/07 08:50.