Hi there! You are currently browsing as a guest. Why not create an account? Then you get less ads, can thank creators, post feedback, keep a list of your favourites, and more!
Lab Assistant
Original Poster
#1 Old 20th Feb 2005 at 11:39 AM Last edited by jgwhiteus : 21st Feb 2005 at 2:21 PM.
Default Changing Lamps' Light Color & Intensity with lightAttribOverride
EDIT I finally figured out where all the basic references are and how to make the lamp object "independent' of its base. I'll post a tutorial in the Tutorial section later.

Hi everyone,

I haven't seen many discussions of this subject on the forum (the most substantive was a post back in October - http://www.modthesims2.com/showthread.php?t=4727), nor did I see a listing for this in the Wiki, though I might have missed it. I figured I'd start a discussion on this so that people might contribute some knowledge and work out some issues. Also, if a plugin for the lightAttribOverride filetype could be developed for SimPE, that would be great as well.

I just released a custom lamp object in the Beta Objects forum of "colored ceiling bulbs," which use the lightAttribOverride format to give off different light colors, without affecting other lights in the game. From my limited understanding (I'm just a beginning modder), light colors for individual lamps in the game can be changed with the "lightAttribOverride" file format (currently listed as UNK:0xADEE8D84 in SimPE), much as textures can be overriden with Material Override. EDIT So far, the only Maxis objects that appears to use this filetype are the Halloween objects: the Inflatable Ghosts, Cat, and Pumpkin. An example of the format is this:

lightAttribOverride lightName_light intensity 3.5
lightAttribOverride lightName_light color 1,0,0
lightAttribOverride lightName_light falloffRate 1
lightAttribOverride lightName_light diffusionSourceColor 1,0,0
lightAttribOverride lightName_light diffusionSourceIntensity 3.5
lightAttribOverride lightName_light diffusionSourceFalloff 1
lightAttribOverride lightName_light diffusionSourceWallIntensityScale 1
lightAttribOverride lightName_light diffusionSourceFloorIntensityScale .65
lightAttribOverride lightName_light diffusionSourceIsDirectional 0

If you look in your Program Files\Maxis\The Sims 2\TSData\Res\Lights\objects folder, you can see lots of individual files which list variations of the values of the above - e.g. "lightObjects.txt" lists various ideal values for outdoor and indoor lights. If you look at the "Lighting.txt" file in the TSData\Res\Lights directory, it lists other variables that may be able to be used.

"intensity" and "diffusionSourceIntensity" appear to affect the strength of the light.
"color" and "diffusionSourcecolor" are the color of the light, with the individual numbers being the R/G/B value divided by 255.
"falloffrate" and "diffusionsourceFalloff" might be the range of the light - i.e. how far it spreads out before fading.
"WallIntensityScale" and "FloorIntensityScale" determine how much walls and floors are affected by the light source.
"diffusionSourceisdirectional" - ?

From my initial testing, it seems that if you'd like to incorporate this format into a custom lamp object, you need to make changes to files in three areas:

1. You need to add the lightAttribOverride format to your object. Probably the easiest way is to extract the format from the Inflatable Ghosts object with SimPE. Then, the SimPE file can be opened with a text editor such as Notepad. In the place of "lightingHalloweenGhosts_light" choose a name for your custom light color (for example, I used "jgceilingred_light") and replace all the entries with that. Then, choose your desired settings.

2. After you've saved and added the file format to your custom lamp object, you need to incorporate the name of the light you just made above. Go to Text Lists for your custom object, and choose "Light Names" (Instance 0x0000008E). You'll see the name of the light for your base object (e.g. "lightingceilingquaint_light" for the Lamp in a Half Shell object), and you should change this to the name you chose above ("jgceilingred_light")

3. EDIT: So far, if you've only made the changes above, your custom lamp object will give off a different color, but so will the base object - e.g. the original "lightingceilingquaint_light." That's because there's a third reference in the Resource Node/CRES filetype - the cLightRefNode in the "Blocklist." You can see the old name of the light if you look near the bottom of the Resource Node file in the Uncompressed Data view. EDIT: This name does not necessarily match the name in the Text List, but it should be changed so that the original base lamp object is not affected. This can't be edited with a plugin currently; probably the best way to do so is with an external hex editing (converts between hex and text) program such as Hex Editor. Extract the CRES file, change the reference, and re-incorporate the file.

So far, using the steps above, I was able to make an object that gave off different colored lights independent from the other lamps in the game. But there's a problem: there's a difference between light that is thrown on walls and floors and light that is thrown on objects. Right now, my original base object (the "Lighting Efects" ceiling lamp) is being affected by my custom objects - the light it throws on walls and floors is fine, but the light it throws on objects will be affected if I select one of my custom lamps in the catalog -then, it colors all objects the hue of the selected custom object's light.

EDIT This apparently has to do with a fourth reference in the "Lighting (Point Light)" or "Lighting(Spot Light)" (depending on the type of light) reference that appears in the CRES (underneath the "Shape" reference in the Reference tab). Even though the CRES references the file format, it usually does not appear in the object as an editable file, so you'll have to extract it from another object and incorporate it to edit it. Again, this file appears in the Halloween objects - the Ghost, Cat, and Pumpkin, as a Lighting (Point Enabled) file type.

4. First, copy down the Subtype, Group (0x1c050000 for custom objects), and instance number for the Lighting (Point Light) reference that appears in the CRES of your CUSTOM light. Then, open up one of the Halloween objects and find the Lighting (Point Light) filetype. Clone it, and change the subtype, group, and instance numbers in the Packed File view to the ones you copied above. Commit, and extract this clone with the changed references. Exit the file without saving (you don't want to change the original Halloween object).

Open up the extracted Lighting filetype with an external hex editor. So far, it seems that the filenames that appear have to be changed to match the filenames in your custom object - with later versions of SimPE, this means typing in a long filename such as ##0x1c05000!customfilename__lightname_light_lght, etc. [b]EDIT[\b] I'll cover the later steps in a tutorial that I'll post in the Tutorial forum.

Sorry for the really long post, but I hope it's been helpful and that more experienced modders out there will be able to look into the issue. This format really is useful, and I suspect in combination with the BHAV primitive "Change Light" you could make objects that switch between various light colors by having multiple lightAttribOverride files that are referenced in the "Light Names" text list - it wouldn't be a traditional re-color, but it would give light options nonetheless. Anyway, please let me know if you have any information or suggestions; thanks,

J.
Advertisement
Lab Assistant
Original Poster
#2 Old 21st Feb 2005 at 11:37 AM Last edited by jgwhiteus : 21st Feb 2005 at 2:34 PM.
As an update to my own post, I figured out where the fourth lighting reference occurs that affects the light that is thrown on objects - it is the Lighting (Point Light) reference that occurs in the Resource Node/CRES reference tab - see edits above. I've been able to edit this file by copying it from one of the Halloween objects, changing the subtype and group to match the reference in the custom object's CRES reference, and changing the filenames that appear in the file with an external hex editor. Then, I add it to my custom lamp object to connect it to the CRES reference, and create a unique Instance reference so that the object doesn't interfere with its base or other custom objects.

EDIT I'll explain this step fully in a tutorial in the Tutorials forum.
Lab Assistant
#3 Old 5th Mar 2005 at 5:08 AM Last edited by todd : 5th Mar 2005 at 5:11 AM.
I realize this is an old thread, but I wanted to thank you for writing this It helped me to finish a light switch I've been working on. It has only 2 options, On and Off, which control lights in the room only.

This tutorial helped me to make the object emit no light at all by setting all values in the lightAttribOverride to 0. I've been trying to figure it out for a while now. Thanks a lot for this
Field Researcher
#4 Old 30th Apr 2005 at 11:45 AM
One question:
In SimPE, when editing lights, there are certain variables that are editable, in Lighting (point light)/plugin view. These are lebelled val1 to val7, each with different values. What are these?
And is it possible to make a light controller, to turn on individual lights from one object?
Back to top