• Plugin Information
  • 276 subscribers
  • Verified
  • Complete
  • Clockwork
  • Version: 9
    Upload Date: 02.09.15
    Fixed the fix because I derped again
  • Download
  • You need to login to download plugins to your server!
    ItemSpawner v2 by Gr4Ss

    An item spawner to spawn random items on the map. This is version 2 of my item spawner, featuring the same spawning algorithm at the core, but with lot's of polish and goodies added.

    An overview of the features:

    • Optimization. When it runs, it does so as efficiently as possible. It does a very good job at minimizing the impact of having having a lot of players on the server, having lots of items spawner or having a large list of items to pick from. This item spawner is made to be efficient.
    • Ease of use. By using item types (five included by default, but adding more isn't too hard if you know how to make a table in Lua), it's easier to control how much of what spawns. As you can set how much chance each type has to spawn, you can easily ensure people don't end up with too much of one thing, and not enough of another.
    • Rare items. Rare items can be 'uncommon' if you want them to be, but at the same time they can also be -rare-. By using a separate table for rares, that has to pass a roll to be selected, you first off all control how often it tries to spawn a rare item. Tries to as it still has to select a rare item after that, then pass a second roll for that item.
    • Resizable spawn areas. When creating an item spawnpoint, you are actually defining a rectangular area. You decide yourself how long and wide the rectangle is, allowing you to nicely cover areas and avoid having items always spawn in the exact same spot.
    • Resizable no-spawn radius. Each area also has a 'no-spawn radius' associated with it. If a player is within the sphere defined by this radius, then no items will spawn on that point. As this counts as a 'failed' attempt to spawn an item, and it will not keep on trying until something works, I've made the area resizable. If you want it to be less strict (because people often are on the floor above, or on the other side of a wall), you can do so. If you want it to be more strict (because it's in the middle of nowhere), you can make it bigger. Note: on the ESP this radius is shown as a square on the x/y axis, keep in mind it goes along the z axis as well and actually is a sphere.
    • Admin ESP: to show you where the spawnpoints are, the rectangle that items spawn in and to give you an idea of the no-spawn radius. This makes setting up the spawns easier than ever!
    • Item decay: old spawned items that haven't been picked up yet will be removed. This only happens after a map restart (which a server does automatically when it's empty). This keeps lost items from clogging up the maximum spawn count.
    • Persistent through map reloads: it has no problem whatsoever with map reloads. It won't bug up the count, it won't stop it from tracking which items it spawned, it'll just reset the spawn interval.
    • Every parameter can be set from the config. They all have their explanation as to what they do added, so they should explain themselves. Else contact me.
    • Logging. It has it's own logging into separate files, this makes keeping track of what it does a trivial task.

    How to set this up:

    • Add in the spawnpoints (must be an SA). /ItemSpawnerAdd is the command for this, /ItemSpawnerRemove to remove on, /ItemSpawnerToggleESP to turn on the ESP. These commands are in the directory with all their arguments, so read up on them there.
    • Setup the items. You need to add one of these two options:
      • Add 'ITEM.spawnValue = [value];' and 'ITEM.spawnType = [type];' to the item file.
        • [value] is an integer equal to or larger than 1. See this value as an amount of tickets each item gets. When an item is needed, all tickets of items with the same type are thrown into a bowl, and a random ticket is picked. More tickets = higher chance to spawn compared to an item with less tickets. All items must obviously at least have one ticket, and can be given pretty much as many as you want (the total sum of tickets just can't exceed the maximum value of an integer).
        • [type] is one of the five types ("misc", "consumable", "crafting", "junk", "medical"). Each type has an amount of tickets as well to determine of which type an item is spawned. You can add/remove/adjust types in the sv_plugin.lua file to suit your needs.
      • Add 'ITEM.spawnValue = [value];' and 'ITEM.isRareSpawn = true;' to the item file. [value] here is a value between 0 and 1 (or equal to 1). This value is the chance a rare item has to spawn once it is selected from the rare spawn list. Recommended you don't have too many rare items with low spawnValues or you'll significantly decrease the amount of rare items that spawn (when it fails the spawn a rare item, it won't try again: it will just select a normal item instead).
    • Ensure the config is all setup to suit your needs.



    Comment from: Gr4Ss 17-01-2015 01:15:07

    Noticed an issue with loading order, fixing it now.

    Comment from: Gr4Ss 17-01-2015 01:28:10

    And it should be fixed now, else let me know. Threw in some more logging as well.

    Comment from: Delynx 22-03-2015 17:58:45

    Now this is cool! Getting the new players a chance to get those guns to defend themselfes aswell! Very nice addon, got to give you that!

    Comment from: Max Weilding 01-11-2015 23:53:34

    Amazing. Thanks.

    Comment from: 27-01-2016 18:11:49

    ITEM.spawnValue = [5]; ITEM.spawnType = ["junk"]; This give me a error. What am i doing bad?

    Comment from: Alien_Halls 28-07-2016 21:27:25

    remove this "[]" ITEM.spawnvalue = 5; ITEM.spawnType = "junk";

    Comment from: Alien_Halls 28-07-2016 21:27:32

    remove this "[]" ITEM.spawnvalue = 5; ITEM.spawnType = "junk";

    Comment from: Alien_Halls 28-07-2016 21:27:35

    remove this "[]" ITEM.spawnvalue = 5; ITEM.spawnType = "junk";

    Comment from: -[HG]- Blizzard 17-08-2016 22:57:57

    PLEASE for god's sake, add an easier way of adding items than adding a line or two on each item file. I'm gonna scratch my eyes out.

    Comment from: Pollon de azucar 03-03-2017 18:14:26

    And where do I have to put these lines? ITEM.spawnValue = [value]; ITEM.spawnType = [type];

    Comment from: Pollon de azucar 03-03-2017 18:14:34

    And where do I have to put these lines? ITEM.spawnValue = [value]; ITEM.spawnType = [type];

    Comment from: Sir Mason 07-08-2017 11:22:25

    Seem to be having trouble... I don't see the file in my plugins section. In CWHL2RP or just plain CW

    Comment from: Sir Mason 07-08-2017 11:22:43

    Seem to be having trouble... I don't see the file in my plugins section. In CWHL2RP or just plain CW

    Comment from: Sir Mason 07-08-2017 11:35:48

    Sorry, got it fixed...

    Comment from: 04-10-2018 18:04:53

    we can add items ?