Difference between revisions of "BlockActivation - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
 
imported>Icecreamassassin
Line 29: Line 29:


== Notes ==
== Notes ==
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 - ObjectReference|OnActivate]] block will still run.
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 - ObjectReference|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 - ObjectReference|OnActivate]] block will not affect the current activation.
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 - ObjectReference|OnActivate]] block will not affect the current activation.

Revision as of 13:16, 2 December 2015

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

Function BlockActivation(bool abBlocked = True) native

Parameters

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

Return Value

None.

Examples

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


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

Notes

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.

Also, 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)

Note that BlockActivation does not disable the 'Activate' UI prompt on the object.

See Also