Asterra Posted December 28, 2017 Share Posted December 28, 2017 (edited) Don't see why this has to be so complicated. I need something to occur when the game is loaded. In Skyrim, this was painless. But now evidently I can only use this function in a "native" script, and such scripts are desperately limited in functionality. For example, I need to jumpstart a StartTimer loop when the game loads. But in a native script, I can't even so much as define a variable... Edit: While I'm asking, it'd also be nice to know why I can't define, load or even locate scripts for use under a reference alias. It has a box for adding a script, but then it doesn't give the option to create a new one, the way for example one can in the quest's script tab. Edited December 28, 2017 by Asterra Link to comment Share on other sites More sharing options...
Reneer Posted December 28, 2017 Share Posted December 28, 2017 One way is using a quest script, a RegisterForRemoteEvent call on the player with "OnPlayerLoadGame", and a Actor.OnPlayerLoadGame event. Link to comment Share on other sites More sharing options...
Asterra Posted December 28, 2017 Author Share Posted December 28, 2017 One way is using a quest script, a RegisterForRemoteEvent call on the player with "OnPlayerLoadGame", and a Actor.OnPlayerLoadGame event. Okay, question from this: Let's say I've got a mod on a game save already, and I want to add said RegisterForRemoteEvent in an update to the mod. What I might normally do here is put it in the OnPlayerLoadGame event. You see the vicious circle I am dealing with. Would also be very keen on knowing why I can't create a new script for an alias in the quest's reference alias tab - the second question in the OP. That would seem to be an important component of your suggested workaround. Link to comment Share on other sites More sharing options...
cadpnq Posted December 28, 2017 Share Posted December 28, 2017 Answered on reddit before I saw your post here. I'll post the code here too: ScriptName Whatever Extends Quest Event OnQuestInit() RegisterForRemoteEvent(Game.GetPlayer(), "OnPlayerLoadGame") EndEvent Event Actor.OnPlayerLoadGame(Actor ActorRef) ; stuff EndEvent Nothing fancy. Exactly what Reneer said. Put that on a quest set to automatically start. Using a quest actually makes adding your code to an already installed mod a non-issue. Assuming you add a new quest and don't stick your code on an already running one. Link to comment Share on other sites More sharing options...
SKKmods Posted December 28, 2017 Share Posted December 28, 2017 (edited) But now evidently I can only use this function in a "native" script, and such scripts are desperately limited in functionality. I don't actually know what a native script is but I do use OnPlayerLoadGame() extensively in my mods with my own scripts to check start conditions when a quest is not start game enabled. Add an alias to your quest for the player say PlayerRef - fill type specific reference Ref PlayerRefAdd a new script say YourQuestName_PlayerRef with a property pointing at your main quest extending scriptCall functions in your main main quest extending script, example: Scriptname SKK_SettingsPlayerRef extends ReferenceAlias SKK_SettingsMainScript Property pSKK_SettingsMainScript Auto Const Mandatory Event OnPlayerLoadGame() pSKK_SettingsMainScript.GiveHolotape("OnPlayerLoadGame") pSKK_SettingsMainScript.StartTimers("OnPlayerLoadGame") EndEvent Add some debug.trace to your main script functions so you can watch it fire in the papyrus debug log with no limitations or drama:[12/28/2017 - 10:55:20PM] SKK_SettingsMainScript.GiveHolotape calledby OnPlayerLoadGame[12/28/2017 - 10:55:20PM] SKK_SettingsMainScript.StartTimers calledby OnPlayerLoadGame Edited December 28, 2017 by SKK50 Link to comment Share on other sites More sharing options...
Recommended Posts