Okay. I think I know why it breaks when I place more then 1 of these. I use the same name for the color effect, so when there are 2 things, they cancel each other out or something. Can anybody think of a way for me to make it so i can add more then 1? Cuz i made a reall kool effect in my reactor room with these cogs, but I can only add one of them right now. Here is the cog, don't think too much, just think of a way i could make it so i could add more. Btw, most of the crap in the start up thing is stuff i added to make this cog user-friendly when i submit it to massassi.
Code:
# Jedi Knight Cog Script
#
# aotlensflair.cog
#
# Controls a semi-cool lens flair effect when an 3do is visible to the player.
#
# [SM Sith Lord]
#
# This cog is not made or distributed by LucasArts Entertainment Co.
flags=0x240
symbols
message startup
message pulse
message newplayer
thing flairobject=-1
flex brightness=1
int R=255
int G=255
int B=255
flex fadeout=0.5
flex dot=-1 local
flex olddot local
flex r_y local
flex r_m local
flex r_m2 local
flex g_y local
flex g_m local
flex g_m2 local
flex b_y local
flex b_m local
flex b_m2 local
int tintamt local
int ramt local
int gamt local
int bamt local
int lenseffecthandle local
int player local
end
# ========================================================================================
code
startup:
fadeout = fadeout/10;
R = R*brightness;
G = G*brightness;
B = B*brightness;
r_y = R/1.7;
r_m = r_y/0.85;
r_m2 = (R-r_y)/0.15;
g_y = G/1.7;
g_m = g_y/0.85;
g_m2 = (G-g_y)/0.15;
b_y = B/1.7;
b_m = b_y/0.85;
b_m2 = (B-b_y)/0.15;
SetPulse(0.01);
return;
pulse:
FreeColorEffect(lenseffecthandle);
olddot = dot;
dot = -1;
if( IsThingVisible(flairobject) && HasLOS(player,flairobject) ){
dot = ThingViewDot(player,flairobject);
}
else if( olddot-0.1 > 0 ){
dot = olddot-fadeout;
}
else if( olddot-0.1 <= 0 ){
dot = -1;
}
if( dot != -1 ){
if( dot <= 0.85 && dot > 0 ){
ramt = r_m*dot;
gamt = g_m*dot;
bamt = b_m*dot;
lenseffecthandle = NewColorEffect(0,0,0,0,0,0,ramt,gamt,bamt,1);
}
else if( dot > 0.85 ){
ramt = r_m2*(dot-0.85)+r_y;
gamt = g_m2*(dot-0.85)+g_y;
bamt = b_m2*(dot-0.85)+b_y;
lenseffecthandle = NewColorEffect(0,0,0,0,0,0,ramt,gamt,bamt,1);
}
}
return;
newplayer:
player = GetLocalPlayerThing();
return;
# ........................................................................................
end