Jump to content

Extending lockExtraLootSCRIPT


Recommended Posts

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

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 by DieFeM
Link to comment
Share on other sites

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

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

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 by SKK50
Link to comment
Share on other sites

  • Recently Browsing   0 members

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