Background for Starfield
Member of the ObjectReference script
voidfunctionAddKeyIfNeeded(ObjectReferenceaLockedRef)Native

Description

Wiki Description

Checks this object's inventory for a key used by the parameter ObjectWithNeededKey. If this object does not have the key, it creates it and adds it to its inventory.

Documentation Comment

Adds a gets the key for the given locked reference and adds it to this reference's inventory


Parameters

  1. ObjectReferenceaLockedRef


Examples

; Creates a key to BobsDoorRef and puts it in BobRef's inventory if BobRef doesn't already have that key in his inventory.
BobRef.AddKeyIfNeeded(BobsDoorRef)

Auto-Generated Example

ObjectReference myObjectReference__aLockedRef

myObjectReference__toCallFunctionOn.AddKeyIfNeeded(myObjectReference__aLockedRef)

Related Pages


Additional References

View this function’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.