Jump to content

Let's do some maths and scripting


Recommended Posts

Hi everybody, hope you are doing well !

 

Alright here is the deal : I am trying to create a house with a complex lighting system.

Idealy, the feature that I am trying to implement are the following :

 

  • Lightbulbs that change depending on the time of day and weather,
  • Light beams that rotates with the time of day
  • Curtains and shutters that enable/disable the light beams and light bulbs

 

First, let's consider a single window with one lightbulb, one lightbeam, one curtain and one shutter.

 

The cell is behaving as an exterior : I duplicated the tamriel climate where all weathers are copies of the exterior ones except fog, sun light, ambient light and precipitaion are disabled. That way, only the sky is visible, and no light information are provided by the weather. When the player entered the cell, I assume I synchronized the interior weather with the exterior one.

 

Now, the lightbulb will have its own script where a GameMode block calculate the light from the weather ambien and sun light thanks to OBSE functions. Yet, in the CSE render window, it seems the light is interpolated between the 4 time increments (dawn/noon/dusk/midnight). Anyone know the actual function used ? If not, how do you actually interpolate between 2 colors ?

 

Next, because I can't attach an object script to the light beam, I will attach my script to an activator whose parent is the light beam. Then, a GameMode block will rotate the light beam depending on the gametime.

 

Now, this I can't seem to get my fact straight.

Because I want the player to be able to interact with the curtain and the shutters, these have to be activators. This seems like a good thing because I can parent the curtain to the lightbulb and the light beam and then disable them. Problem is, no matter who is the parent, the activator gets disabled.

I can understand that if the parent is disabled, the child is too. But why does the parent gets disabled if the child is ?

I even copy pasted some code from the game, and I get the same result. How can I disable and object, using an activator, without disabling the activator ?

 

I tried going the trick from the CSE wiki tutorial where you duplicate the activator, parenting the duplicate to the other one and set its state as opposite. Problem is : because my activator is animated (there is an animation when the curtain opens or closes), I get weird result. Is there a way to control the animation state (begining/end) of an object ?

Example :

The curtain is opened,

Player activates the curtain,

Closing animation plays, once the script timer ends, I disable it

The duplicate is thus enabled

 

I would like this last stage to enable the duplicate in closed state, however it does not when I test my script.

 

I know I could symply use the the reference of my objects but I intend to make the script as general as possible so that I only need a few that rely on parent/child relationship. But it seems to me that this is more like a link than an actual parent>child authority relationship.

 

I hope you'll find the reading enjoyable if I was not clear enough, do not hesitate.

 

Cheers,

 

 

Erwan G.

Edited by TheMedievalsKnights
Link to comment
Share on other sites

I have a problem with the door that teleports me to my sell, If I attach my script to the door, it wont teleport me when I activate it. If I remove the script it does teleport me.

 

Door script :

 

 

SCN WeatherSyncScript

Begin OnActivate:
if aWeatherSyncQuest.InCell == 0 :
if GetIsCurrentWeather Clear:
set aWeatherSyncQuest.WeatherSync to ClearInterior
elseif GetIsCurrentWeather Cloudy :
set aWeatherSyncQuest.WeatherSync to CloudyInterior
elseif GetIsCurrentWeather Fog :
set aWeatherSyncQuest.WeatherSync to FogInterior
elseif GetIsCurrentWeather Rain :
set aWeatherSyncQuest.WeatherSync to RainInterior
elseif GetIsCurrentWeather Overcast :
set aWeatherSyncQuest.WeatherSync to OverInterior
elseif GetIsCurrentWeather Snow :
set aWeatherSyncQuest.WeatherSync to SnowInterior
elseif GetIsCurrentWeather Thunderstorm :
set aWeatherSyncQuest.WeatherSync to ThunderstormInterior
endif
set aWeatherSyncQuest.InCell to 1
activate
else:
if GetIsCurrentWeather ClearInterior:
set aWeatherSyncQuest.WeatherSync to Clear
elseif GetIsCurrentWeather CloudyInterior :
set aWeatherSyncQuest.WeatherSync to Cloudy
elseif GetIsCurrentWeather FogInterior :
set aWeatherSyncQuest.WeatherSync to Fog
elseif GetIsCurrentWeather RainInterior :
set aWeatherSyncQuest.WeatherSync to Rain
elseif GetIsCurrentWeather OverInterior :
set aWeatherSyncQuest.WeatherSync to Overcast
elseif GetIsCurrentWeather SnowInterior :
set aWeatherSyncQuest.WeatherSync to Snow
elseif GetIsCurrentWeather ThunderstormInterior :
set aWeatherSyncQuest.WeatherSync to Thunderstorm
endif
set aWeatherSyncQuest.InCell to 0
activate
endif
End

 

 

QuestScript, it is just used to store my variables

 

 

 

SCN WeatherSyncQuestScript

ref WeatherSync
short InCell
short Synchronized

 

 

 

Anyone knows what the issue is ?

I looked at some scripted doors from the game that do something before teleporting the player but they don't seem to have anything more in particular in their script.

 

Thanks a lot

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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