Deleted1489176User Posted March 10, 2019 Share Posted March 10, 2019 Hi guys, I am trying to extend the script "lockExtraLootSCRIPT" for novice locks but so far I am failing miserably for some reason. I extended the script as shown below, compiled the script (no errors) and packed it into an ba2 archive. I also added defined a a loot list to the script attached to the container reference as shown in the Image below.However, novice locked containers still don't contain the items specified in my loot lists but have the default loot. Not sure if my script is wrong or the way I am using the script. It's my first attempt to change a script, but so far everything seemed logical to me. Any help would be highly appreciated! Scriptname lockExtraLootSCRIPT extends ObjectReference LeveledItem PROPERTY pLLI_Loot_Lock_Novice AUTO LeveledItem PROPERTY pLLI_Loot_Lock_Advanced AUTO LeveledItem PROPERTY pLLI_Loot_Lock_Expert AUTO LeveledItem PROPERTY pLLI_Loot_Lock_Master AUTO AUTO STATE startState EVENT OnLoad() IF(SELF.getLockLevel() == 25) SELF.additem(pLLI_Loot_Lock_Novice) ; are we an Advanced lock? ELSEIF(SELF.getLockLevel() == 50) SELF.additem(pLLI_Loot_Lock_Advanced) ; are we an expert lock? ELSEIF(SELF.getLockLevel() == 75) SELF.additem(pLLI_Loot_Lock_Expert) ; are we a master lock? ELSEIF(SELF.getLockLevel() == 100) SELF.additem(pLLI_Loot_Lock_Master) ENDIF goToState("doNothing") ENDEVENT ENDSTATE ; when we're done, do nothing but sit here STATE doNothing EVENT OnLoad() ENDEVENT ENDSTATE Link to comment Share on other sites More sharing options...
DieFeM Posted March 10, 2019 Share Posted March 10, 2019 (edited) You would need to start a new game or test it on a container that has not been loaded in your playthrough. Note that it works only the first time it loads, because it uses goToState("doNothing") and the OnLoad event in this state is called instead. Edited March 10, 2019 by DieFeM Link to comment Share on other sites More sharing options...
Deleted1489176User Posted March 11, 2019 Author Share Posted March 11, 2019 Thank you for your answer. I started a new game, but still don't get expected results. The script is a plain copy of the original one, just with the addition of the novice lock check. I even tried to take the original script and set the advanced check to 25 instead of 50 to see what happens, but the containers still contain the default loot. So question is, is my check for novice lock wrong IF(SELF.getLockLevel() == 25) ? Or am I missing something for my script to work at all? Should the script work already when it is compiled and in DATA\Scripts\ or do I need to do something else?Is there an easy way of checking if a script is called / executed? Link to comment Share on other sites More sharing options...
DieFeM Posted March 11, 2019 Share Posted March 11, 2019 https://www.creationkit.com/fallout4/index.php?title=MessageBox_-_Debug Link to comment Share on other sites More sharing options...
SKKmods Posted March 11, 2019 Share Posted March 11, 2019 HA! I hit the same issue with my autounlock mod, happily I left some notes in the code: "some Novice locks report lock level 0 rather than 25 like Sanctuary house safe" Link to comment Share on other sites More sharing options...
Deleted1489176User Posted March 12, 2019 Author Share Posted March 12, 2019 It seems you're right, it does work with a lock level of 0, but apparently for all containers that I tested with. Problem is, that I cannot distinguish between non-locked and novice locked containers. I even tried to check for IsLocked() but it seems that it also returns 0 when the lock is novice. How did you solve this in your autounlock mod? Link to comment Share on other sites More sharing options...
SKKmods Posted March 12, 2019 Share Posted March 12, 2019 (edited) The CK variously refers to LockLevel 0 as "unlocked" or "novice locked". To bypass this ambiguity, use IsLocked() as the initial filter before GetLockLevel() and then treat zero returns as novice.If (ThisREF.IsLocked() == TRUE) If (ThisREF.GetLockLevel() == 0) ;novice ElseIf (ThisREF.GetLockLevel() == 25) ;novice ElseIf (ThisREF.GetLockLevel() == 50) ;advanced ElseIf (ThisREF.GetLockLevel() == 75) ;expert ElseIf (ThisREF.GetLockLevel() == 100) ;master Endif Endif Edited March 12, 2019 by SKK50 Link to comment Share on other sites More sharing options...
Deleted1489176User Posted March 13, 2019 Author Share Posted March 13, 2019 Works like a charm, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts