NPCVendingSwap
Items v1.3.1

NPCVendingSwap

by bmgjet · updated 7 days ago · 7 downloads · ☆☆☆☆☆ no reviews
NPCVendingSwap banner

NPCVendingSwap allows players to swap their player-owned vending machines to NPC vending machine profiles.

NPCVendingSwap allows players with the appropriate permission to swap their player-owned vending machines to NPC vending machine profiles.

Players can look at a vending machine they own and use /vmswap to select from the available NPC vending machine types. The selected profile is then used whenever players open the vending machine, while the original physical vending machine remains in place.

Features

* 🔄 NPC Vending Machine Swapping

* Convert a normal vending machine into an NPC vending profile.
* Supports the available NPC vending machine prefab types discovered on the server.

* 🏪 NPC Shopkeeper Support

* Detects NPC shopkeeper types and extracts their existing sell orders.
* Shopkeeper-specific inventories and currencies can be reproduced when the profile is opened.

* 📦 Stock Multiplier

* Configure a multiplier for the starting stock of swapped vending machines.
* Useful for servers wanting NPC-style vending machines with increased inventory.

* 🖥️ Dynamic Selection UI

* /vmswap opens a CUI selection menu.
* Available vending machine types are discovered dynamically and presented in a scrollable interface.

* 👤 Ownership Protection

* Regular players can only modify vending machines they own.
* Administrators can modify vending machines regardless of ownership.

* 🧹 Easy Reset

* The Clear option removes the NPC vending profile and restores the vending machine to a normal shop.
* The shop name is reset to A Shop.

* 🔒 Mapped Machine Protection

* NPC-mapped vending machines cannot have their shop name changed through the normal rename functionality.

* ♻️ Automatic Cleanup

* Temporary NPC vending machines are created only while needed and are removed when the player finishes interacting with them.
* Temporary machines are also cleaned up when the plugin unloads.

Commands

/vmswap

Look directly at a vending machine and run:

/vmswap

A selection interface will appear showing the available NPC vending machine profiles.

Select a profile to apply it to the vending machine.

The machine must be owned by you unless you are an administrator.

Permission

NPCVendingSwap.use

Players require this permission to use /vmswap and change vending machine profiles.

Grant Permission

oxide.grant user <player> NPCVendingSwap.use

or:

oxide.grant group <group> NPCVendingSwap.use

Configuration

The plugin currently provides a single configuration option:

{
  "Multiply Stock For Swapped Vending Machines": 1
}

Stock Multiplier

Controls the starting stock applied to swapped NPC vending machines.

For example:

{
  "Multiply Stock For Swapped Vending Machines": 5
}

will multiply the starting stock by 5.

How It Works

NPCVendingSwap dynamically discovers available NPCVendingMachine types when the server starts. It also detects NPC shopkeepers and extracts their configured sell orders.

When a player opens a mapped vending machine, the plugin intercepts the normal vending interface and creates a temporary NPC vending machine using the selected profile. The temporary machine receives the appropriate sell orders and inventory before the player is shown the NPC customer interface.

The temporary machine is removed after the player stops interacting with it, keeping the underlying player-owned vending machine intact.

Supported Special Profiles

The plugin also adds several custom profile types when they are not automatically discovered:

extra
farming
hapisexchange
vehicles
vehicleshigh
travellingvendor

These are added during the vending profile discovery process.

Installation

1. Download NPCVendingSwap.cs.
2. Place it in:

oxide/plugins/

3. Reload the plugin:

oxide.reload NPCVendingSwap

4. Grant players or groups:

NPCVendingSwap.use

5. Look at a player-owned vending machine and use:

/vmswap

Notes

* Only vending machines the player owns can normally be modified.
* Administrators can modify vending machines regardless of ownership.
* The original vending machine is not replaced; NPC vending machines are created temporarily when players interact with a mapped machine.
* Available vending profiles are automatically discovered during plugin startup.
* Shopkeeper sell orders are captured and recreated for supported NPC shopkeeper profiles.