Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Moving lights (https://forums.graalonline.com/forums/showthread.php?t=18149)

Hiker 11-29-2001 01:09 PM

Moving lights
 
How do u make lights move?
I mean like the lights in the underground cave when u go pearl diving. they seem to have a glow that moves in and out.

Saga2001 11-29-2001 04:06 PM

Here is one...
 
kinda cheap:
NPC Code:

if (created) {
setimg light2.png;
dontblock;
}
if (playerenters) {
setcoloreffect 1,1,1,0.99;
drawaslight;
this.i=1;
this.goingup=1;
timeout=.05;
}
if (timeout) {
if (this.i<99&&this.goingup==1) this.i++;
if (this.i>1&&this.goingup==0) this.i--;
if (this.i==98) this.goingup=0;
if (this.i==1) this.goingup=1;
setcoloreffect 1,1,0,this.i%99/100;
setzoomeffect this.i%2;
timeout=.05;
}


Saga2001 11-29-2001 04:07 PM

a kind of cool one...
 
NPC Code:

if (created) {
this.rgoingup=1;
this.bgoingup=1;
this.ggoingup=1;
this.goingup=1;
this.red=178;
this.blue=158;
this.green=12;
this.i=2;
this.r=7;
this.c=0;
this.a=3.14/2;
this.ox=x;
this.oy=y;
}
while(this.r>2) {
this.x=this.ox+cos(this.a)*this.r;
this.y=this.oy+sin(this.a)*this.r;

if (this.red<200&&this.rgoingup==1) this.red+=.85;
if (this.red>1&&this.rgoingup==0) this.red-=.85;
if (this.red==199) {this.rgoingup=0;setplayerprop #c,rd;}
if (this.red==1) {this.rgoingup=1;setplayerprop #c,ru;}

if (this.blue<200&&this.bgoingup==1) this.blue+=.75;
if (this.blue>1&&this.bgoingup==0) this.blue-=.75;
if (this.blue==199) {this.bgoingup=0;setplayerprop #c,bd;}
if (this.blue==1) {this.bgoingup=1;setplayerprop #c,bu;}

if (this.green<200&&this.ggoingup==1) this.green+=.67;
if (this.green>1&&this.ggoingup==0) this.green-=.67;
if (this.green==199) {this.ggoingup=0;setplayerprop #c,gd;}
if (this.green==1) {this.ggoingup=1;setplayerprop #c,gu;}

if (this.i<99&&this.goingup==1) this.i+=1;
if (this.i>1&&this.goingup==0) this.i-=1;
if (this.i==99) this.goingup=0;
if (this.i==1) this.goingup=1;

this.a+=.314;
showimg 201,light2.png,this.x,this.y;
changeimgcolors 201,int(this.red)/100,int(this.green)/100,int(this.blue)/100,(this.i%99)/100;
changeimgzoom 201,.75;
this.c=this.c+.01;
sleep .05;
}


Saga2001 11-29-2001 04:08 PM

fun to play with...
 
NPC Code:

timereverywhere;
if (created) {
setarray lights,300;
for(this.i=0;this.i<301;this.i+=3;) {
lights[this.i] = random(0,64);
lights[this.i+1] = random(0,64);
}
}
while (zero==0) {
for(this.i=0;this.i<300;this.i+=3;) {
showimg this.i+200,light2.png,lights[this.i],lights[this.i+1];
changeimgcolors this.i+200,int(random(0,1.5)),int(random(0,1.5)),i nt(random(0,1.5)),random(.5,.99);
changeimgzoom this.i+200,random(.5,1.25);
this.random=random(0,2);
if (this.random>1) {
lights[this.i]+=random(0,.5);
lights[this.i+1]--;
}
if (this.random<=1) {
lights[this.i]-=random(0,.5);
lights[this.i+1]++;
}
if (lights[this.i+1]>=62) lights[this.i+1] = 2;
if (lights[this.i]>=62) lights[this.i] = 2;
if (lights[this.i+1]<=2) lights[this.i+1] = 62;
if (lights[this.i]<=2) lights[this.i] = 62;
}
this.i = 0;
sleep .05;
}


nyghtGT 11-29-2001 05:18 PM

those are really good


All times are GMT +2. The time now is 02:30 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.