Jump to content

Recommended Posts

Posted

Hi guys,

 

Here's my issue:

 

I have an activator placed in the world activating a hidden container. The visible activator triggers an animation and activates the container. There's another script on the container which triggers some events "OnClose" after the player has picked up some specific items, then once done, gets the player back to "IdleStop_Loose". It all works fine as long as the player can actually open the container which is initially locked.

 

My problem is if the player for some reason cannot open the container, he remains stuck in animation and has to jump to get out of it. I'm looking for a way for my scripts, either on the visible activator or on the hidden container to detect whether or not the player has managed to open (and as a consequence, close) that chest. To be more precise, I'm looking for a way to detect that the player exits the Lockpicking interface after failing lockpicking - which rules out "OnOpen", and I can't use "OnActivate" either because the player actually needs to pick up some items in the container so that I can trigger my "OnClose" events... Ahem, not sure my explanations are very clear, sorry...

 

"OnRelease" does not work (not even sure it could ever work on containers - but I'm in fact not looking for container functions but more for interface functions). Even if I was counting on SKSE, the thing is the player would use to same key to either exit the lockpicking interface after failing or to close the container.

 

I've been trying to think simple, like putting a "Wait" on my first activator which would wait for a reasonable time for the player to try to pick the lock, then automatically release him from animation after a certain amount of time. But that's not very accurate, sometimes the game will skip the wait or shorten it considerably.

 

If any of you guys knows about menu and interface functions, I'd very grateful if you'd care to share your expertise... :).

 

Many thanks in advance and happy new year to all,

 

Hoamaii

Posted

Put this on the script attached to the container itself (i.e. the locked object)

Requires SKSE

Due to the OnInit() event, you'll need to test it on a save that has not seen the container in question at all.

 

  Reveal hidden contents

Posted

Thanks a lot for replying, IsharaMeradin - I hadn't thought of this, I'll just try that :)

 

I was wondering: all but one of my other scripts can do without SKSE, what's the worse that can happen to a user who does not have SKSE installed or running? Get warnings in Papyrus?

 

I'm in the process of testing my mod as thoroughly as I can and I've been trying to test it without SKSE but I must have missed removing some scripts because another SKSE script (using "SetGameSettingFloat") still runs fine when I test it and I don't get warnings.

Posted

If SKSE is not installed, Papyrus will return NULL values for the SKSE functions. This means that if a NULL value could pass the statement then papyrus will pass the statement else it will fail. As far as warning/errors go, it just depends on what it is I suspect.

 

One way to be sure is to use the following snippet to set a local or global variable that you can use throughout your script(s) to allow or disallow SKSE functions.

If SKSE.GetVersion() > 0
  ;SKSE installed
Else
  ;SKSE not installed
EndIf
Posted

I see - thanks again.

 

Other than warning potential users of course, wouldn't the safest way be to use that on a small script that would trigger when the player enters my modded cells for the first time and use the variable to disable my SKSE dependent scripts?

 

Edit: on second thoughts, it's probably another option to use this "OnInit" only on my SKSE scripts?

Posted

If using it to set a value to a global variable...

 

I'd go with a script on the player alias on a start game enabled quest. This way I could run maintenance code to activate the SKSE features if the user decides to install SKSE mid-game.

GlobalVariable Property SKSEInstalled Auto

Event OnInit()
  RunMaint()
EndEvent

Event OnPlayerLoadGame()
  RunMaint()
EndEvent

Function RunMaint()
  If SKSE.GetVersion() > 0
    SKSEInstalled.SetValueInt(1)
  Else
    SKSEInstalled.SetValueInt(0)
  EndIf
EndFunction

If you rely on the OnInit() events of the various individual scripts, you limit yourself to determining if SKSE is installed when these objects are loaded for the very first time. Not a good thing if SKSE is later installed.

 

You either use the maint routine I outline above or simply use the check immediately before using SKSE specific functions. An example of the latter can be found in both my Random Mining and Wood Chopping to Max Carry Weight mods.

Posted

You're very helpful, thanks. The only thing is there are no quests in my mod (at least none till now), it's more or less a playerhouse and I don't need a quest. I was even considering modding the acquisition system of the house without using a quest. I may change this just for this SKSE detection issue.

 

I placed the OnInit() event you suggested on my container as a separate script for testing by the way, it works perfectly, thanks again :).

Posted

FYI - There are quests and then there are quests. One type is the running about and doing things to get some reward. The other type is a record in the Creation Kit that is primarily used to manage the running about style but is also used to manage dialog and to house scripts for various purposes that if assigned to an object would become baked into the save and cause issues when later removed.

Posted

Yes I know that but I truly didn't find any purpose to using a quest for what I did. Every script is associated to unique references of unique objects and none involves actors in any way other the "akActionRef".Keywords are used for properties instead of forms or references. I have not modified any Vanilla reference (or quest) in any way either and cleaned it all with TES5Edit.

 

In my testing, I've installed and uninstalled my mod multiple times, checking my script logs everytime and modifying my scripts in the few times where I found papyrus warnings or errors. This was done both on a new game and on very heavily modded saves.

 

I'm at a state of development where my scripts logs are completely free of any possible remnants or errors of my scripts either when the mod is installed and running, or when it is "widly" uninstalled.

 

Of course, it is always possible that I may have missed something, but at this state of development, it'd take me to redo the whole mod from scratch to turn it into a quest. The reason I did not use quest from the start is to avoid errors when users uninstall before the quest has stopped running - I've seen that happen a hundred times in users' comments. Again, I may have missed something (and I agree, it's very easy to do so) but I've been comforted many times in the fact that scripts running on unique instances of unique references should be cleared when these objects are removed from the game. And so far, at least with my mod, this has proved to be true.

 

Are you telling me I'm taking wild chances here?

Posted

Nope. What you've done is fine for as long as the objects are unique to the mod. If you do find yourself needing to apply scripts to stock objects or objects from other mods, using a quest to alias the object is one possible method.

 

For the record, you wouldn't need to redo your entire mod to utilize a quest that houses some maintenance scripts. You can make the two setups communicate with each other.

  • Recently Browsing   0 members

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