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 → An "Extra Light" Cog for Surfaces . . .
An "Extra Light" Cog for Surfaces . . .
2005-03-09, 3:21 PM #1
Yes, all I'd like is for a cog that has 5 surface values, a flex (speed) value, and a min_light/max_light value.

The idea of the cog is almost like a conveyor, only with lights - the first surface starts with an extra light value of 1 and then the next surface in sequence lights up while the first one fades. The light continues to "move" along this path of surfaces, and then starts back at the original surface.

Sound simple enough? I hope so. Thanks! :)
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-09, 3:42 PM #2
here ya go :)
[edit] Fixed code
Code:
# Jedi Knight Cog Script
# 
# Daft_Vader's light 'anim'
# 
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message		startup
flex		wait=2.0
surface		wall0
surface		wall1
surface		wall2
surface		wall3
surface		wall4
flex		minlight=0.2
flex		maxlight=1.0
int		i			local

end

code
# ........................................................................................
startup:
	SetSurfaceLight(wall0, maxlight, 0);
	for(i = 1; i < 5; i = i + 1) SetSurfaceLight(wall0, minlight, 0);
	while(1)
	{
		for(i = 0; i < 5; i = i + 1)
		{
			SetSurfaceLight(wall0, minlight, wait);
			if(i != 4) SetSurfaceLight(wall0[i + 1], maxlight, wait);
			else SetSurfaceLight(wall0[0], maxlight, wait);
			Sleep(wait);
		}
	}
return;
# ........................................................................................

end
May the mass times acceleration be with you.
2005-03-09, 3:57 PM #3
Thanks, I'll go try it out now!
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-09, 4:02 PM #4
agh! doesn't work entirely right. I'll have that ficed shortly.
I also misnamed a variable -- speed is in fact NOT the speed, but the waiting time for lightup/unlight values. I'll update that too.
[edit] FiXored :) Renamed 'speed' to 'wait'
May the mass times acceleration be with you.
2005-03-09, 4:19 PM #5
Hmm, I don't know if tihs isi the cog or my level, but some of the surfaces are not responding. The loop runs beautifully, thogh, thanks, it's just that it only runs through the 3 middle surfaces, not the first or last. Any ideas? :confused:
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-09, 4:56 PM #6
Yeah, I had that error too. then I fixed the cog I posted and they all cycle correctly now.
\/ \/ lol!
May the mass times acceleration be with you.
2005-03-09, 4:56 PM #7
Oh, never mind, let me try your updated cog.
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-09, 5:11 PM #8
SEXCELLENT! :D

It all works perfectly now, and looks very pretty (yet ominous), if I might add. Thanks, as always, Slaw!
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-10, 10:17 PM #9
You need to add some dynamic thing lights in with that. ;)
-Hell Raiser
2005-03-11, 12:00 PM #10
Quote:
Originally posted by Hell Raiser
You need to add some dynamic thing lights in with that. ;)

What do you mean? I've already got dynamic lights?
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-11, 4:19 PM #11
Does the surrounding archi respond to a thing light that lights up with each panel that is lit up?
-Hell Raiser
2005-03-11, 6:57 PM #12
Quote:
Originally posted by Hell Raiser
Does the surrounding archi respond to a thing light that lights up with each panel that is lit up?

Ahh, I see what you mean. Now that you mention it, no, there are no dynamic lights involved in that aspect (the strobe light effect is purely surface lighting, although there are DLs present in that scene). It looks fine to me at the moment, but I'm always open to input and suggestions for improvement. What do you have in mind?
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-11, 7:48 PM #13
Well, I'm thinking you could have the extra light of the sectors kinda low, and place Thing Lights just below each panel that lights up, and coordinate the cog to change the light on the things as it changes on the surfaces, so that it lights up the surrounding archi more realistically. :)

It just seems like the perfect scenerio to really jazz the lighting up alot. ;)
-Hell Raiser
2005-03-12, 9:41 AM #14
Quote:
Originally posted by Hell Raiser
Well, I'm thinking you could have the extra light of the sectors kinda low, and place Thing Lights just below each panel that lights up, and coordinate the cog to change the light on the things as it changes on the surfaces, so that it lights up the surrounding archi more realistically. :)

It just seems like the perfect scenerio to really jazz the lighting up alot. ;)

Great idea, Hellraiser! :)

Yes, if someone could just modify that cog from surfaces to things, and post the new version, it would work perfectly.

Also, I have another cog in mind that shgould be simple to make but very effective in-game. Here's what's going on:

1) I have created a light shade that is hanging from the ceiling. Beneath it is a spot light 3do on the floor. I would also like to have a light beam coming from the lightshade, like in the new tutorial on the main page, but for some reason I can't get tihs very simple thing to work. I've created them before, but always with some trouble. Anyway, tha'ts not important right now.

2) There is a vent right beside the hanging light shade. It is blowing the light shade around. I currenlt have the light shade blowing around in circles with the spot lighto n the floor following it. However it loosk quite unatural.

3) Instead I would like a cog that swings the lightshade back and forth between 3 frames - just like a pendulum. I can just use the same cog for the light spot on the floor. Also, it plays a sound while it swings ( a creaking metal sound) and it begins upon startup and never stops swinging. A specified speed wouldd be nice as well. SHouldn't be too hard to do. THANKS! :)

Here's a pic to goive you an idea of what it is you're dealing with:
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-12, 10:20 AM #15
Here's another place where I might want to use it. It would look good if one was swinging and one wasn't, because one is by an air vent. The player can figure this out and appreciate the added realism factor:
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-12, 3:02 PM #16
Modified to use things and change the light values. I changed it to use different values for the dim/undim delays... you may need to play around with them to perfect it, because thing light values, at least during the time I tested this cog, dont seem to change at the same rate when they dim and undim -- they seem to be different (or maybe this wasn't as obvious when I as testing the surface version of the cog, I dunno)
Code:
# Jedi Knight Cog Script
# 
# Daft_Vader's light 'anim'
# 
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message		startup
flex		wait0=2.0		#dim out delay
flex		wait1=1.0		#lightup delay
thing		light0
thing		light1
thing		light2
thing		light3
thing		light4
flex		minlight=0.2
flex		maxlight=1.0
int		i			local

end

code
# ........................................................................................
startup:
	SetThingLight(light0, maxlight, 0);
	for(i = 1; i < 5; i = i + 1) SetThingLight(light0, minlight, 0);
	while(1)
	{
		for(i = 0; i < 5; i = i + 1)
		{
			SetThingLight(light0, minlight, wait0);
			if(i != 4)
			{
				SetThingLight(light0[i + 1], maxlight, wait1);
			}
			else
			{
				SetThingLight(light0[0], maxlight, wait1);
			}
			Sleep(wait0);
		}
	}
return;
# ........................................................................................

end

And here's one for your moving lamp.
Code:
# Jedi Knight Cog Script
#
# Swinging lamp - moves a ceiling lamp through 3 frames and at each frame plays a creak sound.
#
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message	startup
thing	lamp
flex	speed=0.2
int	frame=0		local
sound	creak0
sound	creak1
sound	creak2
int	playsound0=1	#1 to play the creak sound at this frame, 0 to not play it
int	playsound1=1
int	playsound2=1
flex	vol=1.0
flex	minrad=4	# about 0.2 jku
flex	maxrad=10	# about 1 jku

end

code
startup:
	sleep(0.1);
	while(1)
	{
		frame = frame + 1;
		if(frame > 2) frame = 0;
		MoveToFrame(lamp, frame, speed);
		if(playsound0[frame]) PlaySoundThing(creak0[frame], lamp, vol, minrad, maxrad, 0x0);
		WaitForStop(lamp);
	}
stop;

end

[edit] After thinking a bit, scratch that first cog. I'm going to write another one that will:
1. Create a ghost at ghost0 and change its light value to a specified max value
2. Wait for full light, then move the ghost light to ghost1
3. Wait for arrival, then set light to 0, and create another ghost thing to repeat the process.
That ought to be a little smoother, and easier to deal with.
May the mass times acceleration be with you.
2005-03-12, 8:42 PM #17
Apparently, creating the dummy ghost in the cog made it so I couldn't change its light value :\ Whatever, you just need to make sure there's a ghost with 2 frames (frame 0: beginning of lights, frame 1: end of lights) and that the dummy ghost is placed at the end of the lights (frame 1)
Code:
# Jedi Knight Cog Script
# 
# Daft_Vader's light 'anim'
# 
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message		startup

flex		maxlight=1.0		#max value of ghost light
flex		delay=0.5		#how long to (un)dim the light
flex		speed=10.0		#how fast the ghost light moves down the track

thing		ghost=-1		#ghost light. give it 2 frames.
thing		dummy=-1		#dummy ghost placed at frame 2 of object 'ghost'

sector		sec			local

template	ghosttemp=ghost		local

end

code
# ........................................................................................
startup:
	MoveToFrame(ghost, 0, 1000);
	WaitForStop(ghost);
	sec = GetThingSector(ghost);
	SetThingLight(dummy, 0, 0);
	SetThingLight(ghost, maxlight, 0);

	While(1)
	{
		MoveToFrame(ghost, 1, speed);		//move to frame 1
		WaitForStop(ghost);			//stop at frame 1
		SetThingLight(dummy, maxlight, 0);
		SetThingLight(ghost, 0, 0);
		SetThingLight(dummy, 0, delay);
		JumpToFrame(ghost, 0, sec);
		SetThingLight(ghost, maxlight, delay);
		sleep(delay);
	}
return;
# ........................................................................................
end


btw, sorry it took so long (if you noticed, anyway). I went to a play at my school and was out for a while :) Gave my friend 6 simultaneous heart attacks when he found out I parked my car next to his truck :D
May the mass times acceleration be with you.
2005-03-12, 11:42 PM #18
Oh no problem, you definately don't need to apologize. You're doing this completely out of your own accord. ;)

Also, it's ironic that you went to a school play as well, since that's exactly where I went today - for my school's musical production of Guys and Dolls. It was quite good, what play did you go to see? :)

[Ninja EDIT: wow, it's late I'd better go to bed. I'll test this tomorrow.]
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-13, 12:55 PM #19
Hehe, I saw that one a number of years ago, I think 6th grade. Doesn't seem like it was so long ago though. I went to see The Complete Works of William Shakespeare (Abridged). It essentially combines shakespeare and monty python to create a work of total randomness (or something like that). So much great stuff, I'll just point out some of the best stuff... one of his plays was adapted to a cooking show, and then they did the Othello Rap, and then the Old English 'Football' game (played with a crown -- quarterback passes to the halfback, halfback runs up the field, the 30, the 20, the 10... lateral to the hunchback... TOUCHDOWN!)

Finally, they closed up with Hamlet, done in normal speed, then faster, then even faster, and then BACKWARDS! ".be to not or, be To".

I'm really glad I decided to go :D
May the mass times acceleration be with you.
2005-03-13, 1:01 PM #20
I've seen that on video, did they do the Shakespeare/Hitler thing at the start?
Detty. Professional Expert.
Flickr Twitter
2005-03-13, 1:03 PM #21
Yep :)
I didn't know they had it on video... I'll have to go find it now
May the mass times acceleration be with you.
2005-03-13, 6:29 PM #22
Find it on DVD. It's better. There are special features, such as the original garage version.

My favorite part is...*thinking*....

Oh, heck, all of it.

Of course, it helps that my brother was part of Hamlet Abridged when my school did some one-acts :) . And my old school did the whole thing a few weeks ago.

Back on topic, this looks like it could be a cool level. Let me know when and where I can get it when you release it, please.
Tomorrow holds a brighter future.
2005-03-20, 1:40 PM #23
Hi,

Sorry for the late reply, I've been busy with other things. The strobe light cog seems to work okay, but I'm having a hard time getting it coordinated with the surface light cog. They both seem to be out of sequence with the other.

As for the swinging lamp cog, that's giving me the most trouble. I don't know if I'm just messing up the frames or if the cog has a marginal error, but somehow, it's just not working. The lamp seems to swing erratically backwards and forwards, skipping frames and it looks very . . . unnatural. :/

Any suggestions Slaw? Thanks.
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-20, 2:22 PM #24
Oh, I knew that but I assumed by your wording you'd just have a left-right motion, so I didn't bother fixing it... my bad.
I'll also see what I can do about the light cog.
May the mass times acceleration be with you.
2005-03-20, 4:08 PM #25
Okay, try these out.
Code:
# Jedi Knight Cog Script
#
# Swinging lamp - moves a ceiling lamp through 3 frames and at each frame plays a creak sound.
#
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message	startup
thing	lamp
flex	speed=0.2
int	frame=0		local
sound	creak0
sound	creak1
sound	creak2
int	playsound0=1	#1 to play the creak sound at this frame, 0 to not play it
int	playsound1=1
int	playsound2=1
flex	vol=1.0
flex	minrad=4	# about 0.2 jku
flex	maxrad=10	# about 1 jku

end

code
startup:
	sleep(0.1);
	while(1)
	{
		frame = frame + 1;
		if(frame > 2) frame = 0;
		if(frame == 0) SkipToFrame(lamp, 0, speed);
		else MoveToFrame(lamp, frame, speed);
		if(playsound0[frame]) PlaySoundThing(creak0[frame], lamp, vol, minrad, maxrad, 0x0);
		WaitForStop(lamp);
	}
stop;

end

Code:
# Jedi Knight Cog Script
# 
# Daft_Vader's light 'anim'
# 
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols

message		startup

flex		maxlight=1.0		#max value of ghost light
flex		delay=0.5		#how long to (un)dim the light
flex		speed=10.0		#how fast the ghost light moves down the track

thing		ghost=-1		#ghost light. give it 2 frames.
thing		dummy=-1		#dummy ghost placed at frame 2 of object 'ghost'

surface		surf0
surface		surf1
surface		surf2
surface		surf3
surface		surf4

flex		surfdelay=0.5		#how long it takes to (un)dim the surface
flex		maxsurflight=1.0
flex		minsurflight=0.2

sector		sec			local

template	ghosttemp=ghost		local

int		i			local

end

code
# ........................................................................................
startup:
	MoveToFrame(ghost, 0, 1000);
	WaitForStop(ghost);
	sec = GetThingSector(ghost);
	SetThingLight(dummy, 0, 0);
	SetThingLight(ghost, maxlight, 0);
	SetSurfaceLight(surf0, maxsurflight, 0);

	While(1)
	{
		MoveToFrame(ghost, 1, speed);			//move to frame 1
		for(i = 0; i < 5; i = i + 1)
		{
			SetSurfaceLight(surf0, minsurflight, surfdelay);
			if(i != 4) SetSurfaceLight(surf0[i + 1], minsurflight, surfdelay);
			else SetSurfaceLight(surf0, minsurflight, surfdelay);
			sleep(delay);
		}
		if(IsThingMoving(ghost)) WaitForStop(ghost);	//stop at frame 1
		SetThingLight(dummy, maxlight, 0);
		SetThingLight(ghost, 0, 0);
		SetThingLight(dummy, 0, delay);
		JumpToFrame(ghost, 0, sec);
		SetThingLight(ghost, maxlight, delay);
		sleep(delay);
	}
return;
# ........................................................................................
end

For the thing/surface lighting cog, you'll probably have to play with values. Make sure the surface anim finishes a at the same time or a little before the thing finishes moving -- if you do it the other way around the thing will wait until the surface animation is finished before dimming its light value. This is why there are 2 delay values -- to play around with it until it looks good.
May the mass times acceleration be with you.
2005-03-20, 7:43 PM #26
Thanks, I'll give it a shot tomorrow hopefully. I'm feeling tired now, and I still have a week of school before Spring Break. :)
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-21, 2:31 PM #27
Ugggh, I don't know what's going on. I tried out the swinging frames cog, and the same thing happened as before. I tried it on the light circle on the floor where
"+" = 1st frame and "*" = 2nd frame and then the 3rd frame moves back to "+" like this:

+ < - - -> *

This worked fine with the light circle, but when I tried the same thing with the Lightshade, it kept warping from frame 1 to frame 2, back to frame 1 (aka "3") again but didn't go the distance inbetween.

:confused:

It looks really weird in-game, this picture doesn't do it justice. Any ideas why (am I setting up the frames wrong, because I've set them up differently before and it still hasn't worked). Perhaps something to do with the 3DO and it's pivot point?
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-24, 3:31 PM #28
*splutter*
My JK Level Design | 2005 JK Hub Level Pack (Plexus) | Massassi Levels
2005-03-24, 8:31 PM #29
Okay, now the lamp and spotlight are both handled by a single cog, and there are now only 2 frames... one is when the lamp is fully swung to the right, and the other to the left.
Now, I cant tell if it's just me, or if I made a booboo in my cog or level or what, but the spotlight template I made for myself just isn't moving at all. In the cog window, I swapped the values for lamp and spotlight, and then JK froze on level startup. I'm pretty sure this indicates I have a level issue and not a cog issue. Anyways, the variables ought to self explain... if you have any problems, post back here.

Code:
# Jedi Knight Cog Script
#
# Swinging lamp - moves a ceiling lamp through 2 frames and at each frame plays a creak sound.
#
# [darthslaw]
# 
# This Cog is Not supported by LucasArts Entertainment Co

symbols
message		startup
thing		lamp
thing		spotlight		# set to -1 if you have no spotlight
flex		lampspeed=0.2
flex		spotlightspeed=0.3
int		frame=0			local
sound		creak0
sound		creak1

flex		vol=1.0			# set to 0 if you dont want a sound to be played
flex		minrad=4		# about 0.2 jku
flex		maxrad=10		# about 1 jku

end

code
startup:
	sleep(0.1);
	while(1)
	{
		frame = 1 - frame;
		if(spotlight != -1) MoveToFrame(spotlight, frame, spotlightspeed);
		MoveToFrame(lamp, frame, lampspeed);
		if(vol > 0) PlaySoundThing(creak0[frame], lamp, vol, minrad, maxrad, 0x0);
		WaitForStop(lamp);
	}
stop;

end
May the mass times acceleration be with you.

↑ Up to the top!