Jump to content

Daylight Script


d4em

Recommended Posts

Hi,

I made a script that's supposed to turn light beams and light bulbs on/off according to the game time:

 

 

begin gamemode

if gamehour >= 6 && gamehour < 8

enable

elseif gamehour >= 8 && < 6

disable

endif

end

 

 

I then applied the script to said items, and went to test it ingame, but both stay "on".

Does anyone know what I did wrong?

Link to comment
Share on other sites

There arent any references after the "Enable" and "Disable" commands.

 

You need to make an xMarker (Or oblivions equivelant, Im going from Fallout knowledge here) and name it something like "LightsMarker", then go through each of your lights and set the "Enable Parent" as the marker. Once you've done that, edit your script to look more like this.

 

Scriptname LightsCycle

begin gamemode
if gamehour >= 6 && gamehour < 8
	LightsMarker.enable
elseif gamehour >= 8 && gamehour < 6
	LightsMarker.disable
endif
end

 

Just making sure, but you did give the script a name, right?

If not, stick "Scriptname LightsCycle" Or something similar, but keep "Scriptname" at the beginning."

Also, you forgot to add in the second "Gamehour" variable on line four.

Link to comment
Share on other sites

There's already a mod that does sort of what you want. I don't remember the whole name but it's abbreviated AWLS.

 

As for your script, the problem is in your elseif condition. The game hour can't be more than 8 and less than 6 at the same time! Use "||" instead of "&&". Or actually, don't put a condition at all and just leave it as "else".

 

 

EDIT:

 

Wait, I see what you're trying to do. The game counts the day in a single 24 hour cycle, not two 12 hour cycles. So your first condition should be

 

if GameHour >= 18 || GameHour < 8

 

and your elseif condition should have been

 

elseif GameHour >= 8 && GameHour < 18

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

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