SetCellLighting
A function added by the Oblivion Script Extender.
Syntax:
(nothing) SetCellLighting newValues:StringMap
Alters one or more of an interior cell's lighting fields, taking a StringMap of the same format as that returned by GetCellLighting. Include only the elements you wish to change; if a key is not found its value will not be modified.
The StringMap contains the following key-value pairs corresponding to the fields in the editor's Cell Lighting tab, where 'RGB Array' is a 3-element Array with values from 0-255 in the order {red, green, blue}:
- "ambient" (RGB Array)
- "directional" (RGB Array)
- "fog" (RGB Array)
- "rotxy" (float)
- "rotz" (float)
- "fognear" (float)
- "fogfar" (float)
- "clip" (float)
- "fade" (float)
Detailed Example
Here's an example detailing how you might set the cell lighting. Note that if you modify the lighting via script like this, you need to do it again with each load of a saved game, so the code in the GameMode block needs to be repeated using a GetGameLoaded test. Also, only the desired elements are included in the update. This script does not modify the fognear, clip or fade settings - they will be left at their current values. Lastly the myModHouse parameter is the Editor ID of the cell we wish to change.
scn setCellLightingExampleScript array_var cellLighting begin GameMode let cellLighting := ar_construct StringMap let cellLighting["ambient"] := ar_construct array let cellLighting["fog"] := ar_construct array let cellLighting["directional"] := ar_construct array let cellLighting["ambient"][0] := 20 let cellLighting["ambient"][1] := 20 let cellLighting["ambient"][2] := 20 let cellLighting["fog"][0] := 0 let cellLighting["fog"][1] := 0 let cellLighting["fog"][2] := 0 let cellLighting["fogfar"] := 0 let cellLighting["directional"][0] := 0 let cellLighting["directional"][1] := 0 let cellLighting["directional"][2] := 0 let cellLighting["rotxy"] := 0 let cellLighting["rotz"] := 0 setCellLighting myModHouse cellLighting end