View Full Version : I HATE lighting!!
DogSRoOL
04-15-2003, 02:54 PM
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?
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[i], 0, 0);
}
SetPulse(0.05);
Return;
Pulse:
for(i=0; i<=9; i=i+1)
{
Light0[i] = CreateThingAtPos(GhostThing, GetThingSector(FocalObject),
GetThingPos(Ghost0[i]), '0 0 0');
SetThingFlags(Light0[i], 0x1);
SetThingLight(Light0[i], LightVal0[i], 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).]
DogSRoOL
04-15-2003, 04:37 PM
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...
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.
Pulse:
for(I=0;I<=9;I=I+1) {
If(Light0[I] != -1) {
Destroything(Light0[I]);
Light0[I] = -1;
}
//Rest of your code here...
}
That should fix it...
------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
DogSRoOL
04-15-2003, 08:47 PM
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).]
SM_Trige
04-15-2003, 09:17 PM
What exactly does that cog do? Does it make it appear as though a lighted area gets brighter then darker again?
------------------
<font face="Verdana, Arial" size="2">Groovy - Ash(Army of Darkness)</font>
DogSRoOL
04-15-2003, 11:12 PM
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).]
Are you using all of the ghosts?
------------------
Createthingatpos(GBK, 0, '0 0 0', '0 0 0');
DogSRoOL
04-16-2003, 11:42 AM
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).]
DogSRoOL
04-17-2003, 07:54 PM
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......
# 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[i] > -1) SetThingLight(Ghost0[i], 0, 0);
}
SetPulse(0.05);
Return;
Pulse:
for(i=0; i<=9; i=i+1)
{
if(Ghost0[i] < 0) return; // return if a ghost item is not used.
if(Light0[i] > -1) { DestroyThing(Light0[i]); Light0[i] = -1; }
Light0[i] = CreateThingAtPos(GhostThing, GetThingSector(FocalObject),
GetThingPos(Ghost0[i]), '0 0 0');
PrintInt(Light0[i]);
SetThingFlags(Light0[i], 0x1);
SetThingLight(Light0[i], LightVal0[i], 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).]
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.