Jump to content

Turn Off Flames/Lights


Triforce1

Recommended Posts

As you may know, I am making an "open" city (The exterior is in the Tamriel Worldspace, not its own). This city's main means of exterior lighting during the night are open flames on pillars and in holders. But I find that these lights can be overly bright and glaring during the day, particularly at sunrise/sunset. Is it possible for me to make it so these flames and their lights are disabled during the day and enabled during the night? If it requires a script, what might that script look like?
Link to comment
Share on other sites

Hi, Triforce1.

 

I just did something like that. In my case, I have an on/off switch/activator for candles on the wall, so the player turns them on/off as he pleases. I suppose it wouldn't be difficult to adapt it to your needs.

 

Just disabling them is not enough, as they disappear while disabled. I suppose you don’t want your torches/candles appearing and disappearing like magic.

You have to find/create an object that looks like your torch, but looks unlit/extinguished. And when you disable one, you enable the other. Examples from vanilla Oblivion: WallSconceDouble01Yellow128 and WallSconceDouble01Off

 

If you are familiar with scripting, you may download my mod, Divine Elegance Showroom, and take a look in the QQdesrLightSwitch02SCRIPT

 

There may be better ways to do it, but this may give you a starting point.

Hope it helps

Link to comment
Share on other sites

Hi, Triforce. Here we go …

 

The following script, attached to an object in your city exterior, should do the trick

 

scriptname XXXStreetLightsSCRIPT

short LightsOn

begin gamemode
if LightsOn
   ; check if it is time to turn them off
	if gamehour > 7 && gamehour < 18   ; (1)
		set LightsOn to 0

		XXXStreetLight01Off.enable
		XXXStreetLight01On.disable
	   ; . . .		( repeat the above 2 lines once for each on/off pair of objects )
		XXXStreetLight99Off.enable
		XXXStreetLight99On.disable
	endif								

else
   ; check if it is time to turn them on
	if gamehour < 7 || gamehour > 18   ; (1)
		set LightsOn to 1

		XXXStreetLight01On.enable
		XXXStreetLight01Off.disable
	   ; . . .		( repeat the above 2 lines once for each on/off pair of objects )
		XXXStreetLight99On.enable
		XXXStreetLight99Off.disable
	endif
endif
end

XXX = whatever prefix you use to identify your mod objects

XXXStreetLightnnOn/Off – The individual names of the on/off pair of objects.

(1) - 24-hour clock with decimals 7=7:00AM 7,5=7:30AM 7.75=7:45AM 18=6:00PM

 

There is an easier way that Bethesda uses for, e.g., the light by the door of Rindir Staffs in the Market District:

It is a static 'torch' plus an invisible, scripted light source that goes on and off at certain times of the day.

I don’t like it for two reasons:

1- The light looks on all day long

2- There is a script running every frame for each single light in the cell. I'd rather have a single script taking care of all lights.

Link to comment
Share on other sites

Akatosh be praised :woot: !!! So you are telling me that if I alter the XXXStreetLightnn to the reference names of my on and off flames and attatch this script to them, then it will work?! Nothing has ever been greater! But I have a question; please be patient, because I have no prior scripting experience (except for a tutorial that told me exactly what to do). When you say "attatched an object in the exterior", do you mean I create this one script, filling in my references as you have stated, attatch it to any one of the flames, and ALL of them will turn on/off? If so that would be awesome, but it just seems too easy...
Link to comment
Share on other sites

So you are telling me that if I alter the XXXStreetLightnn to the reference names of my on and off flames . . . then it will work?
That’s right. I suppose you have two Base Objects (on and off) and n references to each one. Each reference must have a unique name, like XXXFlame01on, XXXFlame01off, XXXFlame02on, etc. Replace XXXStreetLightnn in the script. The first block is to turn them off, so you enable all the 'off' references and disable the 'on' references. In the second block, vice-versa.

 

. . . attatch this script to them . . .

When you say "attatched an object in the exterior", do you mean I create this one script, filling in my references as you have stated, attatch it to any one of the flames, and ALL of them will turn on/off?

Not quite. Scripts are attached to the Base Object. If you did that, you would end up with each reference running a copy of the script each frame. That would be bad!

Create a new, unique Base Object, say, a barrel, and attach the script to it. Create a new, unique reference to that object and place it in the same cell as the flames. You may place it underground, if you like.

I would name it XXXStreetLampManagerBase or something like that, or . . . what was called, in English, that guy that used to go around the city lighting up the street lights before electricity?? . . . that would be an appropriate name.

 

I am new to modding myself. All I know about modding is scripting and little else. And only interiors (first time I opened an exterior cell in CS was this morning, to see how the street lights were set up in the game). Maybe, someday I will need your help, if I ever start messing with exteriors.

Link to comment
Share on other sites

Hey hey HEY! So, new to modding; you are fairly proficient at scripting and little else, hmmm? Well, then have I got a deal for you! This question ties into a mod me and a semi-arranged somewhat agreed-upon team are working on; a whole new city that floats in the sky and a very large quest that it revolves around. And there will be dragons. And Dwarven stuff. And bears. (Oh my.) At present, I am in huge need of scripters and, well, not much else. Would you have any interest in joining the team? I say that loosely because we are just a bunch of modders working together to achieve a common goal. Hold up, I guess that is kinda the definition of team, huh? Either way, you have been a tremendous help, and I would love it if you would check out our somewhat-less-than-official thread. Find it within the first two pages of File Requests / Suggestions; it tends to stay a "hot topic" (red or pink). If you are interested, please PM me and let me know. Please. I need scripters like I need a computer; the mod would be impossible without their (your) help.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...