Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → maybe for use in skyboxes?
maybe for use in skyboxes?
2002-02-04, 11:56 AM #1
Has anyone explored the possiblity of having "the sun" shine in the players eyes? by this I mean modifying the force blind somehow so as the player turns toward (or the view camera for the player looks at) a ghost thing it blinds him. This may be a nice touch with the way some people make such nice skyboxes but I wouldn't know how to manipulate the cog like that.
"Mmmmm, forbidden doughnut."

2002-02-04, 12:21 PM #2
i did that once, it worked allright, but now i cant find the cog...i can try to make it again
I'm just an old man with a skooma problem.
2002-02-04, 12:55 PM #3
Code:
# Jedi Knight COG script
# SUN.COG
# 
# Lucas arts not involved
# (c) 2001 GuNbOy
# ========================================================================================

symbols

message      startup                                                          
message      pulse                                                            

thing        sun                                desc=Sun                      

int          effecthandle                       local     
flex         fade=1                             local                         
end                                                                           
# ========================================================================================
code
startup:
	Sleep(1.0);
	effecthandle=newColorEffect(0, 0, 0, 0, 0, 0, 100, 100, 100, fade);
	SetPulse(.1);
	return;
# ........................................................................................
pulse:

	playerlook = GetThingLvec(player);

	fade = ((VectorX(playerlook)+VectorY(playerlook)));
	fade = fade*fade;
	PrintFlex(fade);
	If(fade > 2) {
	FreeColorEffect(effecthandle);
	}
	else {
	FreeColorEffect(effecthandle);
	effecthandle=newColorEffect(0, 0, 0, 0, 0, 0, 100, 100, 100, fade);
	}
Return;
end


this works, except the color effect makes it greyish and not white. another thing is that you are blinded when looking directly away from the sun too, this is because i had to use fade=fade*fade (to get fade as a positive number, since JK doesnt have absolute value) anyway i dont know how to fix that part...anyone else have any ideas?

I made it print the fade value, it is 0 when you are looking directly away from it or directly at it. it is 2 when you are looking perpendicular to it.

[This message has been edited by GuNbOy (edited February 04, 2002).]
I'm just an old man with a skooma problem.
2002-02-04, 2:31 PM #4
what did you use for the effecthandleint? cause when I used your cog it just made everything look kinda 'foggy' but no fade or blindness
"Mmmmm, forbidden doughnut."

2002-02-04, 4:03 PM #5
yeah im not sure what to make the effecthandle, it makes it foggy, and more foggy if you look at the ghost object. you need to play with the numbers to get it right
I'm just an old man with a skooma problem.
2002-02-05, 5:06 AM #6
What are you expecting the "fade" param of NewColorEffect() to do? It's the 0-1 flex level lighting and you can't go over 1.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-05, 8:05 AM #7
Couldn't you use HasLos(); or something like that?

------------------
Life is like... skating... yeah, skating is a good example. You see someone skating and think "Hey, that looks like fun and easy!". You go and buy a skateboard and try, you get a few broken bones, asphalt-face and stuff... But hey, i'm not the one who gets hurt!
Last edited by mb; today at 10:55 AM.
2002-02-05, 8:53 AM #8
it doesnt make any difference when it is over 1, but if it changes between 0 and 1, the desity of the fog changes, try the cog for yourself before you critisize it.
I'm just an old man with a skooma problem.
2002-02-05, 8:54 AM #9
yeah cave I could probably use HasLOS. I'll try that
I'm just an old man with a skooma problem.
2002-02-05, 9:33 AM #10
Code:
# SUN.COG
# 
# Lucas arts not involved
# (c) 2001 GuNbOy
# ========================================================================================

symbols

message      startup                                                          
message      pulse                                                            

thing        sun                                desc=Sun                      
thing	     player				local
int          effecthandle                       local     
flex         fade=1                             local                         
end                                                                           
# ========================================================================================
code
startup:
	Sleep(1.0);
	player = GetLocalPlayerThing();
	effecthandle=newColorEffect(0, 0, 0, 0, 0, 0, 0, 0, 0, fade);
	SetPulse(.01);
	return;
# ........................................................................................
pulse:

	playerlook = GetThingLvec(player);

	fade = ((VectorX(playerlook)+VectorY(playerlook)));
	fade = (fade*fade)/2;
	PrintFlex(fade);
	If(fade > 1) {
	FreeColorEffect(effecthandle);
	}
	else {
	FreeColorEffect(effecthandle);
	if(ThingViewDot(player, sun) > 0) effecthandle=newColorEffect(0, 0, 0, 0, 0, 0, 255, 255, 230, fade);
	}
Return;
end


okay this one works in the sence that it only fogs the screen when you look AT the sun, as opposed to both at it or away from it. i dont understand why the fog doesn't dissapate all the way when you are looking at a 90 deegree angle at the sun, it just cuts out, it doesnt fall off all the way...

[This message has been edited by GuNbOy (edited February 05, 2002).]
I'm just an old man with a skooma problem.
2002-02-05, 11:17 AM #11
I'll try that out. I don't quite understand all the cog talk (that's ok, don't try to explain) but what's the main difference that allowed you to fix the fog? and what's haslos? thanks gunboy
"Mmmmm, forbidden doughnut."

2002-02-05, 11:38 AM #12
It still wont work properly, it gets too bright too fast, in lamens terms...

HasLOS is a cog verb, it determines weather or not you can see the object. I used ThingViewDot instead because it seems to work better, they could both be used i guess...

The cog is far from finished, but at this point i dont think i can do any more, i was hoping someone else like Hideki would step in and take over.
I'm just an old man with a skooma problem.
2002-02-06, 4:57 AM #13
My version of the cog:

Code:
# suntest.cog
# 
# Blind the player as he looks at the sun.
#
# [GuNbOy + SM]
#================================================================================#
symbols

message	startup                                                          
message	pulse                                                            

thing		sun
thing		player		local
thing		ghostthing	local

template	gtemp=+timed_ghost	local

vector	sunlook		local
vector	lvec			local

flex		dot			local
int		handle=-1	local     

end                                                                           
#================================================================================#
code
#---------------------------------------------------------------------
startup:
	player=GetLocalPlayerThing();
	SetPulse(0.01);

Return;
#---------------------------------------------------------------------
pulse:
	FreeColorEffect(handle);
	if(!IsThingVisible(sun)) Return;
	ghostthing=FireProjectile(player, gtemp, -1, -1, '0 0 0', '0 0 0', 0, 0, 0, 0);
	lvec=GetThingLVec(ghostthing);
	sunlook=VectorNorm(VectorSub(GetThingPos(sun), GetThingPos(player)));
	dot=VectorDot(sunlook, lvec);
	handle=NewColorEffect(0, 0, 0, 0, 0, 0, 100*dot, 100*dot, 100*dot, 1);
	AddDynamicTint(player, dot/2, dot/2, dot/2);

Return;
#---------------------------------------------------------------------
end


You might want to change the NewColorEffect() and AddDynamicTint() settings. But as it is, there's a nice yellow tint. [http://forums.massassi.net/html/smile.gif]

The +timed_ghost template is:
Code:
orient=(0/0/0) type=ghost move=path timer=0.01


Good luck. [http://forums.massassi.net/html/wink.gif]

[This message has been edited by SaberMaster (edited February 06, 2002).]
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-06, 11:16 AM #14
all right sabermasters here! whoa, hey, what's timed-ghost and where does it go?
"Mmmmm, forbidden doughnut."

2002-02-06, 11:46 AM #15
+timed_ghost is a template. When a thing created from this template is created in the game, it will be removed 0.01 seconds afterwards when the timer expires.

Assuming your using JED: Open up the Template Creator. Type in +timed_ghost in the template box. Then paste these settings into the large box on the right:
Code:
orient=(0/0/0)
type=ghost
move=path
timer=0.01


Click save and the template will be created in the level's .jkl file. Now the cog can access the +timed_ghost template.

BTW, do you have a template for the sun? You'll have to create a thing somewhere in your level to be the Sun.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-06, 11:47 AM #16
+timed_ghost is a template. When a thing created from this template is created in the game, it will be removed 0.01 seconds afterwards when the timer expires.

Assuming your using JED: Open up the Template Creator. Type in +timed_ghost in the template box. Then paste these settings into the large box on the right:
Code:
orient=(0/0/0)
type=ghost
move=path
timer=0.01


Click save and the template will be created in the level's .jkl file. Now the cog can access the +timed_ghost template.

BTW, do you have a template for the sun? You'll have to create a thing somewhere in your level to be the Sun.

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.
2002-02-06, 12:13 PM #17
ok, gotcha on the whole template thing- but does it have a parent? I suppose not so I did exactly as you stated. Right now I'm just using a ghost thing as the sun so as to test it. Do you mean I have to create a separate thing called "sun" for the cog to recognize it? I thought thing # will identify it.
- disregard some of that stuff ^.
did the template without parent and now it works. still not quite a fade effect but I can't complain. thanks for the help. is there a way to make the blinding effect harsher?

[This message has been edited by kwigibo (edited February 06, 2002).]
"Mmmmm, forbidden doughnut."

2002-02-06, 3:00 PM #18
if you want it to be harsher, you should just change the handle=NewColorEffect(0, 0, 0, 0, 0, 0, 100*dot, 100*dot, 100*dot, 1);

to this

handle=NewColorEffect(0, 0, 0, 0, 0, 0, 255*dot, 255*dot, 235*dot, dot/2);

this makes the intensity a lot more, and by making the last value only 250, it will give it a slightly yellow tint. making the fade change actually varies the brightness, so this should work better.
I'm just an old man with a skooma problem.
2002-02-06, 5:04 PM #19
interesting. I can see more of the fade effect now. thanks guys for all the help and input.
"Mmmmm, forbidden doughnut."

2002-02-06, 5:50 PM #20
Sabermaster, thanks for all of the help, and If you have nothing else to add, being a very cool cog, I would like to release it to massassi.
I'm just an old man with a skooma problem.
2002-02-08, 6:32 AM #21
Sure, Gunboy, go ahead and release it. [http://forums.massassi.net/html/smile.gif]


You're welcome, kwigibo. [http://forums.massassi.net/html/wink.gif]

------------------
Each cog better than the next
Author of the JK DataMaster, Parsec, Scribe, and the EditPlus Cog Files.

↑ Up to the top!