ItemZed (updated 1.1b)
5 5

40 posts in this topic

Recommended Posts

We're seeing a few mods popping up on the Workshop that have been built through ItemZed, which is awesome. So if you're doing one too then please let us know - and give feedback :)

Share this post


Link to post
Share on other sites
GHawkins   

I just downloaded the tool so I could play around with it a bit, experiment. I am however running into a problem that kind of makes me unable to properly load in the base game files and thus, doing any experimenting with it. And with kind of, I mean it does not work.

 

I downloaded the tool and put the folder in my modding tool file, which is on my desktop. I started the tool and it was unable to locate my Zomboid folder, which is in my steam folder. I manually navigate to it and select it. However, the option to import items from the base game does not appear. I have tried selecting the root folder \Projectzomboid and the media folder \Projectzomboid\Media, but both result in the same.

 

Any idea what could cause this? I am on windows 7, 64 bit, the game is located in my steam folder which is in my Programfiles(x86) folder.

Share this post


Link to post
Share on other sites

GHawkins the import button, imports the currently selected mod data. Try hitting file, create new mod, fill in the information it asks for and see if that works for you.

Share this post


Link to post
Share on other sites
Rari   

I'm having a similar problem to GHawkins. I've watched ItemZed Additional Options by TurboTuTone several times and I'm not sure what I'm doing wrong. Is there a video or guide somewhere that I'm not seeing for how to set this up?

Share this post


Link to post
Share on other sites

@Void, @Crowborn and others having the issue of not seeing anything in the distribution tab, make sure youve got a updated IWBMS on steam like @russafiii mentioned and then it should be working properly. Ill update OP to include a little note concerning this.

 

@thiosk Indeed the distribution panel isnt well suited for bulk insertion operations like that atm.
Ideally id like to fix up the entire distibution panel a bit at some point in the near future so the points youve raised work better allong with some more drag and drop improvements.

However when doing amounts 250 items this may still result in quite some dragging, depending on how they need to be distributed in the list lua might be a valid option as well.

Ive played around with creating a little helper script for that purpose and came up with the following which may be helpful to you:

 

DistributionInsertion

Spoiler

-- Script can insert items of a certain module to a list of target distribution containers.

-- SETTINGS ---------------------------------------
-- change local variables accordingly and run script.
local module = "myModule";
local spawnChance = 1.0;
local dontAddIfItemExist = true; -- if set to true this will not add a item if the target container already contains that item.
local targetContainers = {
	"aesthetic.counter",
	"bakery.counter",
	"all.shelves",
	"all.fridge",
	"grocery.crate",
	"Schoolbag",
	"Purse",
};

-- SCRIPT -----------------------------------------

function string:split(sep)
   local sep, fields = sep or ":", {}
   local pattern = string.format("([^%s]+)", sep)
   self:gsub(pattern, function(c) fields[#fields+1] = c end)
   return fields
end

function run()
  -- collect the fullnames for items from the defined module
  local items = {};
  for v in DataManager.Objects do
    if v.ObjectType.IsItem then
      if v.ParentModule~=nil and v.ParentModule.Name==module then
	  table.insert(items, v.FullName);
      end
    end
  end

  -- now find the defined target containers for insertion
  local distRoot = DataManager.DistributionContainer;

  for _,s in ipairs(targetContainers) do
    local c = distRoot;
    for _,val in ipairs(string.split(s,".")) do
      local cache = c;
      if c.Children.Count>0 then
        for i=0,c.Children.Count-1 do
          if c.Children[i].Name==val then
            c = c.Children[i];
            break;
          end
        end
      end

      if c==cache then
        c = nil;
        break;
      end
    end

    if c~=nil and c~=distRoot then
      --print("container found!");
      if not c.IsItemContainer then
        print("container '"..s.."' is not a itemcontainer");
      else
        -- interting the earlier collected items into this container
        for _,item in ipairs(items) do
          local canAdd = true;
          if dontAddIfItemExist then
            if c.Items.Count > 0 then
              for i=0,c.Items.Count-1 do
                if c.Items[i].IsMod==DataManager.IsModMode and c.Items[i].Item==item then
                  canAdd = false;
                  break;
                end
              end
            end
          end
          if canAdd then
            c.addItem(item,spawnChance,DataManager.IsModMode,true);
          end
        end     
      end
    else
      print("could not find container: "..tostring(s));
    end

  end
  print("Success!");
end

 


The top part has some settings you can modify, the way it works would be to have all the items that you wanna add in bulk to the distribution in a seperate module wich will act as a category.
You can set a default spawn chance and add target containers, the nested containers need to be seperated with dots as per example and be aware that the container names are case sensitive.
When running the script it will add all the items from the defined module to the targetcontainers, afterwards you can optionally use the right side item filter box to filter on the module name (see img) instead of item name incase you need to override some default spawn chances of some of the items.

7c3caa82e24601403db0301328f97ba8.png


Additionally ive also created helper script to remove items from the distributions in bulk, it has somewhat similar settings in the top part:

 

DeleteItemsFromDistribution

Spoiler

-- Script to delete items from distribution.

-- SETTINGS ---------------------------------------
-- change local variables accordingly and run script.

-- any items belonging to modules defined here will be removed.
-- to disable modules set it to false, nil or a empty table.
local modules = { 
	"myModule" 
};

-- any items defined here (full name including module), will be removed.
-- set to false, nil or empty table to disable.
local items = {
	"myModule.testItemC",
}

-- optionally define spawnchances which the items must match, set spawnChances to false, nil or empty table to disregard spawnchance.
local spawnChances = {
	1.0,
	2.5,
}

-- define target containers to remove items from 
-- NOTE: if set to false, nil or empty table then the specified items will be removed from ALL containers.
local targetContainers = {
	"aesthetic.counter",
	"bakery.counter",
	"all.shelves",
	"all.fridge",
	"grocery.crate",
	"Schoolbag",
	"Purse",
};

-- SCRIPT -----------------------------------------

function string:split(sep)
   local sep, fields = sep or ":", {}
   local pattern = string.format("([^%s]+)", sep)
   self:gsub(pattern, function(c) fields[#fields+1] = c end)
   return fields
end

function run()
  local doModules = modules~=nil and #modules>0;
  local doItems = items~=nil and #items>0;
  local doChances = spawnChances~=nil and #spawnChances>0;
  --local doTargets = targetContainers~=nil and #targetContainers>0;
  
  local finalItems = {};
  if doItems then
    for k,v in ipairs(items) do
      addItem(finalItems, v);
    end
  end

  if doModules then
    for k,v in ipairs(modules) do
      addItemsFromModule(finalItems, v);
    end
  end

  if #finalItems>0 then
    local containers = getContainers();
    for _,c in ipairs(containers) do
      if c.Items.Count>0 then
        for _,item in ipairs(finalItems) do
          for i = c.Items.Count-1,0,-1 do
            if c.Items[i].Item==item and c.Items[i].IsMod==DataManager.IsModMode then
              local canRemove = not doChances;
              if doChances then
                for _,chance in ipairs(spawnChances) do
                  if chance==c.Items[i].Chance then
                    canRemove=true;
                    break;
                  end
                end
              end
              
              if canRemove then
                c.Items.RemoveAt(i);
              end
            end
          end
        end
      end
    end
    print("Success!");
  else
    print("Warning: no valid modules or items to remove.");
  end
end

local function getContainersWhiteList()
  local containers = {};
  local distRoot = DataManager.DistributionContainer;

  for _,s in ipairs(targetContainers) do
    local c = distRoot;
    for _,val in ipairs(string.split(s,".")) do
      local cache = c;
      if c.Children.Count>0 then
        for i=0,c.Children.Count-1 do
          if c.Children[i].Name==val then
            c = c.Children[i];
            break;
          end
        end
      end

      if c==cache then
        c = nil;
        break;
      end
    end

    if c~=nil and c~=distRoot and c.IsItemContainer then
      table.insert(containers, c);
    end

  end
  return containers;
end

local function getContainersRecurs(_cont, _list)
  if not _cont.IsItemContainer and _cont.Children~=nil and _cont.Children.Count>0 then
    for i=0, _cont.Children.Count-1 do
      getContainersRecurs(_cont.Children[i], _list);
    end
  elseif _cont.IsItemContainer then
    table.insert(_list, _cont);
  end
  return _list;
end

function getContainers()
  if targetContainers~=nil and #targetContainers>0 then
    return getContainersWhiteList();
  else
    return getAllContainersRecurs(DataManager.DistributionContainer, {});
  end
end

function addItemsFromModule(_itemList, _module)
  if _module==nil then
    return false;
  end
  if DataManager.Objects.Count > 0 then
    for i=0,DataManager.Objects.Count-1 do
      local obj = DataManager.Objects[i];
      if obj.ObjectType.IsItem and obj.ParentModule~=nil and obj.ParentModule.Name==_module  then
        addItem(_itemList, obj.FullName);
      end
    end
  end
end

function addItem(_itemList, _item)
  for k,v in ipairs(_itemList) do
    if v==_item then
      return;
    end
  end
  table.insert(_itemList, _item);
end

 


Hope this is usefull, both scripts adjust to the mode youre running the program in (mod or dev), in mod mode the remove script for example will not touch and base game entries.

Also, if there might be need for other similar scripts feel free to post a request in this thread!

 

Regards,
Turbo

Share this post


Link to post
Share on other sites

Updated the OP with 1.2 version, which should fix the issue with no mods/no distribution. Many thanks to @GHawkins for helping out track the issue!

 

note: If you use the update package you might want to delete "config/options.txt", this will erase any stored directory setting causing the program to do a clean setup routine again once started.

Share this post


Link to post
Share on other sites
thiosk   


Nice! THank you, I aim to take another look at some items this weekend. 

 

I have been working on what amounts to a revitalization of the literature mod that was popular back on build 29. The way that mod worked is that it added a module worth of items that replaced books. 

 

@turbotutone  

bug report

1qFoT3I.png

 

Ive gotten the range feature to work once, i believe only in 1.0. Since then the range feature hasn't worked at all. I'd love to set random umber of pages for my books here but nothing seems to happen. Selecting all or selecting one only c hanges the range to the negative number above or NaN if valuetype=float

Edited by thiosk

Share this post


Link to post
Share on other sites
thiosk   
On 3/28/2017 at 5:20 PM, Rari said:

I'm having a similar problem to GHawkins. I've watched ItemZed Additional Options by TurboTuTone several times and I'm not sure what I'm doing wrong. Is there a video or guide somewhere that I'm not seeing for how to set this up?

@GHawkins 

 

What I have to tell you both is that its probably mostly related to your file structures.  If you have it set up wrong, it won't work and a lot of the stuff you feel like should be doing things wont. 

 

Its because steam has a mods folder for workshop mods, and then the users folder has mods and the users workshop folder has a slightly different structure for uploading the mods.  

 

It took me about three days of sessions of picking at it before I got things loading right. I do all my modding in the users/mods (NOT the steam folders). In order to get the file structure right, i strongly advise the create new mod feature. Then you can compare your mod you can't get to load.

Share this post


Link to post
Share on other sites
GHawkins   
14 hours ago, thiosk said:

@GHawkins 

 

What I have to tell you both is that its probably mostly related to your file structures.  If you have it set up wrong, it won't work and a lot of the stuff you feel like should be doing things wont. 

 

Me and Turbo actually tracked down the problem. It was not related to my file structure (which is my steam install folder), it was that the program assumed a certain parameter in steam's config files would be present, when it was not a given it would be present. The recent update Turbo made to the program solved that.

 

On top of that, I was looking for something that is no longer possible in the newer versions of ItemZed, to prevent players from accidentally corrupting their base game files.  It's now working as intended.

Share this post


Link to post
Share on other sites
Darius   

Hi there and thanks for the great tool.  I've been using it recently to try and make a mod, but I've been having an issue which I can't seem to resolve.  In the "Search in Objects" tab it's possible to selectively mass modify values and the like, but I can't seem to find a way here to change the Module name on mass. I tried to find something online about Lua which would allow me to do this using the custom Lua tab at the bottom of the page but I suck and couldn't make heads or tails of it.

I'm looking to do this as the mod I'm trying to achieve will require me to organise a lot of recipes which will be regularly modified. being able to easily organise these via sorting them in separate modules would be immensely helpful. Does anyone have any idea about how I could do this?

Once more this tool is awesome, and has gotten me into trying to make something from nothing for me and my friends.

Share this post


Link to post
Share on other sites

Can you add getDisplayName function?

this function to load the correct translation file, and show item the name of the translation.

Share this post


Link to post
Share on other sites

Hi all!
Ater first launch i've try to import data and got this:

image.thumb.png.deb7e96a84d8dceed9911decebf7ec22.png

Version Vehicle_Test_22 Steam

Same shit with latest IWBUMS from Steam

Does anyone can help me?

Thanks

Share this post


Link to post
Share on other sites
Crowborn   

Ever since i posted about my problem with distributions i managed to get everything working correctly, and i'm having a blast creating everything :)

 

One problem remains, though: I managed to edit distributions for my modded items, but not for the vanilla ones. The buttons are locked away. How can i achieve this?

 

Thanks again for making this great tool :)

Share this post


Link to post
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
5 5