Jump to content

Another Global Variables Post


Sabbies

Recommended Posts

Hi everyone! :biggrin:

 

Only started downloading mods for Skyrim about 2 days ago ( :mellow: ) and I've - already - decided to give modding a try for myself, lol.

I'm working on a very simple Riverwood mod ( yes, another one :teehee: ) that reworks little bits and pieces of the village ( an attempt to make it more "realistic" ), adds a wall and a set of gates ( :tongue: ) to the entrances.

My mod differs from others in that it aims to have the gates close from 8pm to 6am, with each opening and closing of the gates accompanied by a horn blow indicating to the villagers ( and anyone inside ) that the village would now be closed; an additional horn blow will sound 30min before the gates are closed. I'm going for a bit of immersion here, the player ( and the NPC's ) will not be able to leave or enter the village between the aforementioned hours; kind of like a lock-down.

 

Now, on to my problem.

 

I'm attempting to retrieve, using GetValue(), the value of GameHours to determine the current time in order to set off what needs to be set off. While I have the outline of the script working, GetValue() ( or even GetValueInt() ) always return 0 ( zero ).

 

I read on another thread ( clicky -> The Other Thread ) that it's more than likely related to save files; however, reloading previous save files didn't make a difference in my case. Apart from starting a game afresh ( followed by using "COC <location>" prior to each load ); does anyone have any other ideas that might help me out?

 

I don't mind having to start a new game if I have to ( I don't have a major character worth saving at this point anyway ) - this problem is just bugging the frogs out of me; I'm a programmer by profession and when I hit a problem I can't figure out I suddenly and quite mysteriously o_O develop a case of OCD, ;D

 

I've included my code if it'll help.

 

ScriptName TimedGateShut extends ObjectReference

GlobalVariable Property GameHour Auto
Float Property SunDown = 20.0 Auto
Float Property SunUp = 6.0 Auto

bool function IsSunDown()
float  TT = GameHour.GetValue()	  
Debug.Notification(TT as string)
if TT > 13
	if TT >= SunDown	
		return TRUE 	
	endif
elseif TT <=  SunUp
	return TRUE
endif
endFunction ; original code by a fellow called Tonycubed2

Event OnInit()	
RegisterForUpdate(10.0)
EndEvent

Event OnUpdate()
If ( IsSunDown() )
	GoToState("CloseTheGates")
Else
	GoToState("OpenTheGates")
EndIf

EndEvent

State CloseTheGates
Event OnBeginState()
	Debug.Notification("CloseTheGates!")
EndEvent
EndState

State OpenTheGates
Event OnBeginState()
	Debug.Notification("OpenTheGates!")
EndEvent
EndState

Edited by Sabbies
Link to comment
Share on other sites

Well GameHour ( Object Window > Miscellaneous > Global ) is set to 8.0000 and although [Constant] is unchecked it doesn't seem as if the value has been updated at all; nevertheless,

GlobalVariable Property GameHour Auto

should still return 8; should it not?

 

Update:

1. Started a new game: "GameHour" returned 0.00~,

2. Played until the completion of Unbound,

3.

set timescale to 15000 

and allowed 6 days to pass, but GameHour continued to return 0.00~,

4. Saved and reloaded, GameHour returned 0.00~.

Edited by Sabbies
Link to comment
Share on other sites

  • Recently Browsing   0 members

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