Jump to content

Updating a mod (properties and stuff)


Joubarbe

Recommended Posts

Hi,

 

I'm stuck with this problem for a while now, and I'm tired of asking to do a clean install every time I update my mods. I didn't see any solid tutorial about the subject on the wiki, except the notes on savegames (but it's not clear imo).

Well, here is the problem : if I change a property (Auto) value from A to B, the A is kind of linked to the savegame and I never see the B. For example, if I declare a "GlobalVariable Property GVTest Auto" and change it from 1 to 2 (in the editor), I will still see this GV with a value of 1, unless I start a new game.

I see a lot of mods here that update without problem, and I really don't see how to do a clean update of my mods :( Same things for scripted furniture, that won't move if I move them into the CK between two versions.

 

Thanks.

Link to comment
Share on other sites

You could add a quest with your mod update that is set to run only once that has an attached script that updates the global variables in the user's game.

 

Bethesda did something similar with a few of their patches. They had a run-once "quest" with a single script attached. You can find them in the CK if you want examples to go by.

Link to comment
Share on other sites

Yes I saw that for Global Variables. But still, there are many other things that won't update, like all local properties.

 

EDIT : and there's another question related to that one. Some properties (bool as far as I know) are reset to their default value when the cell is reset. So what is the best way to set a "one-time" value ?

 

For example, I have to set the variable "iMoneyToCollect" at 100 on an ObjectReference. I did this :

 

 

 

 









Event OnLoad()
    
    BlockActivation()
    if bTimerSet == false
        iMoneyToCollect = 100
        bTimerSet = true
    endif

EndEvent
 

Problem is : bTimerSet is reset every time the cell resets if I set it to "False" in the editor. If I clear the value and keep the <Default> state in the editor, bTimerSet do not reset when the cell reset, but do reset when I reset the objectreference itself (here, an actor). The thing is to update some other values, like manually defined INT properties, the only solution I found is to reset the actor. (EDIT : hmm I'm probably wrong here, but it's really a mess and I don't get it. If a cell reset always reset my "bTimerSet", how to maintain its scripted value... ?)

 

Creation Kit is really weird :smile:

 

EDIT 2 : I used an OnInit() Event and an "active state" to set my iMoneyToCollect value, but that's not working either.

Edited by Joubarbe
Link to comment
Share on other sites

The only ways I know of to make bTimerSet persistent are (1) make it a global or (2) make it the property of a quest that is persistent.

 

One the second one, as an example, I have a mod that has vats where you can make different sorts of dairy products. The script on the vat has to keep up with what and how many units are in the vat, what is being made, and how long until the next step is done. It worked fine until you left the creamery and returned, at which point everything was forgotten. So, I created a quest that is silent, runs automatically, and has a script attached that has as properties the vat variables I just mentioned for six different vats. The scripts on the vats now update those quest variables, so they are persistent.

 

The quest also does a few other things for me behind the scenes. Otherwise, I would probably just use global variables in this example.

Link to comment
Share on other sites

Here is an example of a timer script that is attached to an objectreference. This is attached to the cows of the creamery and controls the milking. It actually DOES work in the way expected: One milked, the cow does not produce milk again until the next milking time window.

 

Scriptname _NLCMilkingScript extends ObjectReference  

MiscObject Property _NLCMilkPail Auto

Float fTimeLastActivated
Float fCurrentTime 
Float fCurrentHour

Event OnActivate(ObjectReference akActionRef)
	fCurrentTime = Utility.GetCurrentGameTime()
	fCurrentHour = (fCurrentTime - Math.Floor(fCurrentTime)) * 24
	If fTimeLastActivated < (fCurrentTime - 0.125)
		If (fCurrentHour <= 8 && fCurrentHour >= 5) ; between 5 and 8 am
			akActionRef.AddItem(_NLCMilkPail, 1, 0)
			fTimeLastActivated = fCurrentTime
		ElseIf  (fCurrentHour <= 20 && fCurrentHour >= 17) ; between 5 and 8 pm
			akActionRef.AddItem(_NLCMilkPail, 1, 0)
			fTimeLastActivated = fCurrentTime
		Else
			;Debug.Notification("It is not milking time.")
		EndIf
	Else
			;Debug.Notification("Already milked today.")
	EndIf
EndEvent
Link to comment
Share on other sites

Thank you for your answers LP1. However, I found another solution : Encounter Zone. I attached an Encounter Zone with a No Reset flag to my references. It took me the day to find out but this way, I keep my thousand lines of code.

I know it is written on the wiki, but first I had to understand how Skyrim reset things.

 

Now the problem is I can't update my mod ^^' Because if you reset your reference, you reset the properties and validate the changes, and as far as I know, it's the only way to do that (I'm pretty sure there are other solutions).

Link to comment
Share on other sites

  • Recently Browsing   0 members

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