Flying particle lights?

Hi i am sort of new to making levels and i was wondering if any one has a script or can help me write a script that will cause random particle lights to fly around my level. Thank you in advance :slight_smile:

drawoverplayer;
dontblock;
drawaslight;
setcoloreffect [i]red[/i],[i]green[/i],[i]blue[/i],[i]alpha[/i];
x=random(0,63);
y=random(0,63);
timeout=0.5;

Half-assed code, but it should work. Just give it an image and copy the NPC a few times.

thanks!

Forgot that you’ll need to put in the values for RGB and Alpha.

draw over and draw as lights O:?

I dont mess with light effects or anything so I may be wrong here, doesn’t lights draw over auto ? O:

Ya spoon I figured that out haha I decided to make an animated gif of particles and use the drawover o have some set lights moving around and I also used your code to have some just flying aroud randomly.

Didn’t get any sleep last night. My brain is poop. You guys are right though, drawaslight puts it above the drawoverplayer layer.

This belongs in the NPCs section, IMO.

i asked it here because i think its more of a level related question.

But it is NOT level related (tiles, designs, etc.), it IS script related.

Kind of threw this together. Copy/paste as many times as you’d like in your level. I’ve attached an additional image that you should save and use with it.

[code]//#CLIENTSIDE
if (created) {
this.maxspeed = .5;
Spawn();
timeout = 0.05;
}

function Spawn() {
hideimg 200;
hideimgs 300,300+this.tailcount;

if (this.dead == 1) {
for (this.i=0;this.i<10;this.i++) {
showimg 1000,shiny_special-light4.png,x - 2.5,y - 2.5;
changeimgcolors 1000,1,1,1,.99 - (this.i/10).99;
changeimgzoom 1000,(this.i/10)
(this.zoom*4);
changeimgvis 1000,3;
sleep 0.075;
}
hideimg 1000;
}

this.steps = 0;
this.dead = 0;
this.alpha = 0;

sleep random(0,3);

x = random(4,60);
y = random(4,60);
this.zoom = random(.1,.22);
this.angle = random(0,pi*2);
this.speed = random(.1,.3);
this.tailcount = int(random(4,10));
this.tailindex = 0;
}

function Move() {
if (this.dead == 0) {
x += cos(this.angle)*this.speed;
y -= sin(this.angle)*this.speed;

this.r = random(0,100);
if (this.r < 25) this.adir = int(random(-1,2));
this.angle = (this.angle + (this.adir*(pi/25)))%(pi*2);

if (this.alpha < .99) this.alpha += .11;
else this.alpha = .99;

} else if (this.dead == 1) {
if (this.alpha > .25) this.alpha -= .11;
else {
Spawn();
return;
}
}

showimg 200,light4.png,x - 4,y - 4;
changeimgcolors 200,1,1,1,this.alpha;
changeimgzoom 200,this.zoom;
changeimgvis 200,3;

if (this.tailindex == int(this.tailindex)) {
showimg 300 + this.tailindex,light4.png,x - 4,y - 4;

for (this.i=0;this.i<this.tailcount;this.i++) {
  this.img = 300 + ((this.i + this.tailindex)%this.tailcount);
  changeimgcolors this.img,1,1,1,(.11 + (this.i/this.tailcount)*.88)*this.alpha;
  changeimgzoom this.img,.05 + (this.i/this.tailcount)*(this.zoom/2);
  changeimgvis this.img,3;
}

}

this.tailindex = (this.tailindex + .5)%this.tailcount;

if (x < 1) x = 63;
else if (x > 63) x = 1;
if (y < 1) y = 63;
else if (y > 63) y = 1;

/*
if (x < 1 || x > 63 || y < 1 ||y > 63) {
Spawn();
return;
}
/
if (random(0,500) < this.steps
.025) this.dead = 1;
this.steps++;
}

if (timeout) {
Move();

timeout = 0.05;
}[/code]

I don’t see an attachment.

Dunno what happened to it, but attached now!

this doesnt work :\ at least it didnt for me…

bump

This is awesome. Good work.
Thanks for putting this up.