AddKeyIfNeeded - ObjectReference

Revision as of 14:29, 21 April 2025 by BellCube (talk | contribs) (Correct Parameter Name (aLockedRef --> ObjectWithNeededKey))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Member of: ObjectReference Script

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.

SyntaxEdit

Function AddKeyIfNeeded(ObjectReference ObjectWithNeededKey)

ParametersEdit

  • ObjectWithNeededKey: The reference that is locked with a key. It will create a key to this object and add it to the calling object if the calling object doesn't already have one.

Return ValueEdit

None.

ExamplesEdit

; 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)

See AlsoEdit