# Linking Multiple Switches to the same On Interacted Event

Duplicated Switches will inherently share the same object reference and will all trigger On Object Interacted nodes that are attached to that reference. On Object Entered/Exited Area event and On Object Damaged event will only trigger on the original object and not on the duplicates. On Interacted seems to be the unique event that works regardless.

It is possible to duplicate an object by setting it to respawn on disturbance and repeatedly moving it through scripting to make multiple instances of the same object. The minimum respawn timer is 1 second but the game takes 1.5-2 seconds to consider the object disturbed, so a 3 second wait after each movement action is necessary to allow the next object to spawn.

For an object to properly duplicate using this method, one must first go to the object properties and scroll down to the spawning section. Set the Respawn option to On Disturbance. On Death/Deletion means that only one instance of the object will exist, whereas anything else implies that multiple instances of the object can exist.

Since all duplicates of an object are considered the same object in scripting, area monitors must be used to specify which duplicate is being targeted. An area monitor will only recognize one duplicate, but it will only target duplicates within its boundary.

To narrow down which switch is being activated, a proxy object such as a pointer can be used at each switch's location to do a simple vector calculation. The position of the activating player is subtracted from the position of each proxy object, and the resulting vector's length is obtained. The lengths are compared to see which switch was activated.

This method is only more efficient than using a Custom Global Event at 16+ switches (11+ if you don't calculate which switch is being activated). As far as lists go, any overlap automatically merges into one object, but if they are in separate lists (such as those generated by an area monitor), then that object is unique to that duplicate.

Note that this method is considered an exploit.

**Contributors**

Captain Punch\
All Seeing Sage\
Mathad0115


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wiki.thescriptersguild.com/knowledge/scripting/guides-and-info/patterns/linking-multiple-switches-to-the-same-on-interacted-event.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
