Jump to content

[LE] Adding new Property mid game but they are equal to "none"


Bluurps

Recommended Posts

I tried to change an existing mod, by adding a FormList property and a Quest property in one of the mod's script, named "MyMainQuest"

 

I added these line :

Scriptname MyMainQuest extends Quest

; the old code of "MyMainQuest"
...
...



; Newly added properties
FormList Property MyMod_ThiefList  Auto
MyScriptQuest Property MyScript_SpawnThief Auto 

On CreationKit :

  • I created a FormList named "MyMod_ThiefList ", and I added a generic bandit and a generic thief npc to this list (in order to spawn them in game later thanks to the mod)
  • I opened CreationKit and I added this new FormList, and the already existing script "MyScriptQuest" to the quest "MyMainQuest" that was already created by the mod I am modifying.
  • I auto-filled these two properties.

 

Finally, I compiled the script and I saved the .ESP of the mod.

 

 

BUT, when I load my last save, where the mod was already present in my save, the modification I did on the script worked, but all the new properties that I added where all equal to "None".

 

Do you know why this is happening and where is the mistake I made ? Thanks !

 

 

EDIT :

 

If I disable the mod, load my last save (where I get the warning that this save used the mod), make a new save, and then re-load the mod on the new save, then every thing works fine and the new properties have the right values. It is weird..

Edited by Bluurps
Link to comment
Share on other sites

Actually, it is not weird. It is behaving per normal.

 

Objects, including quests, that are already loaded in game will use the version of the script stored in memory (i.e. the save file). When the objects need to be loaded again they will then load the script anew and use that version. In the case of quests this will happen when they are started or re-started. For placed objects this will happen when the cell fully resets. For inventory types of objects (weapons, armors, misc objects, etc) this will happen with new instances but never for the existing ones.

 

It is because of this that it is always recommended to test your script changes on new games or if need be with a save that has not seen the mod in question yet.

Link to comment
Share on other sites

So is there any workaround so that I can keep my existing save and still update the newly added properties ?

 

For example, the script "MyMainQuest" where I added these new properties, do I need to do something with it ? And if so, then when ?

 

Also thanks for your post !

Link to comment
Share on other sites

If the quest is one that can safely be stopped and restarted, you could do that in the console. But it would reset everything so if it is a quest that has already been progressed part way through, that would all be lost and might not run properly since other relied on data may not be accurate any longer.

Link to comment
Share on other sites

Actually adding properties to a script, even if the script is already loaded in your save, Is ok to do. Changing or removing properties you can't do.

 

As a simple test, first I put this script on a quest that's start game enabled. ArmorA I set to ArmorDaedricCuirass.

 

Scriptname TM_QuestScript extends Quest 

Armor Property ArmorA Auto 

Event OnInit() 
    RegisterForKey(42) ;left shift 
EndEvent 

Event OnKeyDown(Int keyCode) 
    Debug.MessageBox(ArmorA.GetName()) 
EndEvent

As expected, the Messagebox showed "Daedric Armor"

 

I made a new save, quit the game, then changed the script to this and set ArmorB to ArmorDragonplateCuirass

Scriptname TM_QuestScript extends Quest 

Armor Property ArmorA Auto 
Armor Property ArmorB Auto 

Event OnInit() 
    RegisterForKey(42) ;left shift 
EndEvent 

Event OnKeyDown(Int keyCode) 
    Debug.MessageBox(ArmorA.GetName() + "\n" + ArmorB.GetName()) 
EndEvent

As expected the MessageBox showed

 

"Daedric Armor"

"Dragonplate Armor"

 

I made a new save again, quit the game, changed ArmorA to ArmorDaedricGauntlets in the Creation Kit. I saved the esp, loaded the game, but the message box still said "Deadric Armor" and not "Daedric Gauntlets". ArmorA didn't change to ArmorDaedricGauntlets.

 

When you use Auto Fill All, make sure the properties were actually filled. Check them manually.

Link to comment
Share on other sites

Thanks for the help. I tried to create a new ESP with a new Quest, ticked the "start game enabled" and added your script, but when I start load a clean save, the quest is not even loaded.

 

I tried to make a simpler script that log on the console something, but the game says that the quest does not exist.

 

I unloaded everything, just keeping the base game without any mods, created a new ESP, with a basic quest, but even then when I type in console "startquest {MyQuestId}" it says it doesnt exist. Even though I ticked the "start game enabled".

 

Did I miss something to make it works ? Sorry its my first time creating a mod.

Edited by Bluurps
Link to comment
Share on other sites

Thanks ! It was disabled in my vortex app, but the esp was still in the data folder, so I dont understand why skyrim didnt recognize the quest.

 

Since then I enabled it in vortex, now Skyrim can find the quest, because these commands works :startquest {MyQuestId}, stopquest and resetquest.

 

But now another problem (it wont stop sorry), I attached this script in the quest :

Scriptname newscriptTestQuest extends Quest  
{test}

Event OnInit()
    Debug.Trace("OnInit newscriptTestQuest Trace")
    Debug.MessageBox("OnInit newscriptTestQuest MessageBox")
    Debug.Notification("OnInit newscriptTestQuest NOTIFICATION")
EndEvent

Event OnPlayerLoadGame()
    Debug.Trace("OnPlayerLoadGame newscriptTestQuest Trace")
    Debug.MessageBox("OnPlayerLoadGame newscriptTestQuest MessageBox")
    Debug.Notification("OnPlayerLoadGame newscriptTestQuest NOTIFICATION")
EndEvent

But nothing is showing up, not in console, or in notification or message box. Even when I save and reload, or start a new game.

Link to comment
Share on other sites

@ dylbill


Do you say that it's completely safe to keep building a script on an existing 'Save File' without changing/removing anything from original script, but only adding to it.


I've never test it because i always "Bake Scripts" in the save file once they are finished, and i've never change / edited any scripts on any mod's update without informing the player that he needs to install that version on a 'Clean Save' (if scripts have been edited).

Plus i always took this approach for security reasons.


I'm asking cause lately, and with the holidays coming, i'm in the mood again to start modding and i've 2 scripts which i've some 'Extra Stuff' i would like to add.

My initial idea was to make a new script with a different name to avoid any script malfunction on existing / playing 'Save Files', but they have so many stuff to fill in/assign.... that if what you say is 100% bulletproof, i'll take it!!!


* I haven't read the whole post, my eyes just landed on one of dylbill's posts.


Thanks in advance.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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