Custom Loot Spawns

Oxide Custom Loot Spawns 1.0.0

Sign in to download
This plugin allows placing spawn points for extra loot, where you can spawn different crate prefabs of your choosing, control their spawn frequency, and set the likelihood of each one spawning. It's ideal for custom maps or hosting events.








Permissions

  • customlootspawns.admin - Allows access to all commands for managing spawn groups, spawn points, and prefabs.

Console Commands

  • cls.spawngroup create <alias> - Creates a new spawn group with the given alias.
  • cls.spawngroup edit <alias> - Edits an existing spawn group.
  • cls.spawngroup remove - Deletes the currently edited spawn group.
  • cls.spawngroup set <property> <value>- Updates a property of the current spawn group. Below is a detailed list of supported properties and the expected values:
    • active <true/false> - Enables or disables the spawn group.
    • initialspawn <true/false> - Determines if loot containers should spawn immediately when the group is active.
    • maxpop <int> - Sets the maximum number of loot containers allowed in the group.
    • minspawn <int> - Specifies the minimum number of loot containers to spawn per tick.
    • maxspawn <int> - Specifies the maximum number of loot containers to spawn per tick.
    • mindelay <float> - Sets the minimum delay in seconds between spawn ticks.
    • maxdelay <float> - Sets the maximum delay in seconds between spawn ticks.
    • randrot <true/false> - Randomizes the Y rotation of loot containers when spawned if enabled.
    • replacelooted <true/false> - Automatically replaces looted containers with new ones if enabled.
  • cls.spawnpoint add <position> [radius]- Adds a spawn point to the current group.
    • <position> - The exact coordinates or use here for the player's current location.
    • [radius] - (Optional) Radius for randomization around the spawn point. A value of 0 spawns crates exactly at the center.
  • cls.spawnpoint remove [spawnPointId] - Removes a spawn point by its id if provided, or automatically deletes the nearest spawn point to the player if no id is given. Simply stand close to the spawn point to easily remove it.
  • cls.prefab add <shortPrefabName> [weight]- Adds a loot container prefab to the spawn group.
    • <shortPrefabName>- The short name of the loot container prefab to add. (See Crate Prefabs for the full list of available crate names.)
    • [weight] (Optional) - Determines the probability of this prefab being selected relative to others. Higher weights increase selection likelihood.
  • cls.prefab remove <shortPrefabName> - Removes a prefab from the spawn group by name.

Crate Prefabs

Here is the complete list of crate prefabs you can add using the cls.prefab command:
  • junk
  • military
  • elite
  • medical
  • food
  • ammo
  • explosives
  • foodbox
  • tools
  • vehicleparts
  • waterammo
  • watermedical
  • waterfood
  • waterfoodbox
  • waterfuel
  • watertechparts
  • hackable
  • hackableoilrig
  • bradley
  • patrolheli
  • supplydrop
  • barrel
  • barrelblue
  • barreloil
  • barreldiesel

Prefab Weights

The prefab weight is used to determine the likelihood of a particular prefab being selected for spawning, similar to a weighted lottery system. See the examples below to understand how it works in practice:
  1. If you assign the same weight to every prefab, they all have an equal chance of spawning:
    • junk (weight: 1)
    • military (weight: 1)
    • elite (weight: 1)
  2. You want more junk crates and fewer military and elite crates:
    • junk (weight: 5)
    • military (weight: 2)
    • elite (weight: 1)
  3. You want elite crates to be very rare compared to the rest:
    • junk (weight: 10)
    • military (weight: 3)
    • elite (weight: 1)

Stored Data

JSON:
{
  "Alias": "exampleGroup",
  "Id": "7a6b8c2e-5f34-4321-b8c1-d8b8faba8746",
  "Active": true,
  "Maximum Population": 10,
  "Minimum Number To Spawn Per Tick": 1,
  "Maximum Number To Spawn Per Tick": 3,
  "Initial Spawn": true,
  "Minimum Respawn Delay Seconds": 30.0,
  "Maximum Respawn Delay Seconds": 60.0,
  "Randomize Y Rotation": true,
  "Replace Looted Containers": true,
  "Prefabs": [
    { "Prefab": "junk", "Weight": 2 },
    { "Prefab": "medical", "Weight": 1 }
  ],
  "Spawn Points": [
    {
      "Id": "0e7c6168-e400-46ba-ade9-717a0a5a3bee",
      "Position": { "x": 100.0, "y": 10.0, "z": 50.0 },
      "Rotation": { "x": 0.0, "y": 0.0, "z": 0.0 },
      "Radius": 5.0
    }
  ]
}

Localization

JSON:
{
  "NoPermission": "You don't have permission to use this command.",
  "SpawnGroup.Usage": "Usage: cls.spawngroup <create/edit/remove> or cls.spawngroup set <property> <value>",
  "SpawnGroup.CreateUsage": "Usage: cls.spawngroup create <alias>",
  "SpawnGroup.CreateAlreadyExists": "Spawn group with alias '{0}' already exists.",
  "SpawnGroup.Created": "Spawn group '{0}' created and selected for editing.",
  "SpawnGroup.EditUsage": "Usage: cls.spawngroup edit <alias>",
  "SpawnGroup.NotFound": "Spawn group '{0}' not found.",
  "SpawnGroup.Edited": "Spawn group '{0}' selected for editing.",
  "SpawnGroup.NoGroupBeingEdited": "You must edit a spawn group before removing it.",
  "SpawnGroup.Removed": "Spawn group '{0}' removed successfully.",
  "SpawnGroup.UnknownCommand": "Unknown command '{0}'.",
  "SpawnGroup.Set.NoGroupBeingEdited": "You must edit a spawn group before setting its properties.",
  "SpawnGroup.Set.Usage": "Usage: cls.spawngroup set <property> <value>\n\nAvailable properties:\n{0}",
  "SpawnGroup.Set.InvalidActive": "Invalid value for 'Active'. Please enter 'true' or 'false'.",
  "SpawnGroup.Set.InvalidInitialSpawn": "Invalid value for 'InitialSpawn'. Please enter 'true' or 'false'.",
  "SpawnGroup.Set.InvalidMaximumPop": "Invalid value for 'MaximumPopulation'. Please enter a non-negative integer.",
  "SpawnGroup.Set.InvalidMinimumSpawn": "Invalid value for 'MinimumNumberToSpawnPerTick'. Please enter a non-negative integer.",
  "SpawnGroup.Set.InvalidMaximumSpawn": "Invalid value for 'MaximumNumberToSpawnPerTick'. It must be an integer greater than or equal to 'MinimumNumberToSpawnPerTick'.",
  "SpawnGroup.Set.InvalidMinimumDelay": "Invalid value for 'MinimumRespawnDelaySeconds'. Please enter a positive number.",
  "SpawnGroup.Set.InvalidMaximumDelay": "Invalid value for 'MaximumRespawnDelaySeconds'. It must be a number greater than or equal to 'MinimumRespawnDelaySeconds'.",
  "SpawnGroup.Set.InvalidRandomRotation": "Invalid value for 'RandomizeYRotation'. Please enter 'true' or 'false'.",
  "SpawnGroup.Set.InvalidReplaceLootedContainers": "Invalid value for 'ReplaceLootedContainers'. Please enter 'true' or 'false'.",
  "SpawnGroup.Set.UnknownProperty": "Unknown property '{0}'.\n\nAvailable properties:\n{1}",
  "SpawnGroup.Set.PropertyUpdated": "Property '{0}' set to '{1}' for spawn group '{2}'.",
  "SpawnGroup.Done.NoGroupBeingEdited": "You must edit a spawn group before finishing editing.",
  "SpawnGroup.Done.FinishedEditing": "Finished editing spawn group '{0}' and applied changes.",
  "SpawnPoint.Usage": "Usage: cls.spawnpoint <add/remove> <position> [radius]",
  "SpawnPoint.NoGroupBeingEdited": "You must edit a spawn group before managing spawn points.",
  "SpawnPoint.Add.Usage": "Usage: cls.spawnpoint add <position> [radius]",
  "SpawnPoint.Add.InvalidPosition": "The selected position is invalid. Please choose a position on a valid surface.",
  "SpawnPoint.Add.InvalidRadius": "Invalid radius. Please specify a valid number.",
  "SpawnPoint.Add.RadiusNegative": "Radius cannot be negative.",
  "SpawnPoint.Add.Success": "Spawn point added with id '{0}', radius {1} at position {2}.",
  "SpawnPoint.Remove.NotFound": "No spawn point found with id '{0}'.",
  "SpawnPoint.Remove.NoInRange": "No spawn point found within range.",
  "SpawnPoint.Remove.Success": "Spawn point with id '{0}' at position {1} removed.",
  "SpawnPoint.UnknownSubcommand": "Unknown subcommand '{0}'. Valid options are 'add' or 'remove'.",
  "Prefab.Usage": "Usage: cls.prefab <add/remove> <shortPrefabName1> [weight1] <shortPrefabName2> [weight2] ...",
  "Prefab.NoGroupBeingEdited": "You must edit a spawn group before managing prefabs.",
  "Prefab.Add.UnrecognizedPrefab": "The prefab name '{0}' is not recognized. Please use one of the following valid names:\n{1}",
  "Prefab.Add.AlreadyExists": "Prefab '{0}' is already in the spawn group.",
  "Prefab.Add.InvalidWeight": "Invalid weight for prefab '{0}'. Defaulting to weight 1.",
  "Prefab.Add.Success": "Added prefabs:\n- {0}",
  "Prefab.Add.NoneAdded": "No prefabs were added.",
  "Prefab.Remove.NotFound": "Prefab '{0}' not found in the spawn group.",
  "Prefab.Remove.Success": "Removed prefabs:\n- {0}",
  "Prefab.Remove.NoneRemoved": "No prefabs were removed.",
  "Prefab.UnknownSubcommand": "Unknown subcommand '{0}'. Valid options are 'add' or 'remove'."
}

Developer API

C#:
void API_ForceSpawnLootContainers(string spawnGroupAlias)
  • Force spawns loot containers for the specified spawn group.
C#:
void API_ForceClearLootContainers(string spawnGroupAlias)
  • Clears all loot containers for the specified spawn group.
C#:
bool API_IsLootContainerCustomSpawned(LootContainer lootContainer)
  • Checks if the loot container was spawned by this plugin.
C#:
bool API_SpawnGroupExists(string spawnGroupAlias)
  • Checks if a spawn group with the given alias exists.

Developer Hooks

C#:
object OnCustomLootContainerSpawn(string spawnGroupAlias, string prefab, Vector3 position, Quaternion rotation)
  • Called before a loot container is spawned. Useful for modifying the spawn position, replacing the prefab, or stopping the container from spawning entirely.
  • Returning false cancels the spawn.
  • Returning null allows the default behavior.
Author
VisEntities
Downloads
10
First release
Last update

Ratings

0.00 star(s) 0 reviews

Also by VisEntities

Back
Top