Quick question - how would I trigger something in an Oxide plugin from a specific switch built into a custom map?
For example if I wanted to broadcast a message in chat when someone hits a specific red button built into the map.
Thanks in advance.
Trigger plugin from specific switch entity
You would need to scan the xyz to get the swtich and log it on plugin load then look at https://umod.org/documentation/games/rust#onswitchtoggle for a list of hooks.
Thanks Razor, I was afraid that was the case - I was actually hoping that there would be some way I could do this that didn't depend on the button being at a specific location each wipe...
If the button is at a consistent relative position, such as relative to a monument, then the logic could go something like this.
- Determine whether it's a Monument button/switch, which it probably is if it has OwnerID 0 and is not parented to another object.
- Get the nearest monument, by comparing the distance to each monument in TerrainMeta.Path.Monuments. If the closest distance exceeds a value you configure, then assume the button is not at a monument.
- If the button is at a monument, compute the position relative to the monument, and verify that the relative position is what you expect, or within a particular tolerance.
- If the button matches, do something special.
It's worth mentioning that since it's a custom map, the button position shouldn't change across wipes, so relative positioning is of questionable value.