converting oblivion mod to skyrim

Post » Thu Jun 21, 2012 5:27 am

Amethyst Decevier is right... if users manually change their time (INI, console, or another mod) it would mess with your script. I wasn't aware of a reg command you could do with gameTime (I haven't had the need for somethinglike that yet). A simple workaround to this, if you still wanted to use the timeScale method that is, would be to save the currentTimeScale in a variable then change it to 1:1 (or whatever) while in your home (or around your clock). Then switch it back when Player leaves. It's kind of a questionable reach-around but if you can't get the registerGameTime thing to work, you may not have a choice.

JustinOther: Thanks... I thought that's what it would be, but I couldn't find anything in the wiki about it - and I haven't had a need to test it yet. (and yea.. I began modding with Oblivion so that's probably what I remember about the 30:1)

RandomNoob: It may be because time is intended to pass so fast in-game that they never hard-coded it to poll that small an increment... maybe only by the minute. Have you tried changing the timeScale to 1:1 and THEN testing a gameTime script for 'second-hand' capability? If it still doesn't work, it's not the calculations but lack of that small of a recognizable increment.
User avatar
Kieren Thomson
 
Posts: 3454
Joined: Sat Jul 21, 2007 3:28 am

Post » Wed Jun 20, 2012 5:54 pm

RandomNoob: It may be because time is intended to pass so fast in-game that they never hard-coded it to poll that small an increment... maybe only by the minute. Have you tried changing the timeScale to 1:1 and THEN testing a gameTime script for 'second-hand' capability? If it still doesn't work, it's not the calculations but lack of that small of a recognizable increment.

Well this is de-railing the topic, but I think there really is something wrong with RegisterForUpdateGameTime. I hope someone reading this can organize it better and update the wiki with the info.

I tested the function like this:

float UpdateTime = X / YRegisterForUpdateGameTime(UpdateTime)

If both X and Y are integers, and X / Y evaluates to something less than 1, then the game will freeze. If X / Y evaluates to less than some value between 1/41 and 1/42, the game will freeze. The value of TimeScale is irrelevant.

So all these values would cause the game to freeze:

1 / 299 / 1001.0 / 42.00.0238

And these values would be fine:

1 / 15 / 31 / 2.099.0 / 1004 * 51 + 11 - 0.51.0 / 41.00.0244
User avatar
Portions
 
Posts: 3499
Joined: Thu Jun 14, 2007 1:47 am

Post » Wed Jun 20, 2012 9:50 pm

I think some people misunderstood which script I am using. Let me explain: I modified WillieSea's script from Levelers Tower which uses a Quest to make the clock moving all the time. This is my current script:

Scriptname DragonsreachClockQuestScript extends Quest  {Controls Clock Hands}GlobalVariable Property GameHour  Auto  GlobalVariable Property GameDay  Auto  GlobalVariable Property GameMonth  Auto  GlobalVariable Property GameDaysPassed  Auto  ObjectReference Property MinuteHandFront  Auto  ObjectReference Property HourHandFront  Auto  ObjectReference Property MinuteHandLeft  Auto  ObjectReference Property HourHandLeft  Auto  ObjectReference Property MinuteHandRight  Auto  ObjectReference Property HourHandRight  Auto  ObjectReference Property MinuteHandBack  Auto  ObjectReference Property HourHandBack  Auto  float myMAnglefloat myHAngleint myIntfloat mySpeedfloat myDatefloat myMonthfloat myDayint myDaysPassedEvent OnInit()	registerForUpdate(1)	mySpeed = 100EndEventEvent OnUpdate()	myHAngle = GameHour.GetValue()	myInt = myHAngle as int	myMAngle = ((( myHAngle - myInt ) * 100 ) * 3.6 )	if myHAngle >= 13.0		myHAngle = ( myHAngle - 12.0 )	endif	myHAngle = ( myHAngle * 30.0 )	if (MinuteHandFront.Is3DLoaded())		MinuteHandFront.SplineTranslateTo(28105.8848, 1484.0991, 950.8602, 270.0000, 45.0000, myMAngle, 1.0, 1.0, mySpeed)		HourHandFront.SplineTranslateTo(28106.4609, 1485.2988, 951.4893, 270.0000, 45.0000, myHAngle, 1.0, 1.0, mySpeed)	endif	if (MinuteHandRight.Is3DLoaded())		MinuteHandRight.SplineTranslateTo(28431.6914, 1483.7139, 950.8602, -90.0000, -45.0000, myMAngle, 1.0, 1.0, mySpeed)		HourHandRight.SplineTranslateTo(28430.4727, 1484.2573, 951.4893, -90.0000, -45.0000, myHAngle, 1.0, 1.0, mySpeed)	endif	if (MinuteHandLeft.Is3DLoaded())		MinuteHandLeft.SplineTranslateTo(28103.8555, 1815.1019, 950.8602, 90.0000, 45.0000, myMAngle+180, 1.0, 1.0, mySpeed)		HourHandLeft.SplineTranslateTo(28105.0371, 1814.4867, 951.4893, 90.0000, 45.0000, myHAngle+180, 1.0, 1.0, mySpeed)	endif	if (MinuteHandBack.Is3DLoaded())		MinuteHandBack.SplineTranslateTo(28429.6035, 1817.4072, 950.8602, 90.0000, -45.0000, myMAngle+180, 1.0, 1.0, mySpeed)		HourHandBack.SplineTranslateTo(28428.9766, 1816.2299, 951.4893, 90.0000, -45.0000, myHAngle+180, 1.0, 1.0, mySpeed)	endifEndEvent

By discrete movement I mean moving like a second hand on a quartz clock -> bit by bit, and by continuous I mean moving ALL the time -> on normal clock its usually not visible how the hour and minute hands are moving because they are moving continuously (actually they still move discretely but with so high rate that you dont see it with human eye, so it LOOKS LIKE they are moving continuously).

Now I figured that maybe if I made the refresh rate big enough (registerForUpdate(1) --> registerForUpdate(0.01)) it would look like continuous movement, but two thoughts have crossed my mind then:
-> I am not sure if the script is running all the time or only when you are in Whiterun, since it checks if hands are loaded I assume its running all the time, and if I make very high refresh rate it could impact the performance. Not sure if thats true, im only guessing.
-> I could probably make all the clocks in Skyrim I create run from this same script, would that have any performance issues?



You wouldn't want them to update in real time.
Time in Skyrim passes alot faster than normal time. Your minute hand would look like a second hand if it were to keep live Skyrim time.

As for the hands not showing, tick the Is Full LOD box in the objects properties.

Actually it would be a lot better if it updated in real time, reason being it would have the exact opposite effect of what you described as "it would look like a second hand". Clocks in Oblivion updated in real-time and it looked quite nice, it makes it less obvious that time is passing a lot quicker than normal IMO.

Yes, this fixes the problem of "hands not showing", thank you!

As far as your texture issue goes, do you have correct normal maps included for your tex (myTex_n.dds)? That may cause it to appear darker than it should, as it wouldn't be reflecting any light. It may also mess with the AA as well, though I'm not THAT familiar with AA and what it specifically affects.
I am quite sure I included the correct normal maps, I created them myself in photoshop. But just in case I tried removing them from the model and tested, the hands were still pitch black and unAAed:S

Perhaps a video will show the thing better: (curiously only the back face had black hands when I was recording the video (I think this might mean its not the model bug but game bug - or not, hell, I dont know :S), graphical glitches are due to ENB which I didnt use when I was testing the clock before)
http://youtu.be/kg8F98TVU-U
Heres another example of weird behaviour:
[img]http://shrani.si/f/2C/dW/2DBWVsRx/tesv20120426225059514.jpg[/img]
User avatar
Emily Rose
 
Posts: 3482
Joined: Sat Feb 17, 2007 5:56 pm

Post » Thu Jun 21, 2012 4:18 am

Echonite: That's simply NOT true... you cannot use other people's assets unless you get their permission, or the mod uses whatever they call those open license things (like GNU, Creative Commons, etc).
Depends on how you use it. Personal use, no one would even know, so asking for permission is a moot point. For released content, if the construction set and creation kit EULAs are legally binding, then even still, no permission is needed as the content technically belongs to Bethesda.

But I'm not going to dig into this as its been done before. Beating a dead horse is never fun.
User avatar
Samantha Wood
 
Posts: 3286
Joined: Sun Oct 15, 2006 5:03 am

Post » Thu Jun 21, 2012 12:53 am

Terraviper-5: the script you just posted will probably continue to run in the background. I would suggest trying this: change the onInit to onCellAttach. Define a new boolean variable that will act as an on-off switch. Change the regForUpdate to a regForSingleUpdate... then add another one at the end of of the onUpdate event. Now inside the onUpdate you have a return triggered by you on-off switch... which will be set to off in the onCellDetach you should add.

This should start the clock when Player gets in the vicinity, then shut it off when Player leaves again. And of course you can have all your clocks running the same script... or did you mean like having them all operating on a single instance running (instead of the same one, but more than once)? You may have to do this with aliases in a quest... which I'm not too familiar with yet.


Echonite: You're right... personal use is no problem, but sharing or uploading it is. Modding doesn't fall under fair use though, as some people may think. You're also correct that Bethesda has rights to use the content, but I believe the author still retains rights to allow/disallow others BESIDES Bethesda to use them... in ANY event, most every site that hosts mods will ban you if you use others' resources without permission, regardless. That's why I chimed in there... because it sounded like you were misleading someone into thinking they COULD (and not get banned or have it deleted). I also agree about dead horses... but this is The Elder Scrolls - you know everything can be summoned back or resurrected heheheh
User avatar
Claire
 
Posts: 3329
Joined: Tue Oct 24, 2006 4:01 pm

Post » Wed Jun 20, 2012 7:30 pm

I wrote this clock script without ever seeing the code from or even using WillieSea's clocks, so if you want to release a mod with it you're welcome to:

Spoiler
Scriptname ClockScript extends ObjectReference{Script for ticking clock attached to the clock face.}GlobalVariable Property GameHour AutoActivator Property HourHandBase AutoActivator Property MinuteHandBase AutoObjectReference Property HourHand AutoObjectReference Property MinuteHand AutoBool Property IsWallClock = True AutoFunction SetHandsPosition()	Int CurrentHour = Math.Floor(GameHour.Value)	Float CurrentMinute = GameHour.Value - CurrentHour	CurrentHour %= 12	Float[] Angles	if (IsWallClock)		;negative Y is clockwise		Angles = ConvertRotation(0, CurrentHour * -30, GetAngleZ())		HourHand.SetAngle(Angles[0], Angles[1], Angles[2])		Angles = ConvertRotation(0, CurrentMinute * -360, GetAngleZ())		MinuteHand.SetAngle(Angles[0], Angles[1], Angles[2])	else		;flat on the floor		HourHand.SetAngle(0, 0, CurrentHour * 30)		MinuteHand.SetAngle(0, 0, CurrentMinute * 360)	endifEndFunctionFloat[] Function ConvertRotation(Float AngleX, Float AngleY, Float AngleZ, Bool FromLocal = True)	Float NewX	Float NewY	if (FromLocal)		NewX = AngleX * Math.Cos(AngleZ) + AngleY * Math.Sin(AngleZ)		NewY = AngleY * Math.Cos(AngleZ) - AngleX * Math.Sin(AngleZ)	else		NewX = AngleX * Math.Cos(AngleZ) - AngleY * Math.Sin(AngleZ)		NewY = AngleY * Math.Cos(AngleZ) + AngleX * Math.Sin(AngleZ)	endif	Float[] Angles = new Float[3]	Angles[0] = NewX	Angles[1] = NewY	Angles[2] = AngleZ	Return AnglesEndFunctionEvent OnCellAttach()	if !HourHand		HourHand = PlaceAtMe(HourHandBase)		HourHand.MoveTo(Self)	endif	if !HourHand		HourHand = PlaceAtMe(HourHandBase)		HourHand.MoveTo(Self)	endif	SetHandsPosition()	RegisterForSingleUpdate(1)EndEventEvent OnCellDetach()	UnregisterForUpdate()EndEventEvent OnUpdate()	if (Is3DLoaded())		SetHandsPosition()		RegisterForSingleUpdate(1)	endifEndEvent
User avatar
Samantha Jane Adams
 
Posts: 3433
Joined: Mon Dec 04, 2006 4:00 pm

Post » Wed Jun 20, 2012 8:41 pm

Thank you, but does OnCellAttach mean that if I am not in the vicinity of Dragonsreach, the clock wont work? (Because entire Whiterun is made from multiple cells)?
User avatar
Bonnie Clyde
 
Posts: 3409
Joined: Thu Jun 22, 2006 10:02 pm

Post » Thu Jun 21, 2012 3:19 am

I think OnCellAttach is pretty much the same as OnCellLoad. OnCellLoad specifically says that it fires when everything in the cell has been loaded, so maybe that's the difference.

Whether or not the cell is loaded depends on your ini setting for uGridsToLoad.
User avatar
Stephy Beck
 
Posts: 3492
Joined: Mon Apr 16, 2007 12:33 pm

Previous

Return to V - Skyrim