BlockActivation - ObjectReference

From the CreationKit Wiki
Revision as of 23:47, 21 January 2024 by Jadkai (talk | contribs) (→‎Notes: Reorganized section and added note that activation blocks aren't removed if a ReferenceAlias script called it and the alias no longer points at the object.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Member of: ObjectReference Script

Blocks, or unblocks, normal activation processing for this reference. References with blocked activation will still send OnActivate events to scripts attached to them.

Syntax[edit | edit source]

Function BlockActivation(bool abBlocked = True) native

Parameters[edit | edit source]

  • abBlocked: Whether to block or unblock activation.
    • Default: True

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Blocks this door from processing activation normally
MyDoor.BlockActivation()


; Tells the door to handle activation normally
MyDoor.BlockActivation(false)

Notes[edit | edit source]

  • If you block activation on a reference, the reference will no longer perform its "normal" activation processing. It won't be picked up, opened, etc. However, the script OnActivate block will still run, but only on the same script which has the BlockActivation() function set. All other OnActivate() events in other scripts attached to the same reference will be ignored.
  • Because of the way script events work, chances are that the object has already done (or ignored) its default activation processing by the time the script receives the event, so calling BlockActivation() on the object in the OnActivate block will not affect the current activation.
  • If a script calls Activate() on an object reference which has blocked activation, the OnActivate block on that script will run, but the object will not process activation normally. (Unless the default processing only parameter is true)
  • BlockActivation does not disable the 'Activate' UI prompt on the object.
  • If an ObjectReference which has BlockActivation() applied to it is linked to another ObjectReference which can be activated normally, this linked object will instead be activated (confirmed with a BlockActivation() applied to a note object that is linked to a book object, the book object was instead activated)
  • IMPORTANT: If you call BlockActivation from a ReferenceAlias script for an alias that is pointing to an object, the activation block will not be automatically removed when the alias stops pointing at the object (such as when the quest ends).

See Also[edit | edit source]