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 → I HATE lighting!!
I HATE lighting!!
2003-04-15, 11:54 AM #1
There seems to be a link between massassi and me. When massassi is down, I get dumber! [http://forums.massassi.net/html/wink.gif]

I'm trying to make a DL cog similar to one of GBK's. But nothing happens. What's wrong with this?
Code:
symbols
Message      Startup                                                          
Message      Pulse                                                            

Thing        FocalObject                                                      
Thing        Ghost0                                                           
Thing        Ghost1                                                           
Thing        Ghost2                                                           
Thing        Ghost3                                                           
Thing        Ghost4                                                           
Thing        Ghost5                                                           
Thing        Ghost6                                                           
Thing        Ghost7                                                           
Thing        Ghost8                                                           
Thing        Ghost9                                                           
Thing        Light0                             local                         
Thing        Light1                             local                         
Thing        Light2                             local                         
Thing        Light3                             local                         
Thing        Light4                             local                         
Thing        Light5                             local                         
Thing        Light6                             local                         
Thing        Light7                             local                         
Thing        Light8                             local                         
Thing        Light9                             local                         
Flex         LightVal0                                                        
Flex         LightVal1                                                        
Flex         LightVal2                                                        
Flex         LightVal3                                                        
Flex         LightVal4                                                        
Flex         LightVal5                                                        
Flex         LightVal6                                                        
Flex         LightVal7                                                        
Flex         LightVal8                                                        
Flex         LightVal9                                                        
Int          i                                  local                         
Template     GhostThing=Ghost                                                 

end                                                                           

# ===================================================

code
Startup:
	for(i=0; i<=9; i=i+1)
	{
		SetThingLight(Ghost0, 0, 0);
	}
	SetPulse(0.05);
	Return;

Pulse:
	for(i=0; i<=9; i=i+1)
	{
		Light0 = CreateThingAtPos(GhostThing, GetThingSector(FocalObject),
                         GetThingPos(Ghost0), '0 0 0');
		SetThingFlags(Light0, 0x1);
		SetThingLight(Light0, LightVal0, 0);
	}
	Return;
# .................................................

end

I'm eventually change this so I can use it with cameras (via UserX messages), but not until I get the basics down.

------------------
May the forks be with you.
AOL - providing excellent internet connection until you leave their domain.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 19, 2003).]

[This message has been edited by DogSRoOL (edited April 19, 2003).]
Catloaf, meet mouseloaf.
My music
2003-04-15, 1:37 PM #2
um...

The cog suddenly decided to work...
The only thing I did was reload templates, and that doesn't make sense because I didn't use any templates except for Ghost.

[http://forums.massassi.net/html/confused.gif]

------------------
May the forks be with you.
AOL - providing excellent internet connection until you leave their domain.
There is a great disturbance in my shorts...
Catloaf, meet mouseloaf.
My music
2003-04-15, 2:40 PM #3
Well, you have one big problem that I see; you create the lights, but you dont destroy them... At 50 ghost creations a second, youll hit the thinglimit in less than 3 seconds.

Code:
Pulse:
for(I=0;I<=9;I=I+1) {
	If(Light0 != -1) {
		Destroything(Light0);
		Light0 = -1;
					}

	//Rest of your code here...

				}



That should fix it...

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-04-15, 5:47 PM #4
What the...?
I coulda swore I had that...
And all my lights still work?!
hmm...

Also, doesn't destroying a thing automatically make it -1?
------------------
May the forks be with you.
AOL - providing excellent internet connection until you leave their domain.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 15, 2003).]
Catloaf, meet mouseloaf.
My music
2003-04-15, 6:17 PM #5
What exactly does that cog do? Does it make it appear as though a lighted area gets brighter then darker again?

------------------
Quote:
<font face="Verdana, Arial" size="2">Groovy - Ash(Army of Darkness)</font>
Who made you God to say "I'll take your life from you"?
2003-04-15, 8:12 PM #6
It repeatedly destroys and creates dynamic lights to keep them in the same sector as the player, or in this case the camera. Unfortunately, there is no "SetThingSector" command that anyone seems to know of, although I often see rarely used commands in some of LEC's cogs, such as "SetThingPulse".

And btw, GBK, when I added the code to remove the old lights, the game crashed!

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 17, 2003).]
Catloaf, meet mouseloaf.
My music
2003-04-16, 2:13 AM #7
Are you using all of the ghosts?

------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
And when the moment is right, I'm gonna fly a kite.
2003-04-16, 8:42 AM #8
Yep. In fact, I told it to check if the light existed, but it still crashed.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 17, 2003).]
Catloaf, meet mouseloaf.
My music
2003-04-17, 4:54 PM #9
Oops. I guess I'm not using all the ghosts, but the reason it was crashing is because the value for "lightX" was less than -1! I set all of them to -1 in the symbols section, and it worked. So I added the stuff for cameras and it worked, but now it's not working again. [http://forums.massassi.net/html/rolleyes.gif]
One of these days......
Code:
# The Dog Series - Cog Script
# Written by Brandon Bull (a.k.a. DogSRoOL)
#
# AdvancedLighting.COG - [04/15/2003]
#
# Controls dynamic lighting aspects. 
# You may not use this cog without permission.
# Get Permission at:
# spuds_61520@yahoo.com
# --- or ---
# strings_of_gold@hotmail.com
#

symbols
Message      Startup                                                          
Message      Pulse                                                            
Message      User0                                                            

Thing        FocalObject                                                      
Thing        Ghost0                                                           
Thing        Ghost1                                                           
Thing        Ghost2                                                           
Thing        Ghost3                                                           
Thing        Ghost4                                                           
Thing        Ghost5                                                           
Thing        Ghost6                                                           
Thing        Ghost7                                                           
Thing        Ghost8                                                           
Thing        Ghost9                                                           
Thing        Light0=-1                          local                         
Thing        Light1=-1                          local                         
Thing        Light2=-1                          local                         
Thing        Light3=-1                          local                         
Thing        Light4=-1                          local                         
Thing        Light5=-1                          local                         
Thing        Light6=-1                          local                         
Thing        Light7=-1                          local                         
Thing        Light8=-1                          local                         
Thing        Light9=-1                          local                         
Flex         LightVal0                                                        
Flex         LightVal1                                                        
Flex         LightVal2                                                        
Flex         LightVal3                                                        
Flex         LightVal4                                                        
Flex         LightVal5                                                        
Flex         LightVal6                                                        
Flex         LightVal7                                                        
Flex         LightVal8                                                        
Flex         LightVal9                                                        
Int          i                                  local                         
Template     GhostThing=Ghost                                                 

end                                                                           

# ========================================================================================

code
Startup:
	for(i=0; i<=9; i=i+1)
	{
		if(Ghost0 > -1) SetThingLight(Ghost0, 0, 0);
	}
	SetPulse(0.05);
	Return;

Pulse:
	for(i=0; i<=9; i=i+1)
	{
		if(Ghost0 < 0) return;	// return if a ghost item is not used.
		if(Light0 > -1) { DestroyThing(Light0);  Light0 = -1; }
		Light0 = CreateThingAtPos(GhostThing, GetThingSector(FocalObject),
                      GetThingPos(Ghost0), '0 0 0');
		PrintInt(Light0);
		SetThingFlags(Light0, 0x1);
		SetThingLight(Light0, LightVal0, 0);
	}
	Return;

User0:
	if((FocalObject == -1) && (GetParam(0) != -1))
	{
		SetPulse(0.05);
		FocalObject = GetParam(0);
	}
	if(GetParam(0) == -1)  // prevents FocalObject from becoming -1 in the middle of a pulse message.  NAGT!
	{
		SetPulse(0);
		Sleep(0.05);
	}
	FocalObject = GetParam(0);
	if(FocalObject == -2) FocalObject = GetLocalPlayerThing();
	Return;
# ........................................................................................

end


Thanx.

------------------
May the forks be with you.
There is a great disturbance in my shorts...

[This message has been edited by DogSRoOL (edited April 19, 2003).]
Catloaf, meet mouseloaf.
My music

↑ Up to the top!