Jump to content

Item Spawning issues


nolanri

Recommended Posts

Many Different People Using my mod have often complained that the item does not spawn.  I also found that it is not working often.  The only times I was able to actually find the item from the mod spawned was when I used the code:

table.insert(SuburbsDistributions["gunstore"]["locker"].items, 30);

Even though I have many other spawn locations declared as you see below. The only place I was able to ever find a silencer was in the gunstore in westpoint.  And that was only when I spesified "locker" as the container . Using "all" as a container or room name has never worked. Never found one anywhere else. So I was hoping someone could show me what is wrong with the spawn code or the mod in question.
http://steamcommunity.com/sharedfiles/filedetails/?id=639909479

 

here is the item spawn lua file:

require "Items/SuburbsDistributions"
require "Items/ItemPicker"
SSilencer = {}

SSilencer.getSprites = function()
    
    getTexture("Item_Silencer.png");    

    print("Textures and Sprites Loaded.");
end

    
    -- Add items for Gun Store all
    table.insert(SuburbsDistributions["gunstore"]["all"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["gunstore"]["all"].items, 15);    

    -- Add items for Police Storage
    table.insert(SuburbsDistributions["policestorage"]["all"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["policestorage"]["all"].items, 15);
    
    table.insert(SuburbsDistributions["hunting"]["all"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["hunting"]["all"].items, 15);
    
    table.insert(SuburbsDistributions["storageunit"]["crate"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["storageunit"]["crate"].items, 8);
    
    -- Avery rare in crates
    table.insert(SuburbsDistributions["all"]["crate"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["all"]["crate"].items, 4);
        
    
    table.insert(SuburbsDistributions["all"]["metal_shelves"].items, "Silencer.Silencer");
    table.insert(SuburbsDistributions["all"]["metal_shelves"].items, 4);
        

print("SuburbsDistributions added. ");
Events.OnPreMapLoad.Add(SSilencer.getSprites);

 

 

Thank you for your time.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...