Jump to content

JC Denton

Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by JC Denton

  1. Re-post because I posted this question in the wrong forum. Can a mod please delete my original? I'm trying to make containers re-roll their loot if they end up being empty by calling the "fillContainer()" function. e.g. If a kitchen counter is empty after the game runs the "fillContainer" function, I want my mod to call "fillContainer()" function at least once more to give it more chance of not being empty. (From the docs, it looks like the class "zombie.Lua.LuaManager" has the function "fillContainer()" but it seems I can't use "zombie.Lua.LuaManager" functions because it's not listed in "zombie.Lua.LuaManager.GlobalObject" which is the only outward-facing class for lua modding as I understand it. It seems I am able to call "getNumActivePlayers()" but not "fillContainer()". (sorry if this sentence doesn't make sense, please ignore it.) I've also tried using "zombie.inventory.ItemPickerJava" because it also has a "fillContainer()" function but I can't see how to get a "zombie.inventory" object because container.getInventory returns a "itemContainer" object rather than "inventory" object and I can't find any other ways to use the "zombie.inventory.ItemPickerJava" class.) Is there any way to use the "fillContainer()" function? Or is my own solution to write my own function utilizing addItem()? TLDR: The below code fails on the line: "fillContainer(itemContainer, player);" This is the only line of code that needs to be fixed. JCD_MLRSCCDA = JCD_MLRSCCDA JCD_MLRSCCDA_fill_container_iterator = 0 local function JCD_MLRSCCDA_onFillContainer(roomName, containerType, itemContainer) for playerIndex = 0, getNumActivePlayers()-1 do local player = getSpecificPlayer(playerIndex); if player ~= null then local items = itemContainer:getItems(); local itemsLength = items:size(); --print(roomName .. ": " .. containerType .. ": Num Items In Container: " .. itemsLength); if itemsLength == 0 and JCD_MLRSCCDA_fill_container_iterator < 100 then fillContainer(itemContainer, player); JCD_MLRSCCDA_fill_container_iterator = JCD_MLRSCCDA_fill_container_iterator+1; end end end end local function JCD_MLRSCCDA_resetFillContainerIteration() JCD_MLRSCCDA_fill_container_iterator = 0; end Events.OnFillContainer.Add(JCD_MLRSCCDA_onFillContainer) Events.EveryTenMinutes.Add(JCD_MLRSCCDA_resetFillContainerIteration) P.S. I play "CD DA" challenge a lot and noticed if you start with bad loot in the first house, you tend to get bad loot for the rest of the game. (and good loot at the start tends to garner good loot throughout the game). e.g. low amount of medicine in the bathroom cabinets and low amount of books in the living room shelves almost always tends to mean there will be lower amounts of tools, weapons, books, food, medicine etc. in other house's containers for the rest of the game (and I think I may have also noticed less loot on the floor and less scripted houses e.g. houses with a lot of toilet paper or cops/robbers etc.) Is there a seed that gets generated at the start of each game which effects the loot rate for the rest of the game or is it just me? It feels like it's not just me because it's happened so many times while I've replayed CD DA over a hundred times. Since it's CD DA, It's always the same loot settings and starting location and I always use the "lucky" perk these days but I also noticed this happening without the lucky perk.
  2. Hi, I've just started using lua to make some mods and have hit a roadblock. I'm trying to make containers re-roll their loot if they end up rolling empty. (the ultimate goal is to have them re-roll only once, so there is still a chance they could be empty, but the loot rate will still be a bit more consistent). It looks like the class "zombie.Lua.LuaManager" has the function "fillContainer()" but it seems I can't use "zombie.Lua.LuaManager" because it's not listed in "zombie.Lua.LuaManager.GlobalObject" which is the only outward-facing class for lua modding as I understand it. (sorry if this sentence doesn't make sense, please ignore it.) I've also tried using "zombie.inventory.ItemPickerJava" because it also has a "fillContainer()" function but I can't see how to get a "zombie.inventory" object because container.getInventory returns a "itemContainer" object rather than "inventory" object and I can't find any other ways to use the "zombie.inventory.ItemPickerJava" class. TLDR: The below code fails on the line: "fillContainer(itemContainer, player);" This is the only line of code that needs to be fixed. JCD_MLRSCCDA = JCD_MLRSCCDA JCD_MLRSCCDA_fill_container_iterator = 0 local function JCD_MLRSCCDA_onFillContainer(roomName, containerType, itemContainer) for playerIndex = 0, getNumActivePlayers()-1 do local player = getSpecificPlayer(playerIndex); if player ~= null then local items = itemContainer:getItems(); local itemsLength = items:size(); --print(roomName .. ": " .. containerType .. ": Num Items In Container: " .. itemsLength); if itemsLength == 0 and JCD_MLRSCCDA_fill_container_iterator < 100 then fillContainer(itemContainer, player); JCD_MLRSCCDA_fill_container_iterator = JCD_MLRSCCDA_fill_container_iterator+1; end end end end local function JCD_MLRSCCDA_resetFillContainerIteration() JCD_MLRSCCDA_fill_container_iterator = 0; end Events.OnFillContainer.Add(JCD_MLRSCCDA_onFillContainer) Events.EveryTenMinutes.Add(JCD_MLRSCCDA_resetFillContainerIteration) P.S. I play "CD DA" challenge a lot and noticed if you start with bad loot in the first house, you tend to get bad loot for the rest of the game. (and good loot at the start tends to garner good loot throughout the game). e.g. low amount of medicine in the bathroom cabinets and low amount of books in the living room shelves almost always tends to mean lower amounts of tools, weapons, books, food, medicine etc. in containers for the rest of the game (and I think I may have also noticed less loot on the floor and less scripted houses e.g. houses with a lot of toilet paper or cops/robbers etc.) Is there a seed that gets generated at the start of each game which effects the loot rate for the rest of the game? It's always the same settings and starting location because it's always the CD DA challenge and I always use the "lucky" perk these days but I also noticed this happening without the lucky perk.
×
×
  • Create New...