Jump to content

Old script persistency in new game?


Hoamaii

Recommended Posts

Hi guys,

 

I'm working on a a new scripted mod which I test two ways: on a fresh new game, then on heavily modded old saves to check for conflicts.

 

While testing on a new game with only my mod enabled, I got a log warning after modifying my script to change a property. Actually I started a "new game" the dirty way this time by coc to my test cell from the game loading screen.

 

The script is a very simple one, attached to a non-Vanilla unique reference, BUT I did not change its name between modification.

 

Here goes the original script:

Spell Property BlessingSpell  Auto
Message Property BlessingMessage  Auto 

Event OnActivate(ObjectReference akActionRef)
	if (akActionRef == Game.GetPlayer())
		Utility.Wait(3)
		BlessingSpell.Cast(akActionRef, akActionRef)
		BlessingMessage.Show()
	endif
EndEvent

I decided to transfer the spell casting to a furniture reference, and use my old activator to activate that linked furniture marker. Here goes the modified script on the old activator:

; Spell Property BlessingSpell  Auto
; Message Property BlessingMessage  Auto 

ObjectReference MyLinkedRef

Event OnActivate(ObjectReference akActionRef)
	if (akActionRef == Game.GetPlayer())
		MyLinkedRef = GetLinkedRef() as ObjectReference
		MyLinkedRef.Activate(Game.GetPlayer())
;		Utility.Wait(3)
;		BlessingSpell.Cast(akActionRef, akActionRef)
;		BlessingMessage.Show()
	endif
EndEvent

Now the spell gets casted twice (that was not intended), once by the initial version of that script (obviously still running), and a second time by the furniture marker (that IS intended) which now casts the spell. Which means the old script is still running and casting the blessing, and the new version of same script is running too since it does activate the furniture marker.

 

And I get this warning in Papyrus:
Warning: Property BlessingSpell on script HDS_BlessingActivatorScript attached to (77005A9E) cannot be initialized because the script no longer contains that property. (same warning about the BlessingMessage property too).

I guess I can fix it by renaming the script but what I don't understand is:

 

1. How can an old script show persistency in a new game which is supposed to load fresh of modded scripts (not loading any previous save)?

 

2. How can an old version of one single script run simultaneously to its new version?

 

Not really a very serious issue but I'm trying to create a mod with as little script latency and persistence as possible and I'd really appreciate it if one of you scripting wizards guys could help me undestand what's going on here...

 

Many thanks in advance to whomever will enlighten me... :smile:

 

Cheers,

 

Hoamaii

 

 

PS. Not eaxtly relevant, but I wanted to hide these scripts as spoilers, but I can't find the spoiler button on the tool bar anymore...

Link to comment
Share on other sites

That warning you posted is not from an old instance of the script within a new game. Rather it is because you removed a property from the script but did not update the form that contained said script. The form still has the non-existent property within its record. Simply open the record and click on the properties button to refresh the form's data.

 

As far as the spoilers, you can either manually type it in [spoiler-]*content here*[/spoiler-] without the "-" or you can click on the green and white button at the top left next to the font box and locate the spoiler tag option there.

Link to comment
Share on other sites

Thanks for replying, IsharaMeradin :).

 

Yeah, that's most probably my mistake - it may very well be that I did not open the properties tab after modifying that script as the only objectReference I added was a linkedRef... I'll make you and check that, thanks!..

 

I still don't get why the script was still casting the spell even though that function was preceded with " ; "... Any idea?

 

Cheers!

Link to comment
Share on other sites

Well, unless I misunderstood what you meant by "open the record" (sorry, English not my native language, not sure what a "record" is) - what I did was reopen the script tab properties window on the reference, checked all properties were cleared, clicked OK, saved.

 

But the same issues are still there.

Link to comment
Share on other sites

OK, so I solved the second issue at least:

 

- about the Blessing being casted twice: I had forgotten some FurnitureMarkers react like they are being activated twice in the same scene: the first time when the player does click on the "activate" button to enter the animation and a second time when the player gets up (using the forward key - but not actually clicking on anything) to exit the animation. I call this "the silent activation" as a reminder. I tried to replace the "OnActivate" event from the FurnitureMarker script by an "OnSit" event, but that did not work, so I ended up using a bool variable - now at least the blessing is only casted once, just on the animation enter, not on the animation exit.

 

I never could get "OnSit" to work on a FurnitureMarker by the way - is this function not working, or is just not supposed to be used on Furniture? (If not, what else do you "sit" on?)

 

And I'm still getting warnings about the missing properties in my modified script in new games despite various attempts - so I guess I'll just remove and replace it by another scriptname (though I hate it when I don't understand what's going wrong... ;)).

 

 

PS. If anybody's reading this, I hope my "French English" makes some sense...

Link to comment
Share on other sites

You may have more than one record (or form) that contains property information.

 

Consider this:

You apply a script to the base object

You place a reference of that object in a cell

You change the script and remove a property

You run the game

You get two warnings about the script no longer containing the property

 

Why?

The script is stored on the base object but also on the reference of the object.

 

To resolve,

open the properties window on the base object and also on the reference object.

This resets the form(s) to the current status of properties rather than relying on previous stored properties.

Link to comment
Share on other sites

Thanks a lot again, Ishara, for putting up with my questions, that's very patient of you :).

 

That's how I had understood it in the first place (thanks for making it super-clear anyway!.. it DOES help) and how I had done it - BUT it occured to me afterwards that I had been checking my log records in a Papyrus Viewer utility, not directly in the "MyGames\Skyrim\logs" directory. It happened before that Papyrus Log Viewer sometimes does not search errors in the last log save, but may come up with log 1, 2 or 3 results - meaning the error might have been corrected but my log Viewer was not showing it as fixed yet.

 

To make sure, I'll reload my mod version with the culprit script and properties, reset properties in both form and reference as you advice, and check for warnings directly in my log directory this time.

 

Will do that tonight. Very grateful to you for helping me understand all this :D.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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