Running a script on locked containers

Post » Fri May 13, 2011 6:39 pm

So, few hours ago i said i'm not a fan of Fallout's arbitrary skill levels for unlocking. That gave me an idea that resulted in a script that modifies the locks level according to player skill, making the minigame easier or harder.

However i'm pretty sure it won't work due to the GetContainer function without attaching the script to every single locked door and container in the whole game, which would be quite stupid way of doing it, if only because of compatibility issues with new mods and DLCs. Can i get the reference by some other means?

Or did i miss an existing script that handles lockpicking already? :unsure:
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Fri May 13, 2011 7:24 am

The only way I can think of would be to do ref walking with NVSE by using GetNextRef etc. Once the script finds a locked container, you now have the ref id to do what you want to it. To keep from modifying the same container, once you do modify it, add it to a formlist and use the check "If ListGetFormIndex rFormList rItem != -1". If the ref has not yet been modified, the form index will be -1 on your formlist.

I think that made sense, best of luck.
User avatar
Tiffany Holmes
 
Posts: 3351
Joined: Sun Sep 10, 2006 2:28 am

Post » Fri May 13, 2011 12:32 pm

I'm a professional programmer, so yes, that makes sense. However i'm a complete noob when it comes to Gamebryo and xSE scripting :blush: Does GetNextRef walk trough the references in the cell the player is in, or in a larger area? Also if the player levels up, it's possible that lockpick skill increases, and the script would have to be run again, which would propably require constantly running script that would use resources and mess up during quickloads :shrug:

What i would like is that the script is run when the player enters the lockpick minigame, "Begin menumode If menumode==1014", but if it isn't possible to get the reference of the object player used, that won't work.
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Fri May 13, 2011 9:00 pm

What i would like is that the script is run when the player enters the lockpick minigame, "Begin menumode If menumode==1014", but if it isn't possible to get the reference of the object player used, that won't work.


I played around with it using the console and to do that, this script should work attached to a quest with a short delay:

ref rObjectshort sWaitingBegin GameModeIf sWaiting == 1Set sWaiting to 0endifEndBegin MenuMode 1014If sWaiting == 0 ;prevents the script from running more than once per sequenceSet sWaiting to 1Set rObject to GetCrossHairRef;Do whatever you want to the objectendifEnd


The bad news is I'm pretty sure that once you enter the minigame, the lock level is set. Even if you change it while in menumode 1014, it won't update until you leave the minigame. I just tested this out using the console, so maybe a script that runs immediately when the minigame opens would work...
User avatar
Gemma Woods Illustration
 
Posts: 3356
Joined: Sun Jun 18, 2006 8:48 pm


Return to Fallout: New Vegas