ItemZed (updated 1.1b)
5 5

41 posts in this topic

Recommended Posts

ItemZed
Scripts & Distribution editor.

 

 

 

Welcome to ItemZed!

ItemZed is a development and modding tool that is used to edit the contents of script modules (foodstuff items, weapons, recipes etc) and the distribution table that dictates where different in-game items can be found and looted on the map. Additionally, it loads texturepacks containing icons so you can change how things appear in-game.

On top of the manual editing of data, there are options for the batch refactoring of large numbers of items and in-game objects.

We have also added lua integration that allows the entire data set to be programmatically modified, and output to any sort of format – meaning that changes and new items can quickly and easily become part of user mods, and a part of the main game. They can also be used to created handy tables in html and wiki format.

Quote

Cool stuff you could do with ItemZed, for example in terms of axes and dead mice:

·         Want axes to be more powerful? Modify the axe item!

·         Want to be able to make axes out of spoons and dead mice? Modify the axe recipe!

·         Want to create a whole new item called a ‘Zombie-doom Dead Mouse Axe’? Create a new item or copy and modify the normal axe!

·         Want to increase the numbers of dead mice found in cupboards, for said axe? Edit the dead mouse map distribution table! Add spoons!

·         Want to create an entire set of weaponry, forged from the bodies of small animals? Create a whole mod, and programmatically manipulate lua script data to make your life easier!

·         Want to create a wiki specifically about dead mice in PZ? ItemZed can help with that too! Weirdo!

 

Videos

Video I

Video II

 

Downloads

Most recent version (requires latest IWBUMS):

ItemZed 1.2 (FULL) | ItemZed 1.2 (UPDATE)

 

Old versions:

ItemZed Version 1.1b download.

(if you have 1.0 installed, put this one in a seperate directory, dont update the 1.0 version)

ItemZed Version 1.0 download.

 

Changelog

Spoiler

1.1b

FIXED several small bugs.
FIXED UI improvement suggestions made in thread.
CHANGED distribution file format to work with the game.
CHANGED program now loads from the root directories of both the game and mods, instead of the media folders prior.
CHANGED when running in mod-mode the dev options are obfuscated.
ADDED support for custom texture packs and single image textures.
ADDED several mouse-over tooltips.
ADDED create mod from scratch.
ADDED mod.info reading/editing, this means a mod's texturepacks are also automatically found.
ADDED Auto-detect option for game folder and mods.
ADDED Several new options for lua exporting, including html and outputting of icons to images.
ADDED lua simple wiki generator for mods script.

 

ItemZed instructions

Spoiler

1 How to begin

Spoiler

Uppon first boot the program will ask to setup folders.

1.1b_welcome.png

When you confirm it will open the folder settings where it will prompt you for an automatic detection of folders.

 

If all went well then you are good to go and you can close the panel.

1.1b_foldersettings.png

If the program cannot set (some) folders automatically or if you want to point to mods not located in the usual directory for example, you can add them manually.

Once the above is set up you can select a mod in this tool bar and use ‘File->Import’ to start editing.

1.1b_folderbar.png

Or you can use ‘File->Create new mod’ to start a mod from scratch, this will open the following popup.

1.1b_createmod.png

Once the initial values are filled in you can save and start editing the new mod, any additional mod.info values such as texturepacks and tiledefinitions can be edited in the mod.info panel after the new mod has been created.

2. A brief tour of ItemZed Panels

Spoiler

2.0 Mod.Info

Spoiler

1.1b_modinfo.png

Allows you to edit the mod.info file. When adding texturepacks, save and reimport the mod for the program to load its textures.

2.1 Modules.

Spoiler

panel_modules.png

You can optionally add your own modules here, they will be displayed in bold/italic. Only modded modules can be edited.

2.2 Object Types.

Spoiler

panel_objecttypes.png

This panel is used to define the different object types - items, recipes etc. When loading a mod media folder this panel is Read Only, but can be used for reference.

2.3 Objects.

Spoiler

panel_objects.png

In the Objects Panel all the script module elements (items, recipes etc) can be created/edited/viewed.

On the left you see all loaded objects, which can also be filtered for ease of use. Below this you can add/copy objects, which is also sorted through the aforementioned filter.

Note: when loading a mod the “Show only modded objects” filter is enabled by default.

New objects require unique names, and this can be checked by looking up the object type settings, unless of course you intend to ‘overwrite’ something in the base game.

The middle of the panel shows the currently selected object. The contents of an object appear as they do in the game’s base file scripts, just in easy to use input boxes.


For example the apple in script:

apple_txt.png

And the apple item again in the ItemZed editor:

apple_editor.png

The program has a simple way of parsing the contents, if an object type has a key/value separator defined it will detect those key value pairs and manage the keys for that object type.
Any lines that don’t have the key value separator will be regarded as a “value only” line.

A good example to illustrate are the recipes, so here’s a recipe in script:

radio_script.png

And again in the ItemZed editor:

radio_editor.png

The separator for recipe key values is a colon, as such ElectronicsScrap=2 is treated as a value only line. So any formatting (the ‘=’ and stuff like ‘keep’) other than the key value separator for this object type is not recognized by the program, this is so the program can remain flexible if stuff changes or new types of objects are added in future.

You can select lines using the checkboxes on the left, and the buttons in the dark grey bar to move/delete.

Adding new Key Value pairs can be done below, and if you want to add a single value line then uncheck ‘AddKey’.

Lastly, to the right you’ll see a tab with an Items list and Icons list, from which you can drag and drop items and icons.

2.4 Objects Search Panel

Spoiler

panel_search.png

 

The Objects Search Panel lets you sift through the contents of PZ script objects, also with a handy filter. You can search for two parameters: Keys and Values.

When you enable Key search if will look for relevant results – say the display name of the item you’ve searched for. ‘Axe’ or ‘dead mouse’.

TIP: Searching for ‘*’ will find all keys and values. If you want to get a list of all possible lines, including key/value pairs and single value lines, then disable key search and enable value search with ‘*’ as search value.

Search results

searchresults.png

You can sort the results on most columns by clicking the header. When sorting on the value column will always sort values based on their text value (internally all values are text). If a value is a valid numeric value it can be sorted by this too.

Links here allow you to view specific object panels, and to delete lines.

All columns are Read Only except for the Value column: you can edit Values in-list directly through a double click.

Selections can be made by using the buttons below or by using CTRL, SHIFT or CTRL+SHIFT and clicking.

Edit selection options

A number of options can be used here to make changes to a selection of search results, again this only applies to the value column values.

If you are running in mod mode, any of these options will ignore results in the selection that are base game.

Text

selection_text.png

This can make simple text based changes, the line can be read as a statement to execute on each value. TIP: For more complex replacement statements use regex.

Number

selection_number.png

This will apply operations on numeric values.

TIP: If a result has a key then the key will be checked for having the correct number type. If a result has no key then the value will be evaluated to see if it matches the number type. So if you have a Key ‘DisplayName’ which is a string, and an associated value ‘123’ it will be ignored on grounds of the key being defined as string.

Range

selection_range.png

Using range you can convert a range of numbers to a new one.

Regex

selection_regex.png

This applies regex on the selected results, see link.

ItemZed Expert Function: Custom lua

selection_lua.png

 

The custom lua option can be used if ever you need to make changes to a selection of values which isn’t covered by the other options. The custom lua allows you to write a custom function to be performed on each search result and optionally return a new value for that result.

How it works:

When you click ‘apply’ then the entire lua script is loaded (you can use upvalues and your own globals).

Each script needs to have at least a global function
function run(t)

ItemZed will then run through each search result (it will ignore non-modded results if in mod mode) and call the run function and pass the searchresult as a lua table. You can then parse the result in any way you like, and use return values of the function to modify the search result’s value.

Return values:

·         When you return a string it will change the search result value to that string.

·         When you return nil or a non-string value, the search result value will remain unchanged.

·         Optionally you can return a second boolean parameter, if set to true the content line will be removed.

Optionally you can also define a global function:
function init(t)

If a function init is defined, the program will first pass all search results through init and only after all search results have been passed through init once will it proceed to calling the run function on them.

This can be used if for example you want to make a custom range converter you may want to save the highest and lowest value of a set into a upvalue or global variable before performing the final conversion operation in run.

Search Result table

The search result table passed to both init and run contains the following keys with string values:

            t["value"] = the value

            t["key"] = the key or nil

            t["valueType"] = the value type or nil

            t["object"] = the object’s name

            t["objectType"] = name of the object type

            t["module"] = name of the module

And it contains the following keys with table values:

            t["keys"] = keys

            t["keyTypes"] = key types

            t["values"] = values

 

 

 

The latter tables contain all the keys and values of the associated object as indexed tables with string values. For example the first line of an object contents is DisplayName = ObjectName then the first index of these tables would be:

            t["keys"][1] == “DisplayName”

            t["keyTypes"][1] == “String”

            t["values"][1] == “ObjectName”

 

 

 

Note: Values in the ‘keys’ and ‘keyTypes’ table can be nil if a content line has no key, the ‘values’ table on the other hand should always have a string value for each index.

This could be used for example to change the WeaponDamage value for a large selection of weapons and applying a modifier based on the CriticalChance of the weapon if defined.

The CriticalChance key can be looked up in the ‘keys’ table, and if found the associated value can be retrieved from ‘values’ using the found key index.
 

Delete

selection_delete.png

Simply deletes the selected entries.

2.5 Item Distribution.

Spoiler

panel_distribution.png

 

ItemZed can be used to maintain the distribution of your mod’s items throughout PZ maps, but you can ignore this if you’d rather do it the traditional way.

To use it you can simply add your items to the containers (adding distribution items is not limited to modded items, you can also add extra spawns for base game items). TIP: Modded items are shown in a different colour and are editable.

To add Items simply drag them from the list on the right into your chosen container on the distribution list, then set your preferred spawn chance.

Right clicking an item in the list on the right will show all containers that currently contain it.

Note: Your distribution items are saved in a separate distribution table which gets merged with the game’s distribution table when the game loads the world. The distribution table is saved in “\lua\server\Items\” in your mod media folder. The filename should be “Distributions_youruniquenamehere.lua”, if you don’t have such a file the program will generate a filename looking like this “Distributions_ff9a7ccd.lua”. You can rename this file, making sure the mod is not currently loaded in the program, then change the random part to something more user-friendly.

2.6 Lua Panel

Spoiler

See section 3 “Lua”

2.7 Source File Panel

Spoiler

panel_sourcefiles.png

This is a read only panel showing the files that have been loaded, so you can browse their contents.

TIP: If you run the program the first time on an existing mod it will show files with the old filenaming structure as it displays the source files in their state prior to an import. Once you save and reimport this will be updated.

 

 

3 Lua

Spoiler

lua_script.png

 

The lua panel offers a way to manipulate the data via traditional lua scripting instead of using the UI. This can be used for many things, whether it’s refactoring or adding new data elements. It can also be used to output data and icons (from a pack) or generate html.

When running a lua script a console window will pop up that you can also print an output to. (It should also be noted that before running a lua script ItemZed will save the data, make a backup and then reimport the data in a clean DataManager object, just before the new DataManager is passed to the UI it will try and run the lua script.)

To write a valid script all that’s required is that said script has a function run(). This is the entry point. The run function will be called without parameters, and any return values of the function will be ignored.

You can use the following globals in the ItemZed lua environment:

print(msg)
Prints the msg string to the console window.

addIconToExportList(name)
Adds an icon name to an export list that can flushed at some point.

exportIcons()
This flushes all the icons in the exportlist as separate files stored in “output/user/html/img/iconame.png”

getFileWriter(filename)
When the filename is a string without a path or extension, this returns a filewriter object.
Filewriters can be set to save as html or txt. See lua documentation for more info.

getGUID()
This returns a randomly generated guid string.

DataManager
This global variable holds the instance of the DataManager. (Please see the Help tab in Editor for documentation on exposed classes and functions.)

Some example scripts.

The following script probably makes more sense to use as dev then modder, but it serves well as an example. So, suppose you want to add a new key to only items of the type food:



local objType = "item";
local itemType = "Food";
local addKey = "MyFoodVariable";
local addVal = "2";
function run()
  for v in DataManager.Objects do
    if v.ObjectType.Name==objType then
      if v.HasKey("Type") and v.GetFirstKey("Type").Value==itemType then
        v.AddKeyValuePair(addKey, addVal);
      end
    end
  end
end

This script searches for any items with the Food item type and then adds a new key value pair to all it finds. It defaults the value to 2, and the search panel could be used afterwards to search for all added “MyFoodVariable” keys to adjust values accordingly. Alternatively you could write a more complex script that sets the value of MyFoodVariable based on other values of the item.

Here’s another example that utilizes the file writer to write some statistics about your mod:



-- counts stuff in a mod.
local modName = "YourModName";

function run()
  local w = getFileWriter("ModStats_"..modName);

  w.WriteLine("Stats for mod: " .. modName);
  w.WriteLine("");

  local count = {};
  local types = {};
  for v in DataManager.Objects do
    if v.IsMod then
      if count[v.ObjectType.Name] then
	  count[v.ObjectType.Name] = count[v.ObjectType.Name]+1;
      else
        count[v.ObjectType.Name] = 1;
      end

      if v.ObjectType.Name=="item" then
        if v.HasKey("Type") then
          local t = v.GetFirstKey("Type").Value;
          if types[t] then
	      types[t].count = types[t].count+1;
            table.insert(types[t].items, v.GetFirstKey("DisplayName").Value);
          else
            types[t] = { count = 1, items = { v.GetFirstKey("DisplayName").Value } };
      	    end
        end
      end
    end
  end

  w.WriteLine("Global count.");
  for k,v in pairs(count) do
  	w.WriteLine(tostring(k)..": "..tostring(v));
  end

  w.WriteLine("");

  w.WriteLine("Item types.");
  for k,v in pairs(types) do
  	w.WriteLine(tostring(k)..": "..tostring(v.count));
	for _,itm in pairs(v.items) do
		w.WriteLine("  "..tostring(itm));
	end
  end
end

This will output the file writer contents to a file ModStats_modname.txt. Any text file output can viewed in the editor’s Custom output tab, so here’s an example of the above script running through the TommyGuns mod:

lua_output.png

There’s also a Help tab in the lua panel, which shows some documentation on exposed classes and functions. It should hopefully help with writing lua scripts.

lua_help.png

4. Importing & Saving

Spoiler

After that whistle-stop tour, I guess you’ll be wanting to know how to import existing work/data. Well, with a correctly set mod folder in the blue bar, you can import the data via: Menu->Import.

When selecting Import, the program will automatically start reading folders/files inside the mod folder and display a progress report. If the process fails then you should be informed of any errors.

importscreen.png

During the import process the following will happen:

  • ·         The config.txt file is parsed.
  • ·         The mod.info and directories are read and verified.
  • ·         Any whitelisted texturepacks and single textures are loaded.
  • ·         The “scripts/” sub folder is searched for text files which should contain scripts which are then parsed.
  • ·         The Distributions.lua file, if present, in “lua/server/Items/” is parsed.

When parsing the image, scripts and distribution data – they are stored internally in various class objects and collected together in a DataManager object. The data can be edited via the UI or you can write a lua script that manipulates said DataManager object and its contents directly (see lua section).

When you are importing a mod, the program will first load the data from the Project Zomboid media folder, then it will load data from the mod media folder, and finally merge all data in the DataManager.

Elements belonging to your own mod will be tagged internally, and the UI will subsequently only allow you to make changes to mod elements that impact on it.

TIP: After importing all operations are stored in memory, so if you import and don’t save then nothing will be changed in your files.

Data can be saved at any time, and at the same time converted back to the original formats.

When you save, all text files in the root of your “scripts/” are deleted before the newly saved files are copied in – so make sure there’s only script text files in that folder. This is because ItemZed restructures and renames existing script files, as shown below with the ‘old’ script structure to the left and the ‘new’ to the right.

filerestructure.png

Internally, files still have the same formatting as before - but each module is now saved separately. (This was done so the program doesn’t need to remember which file different data belongs to.

5 Lua wiki/html generation.

Spoiler

Through lua you can export icons and also output .html files instead of .txt. This can be used to export partial html for a wiki, or generate an entire custom wiki for you mod.

In fact, ItemZed now includes a “CreateSimpleWiki” script:

lua_wiki.png

When running this script a simple wiki will be exported to “/output/user/html/” in the program root.

The output html looks something like this:

wiki_tommyguns.png

wiki_hydrocraft.png

When clicking on an item link it shows a simple detail page with a raw printout of the item contents:

wiki_tommyguns_detail.png

The script is very bare but functional for a simple minimalistic wiki and could be further developed to create a better looking html page.

Other Important Information:

 

Spoiler

Where files and configuration files live

ItemZed has the following configuration files stored in the “config/” folder.

window.txt



//Uncomment the lines below and change their values accordingly to modify window startup position/resolution.
//position:0,0
//size:1920,1080

Can be edited to change window start up behavior.

options.txt

This file stores media folder settings in key value pairs per line separated by a comma. This file is automatically maintained by the program and usually won’t require any user editing.

config.txt

This file can store different types of configuration options. The “ObjectType” blocks contain information about how to read various elements in the script files. These can also be edited in the program itself.

The two configuration option blocks that are of interest to note are “TexturePacks” and “SingleTextureDimension”.

TexturePacks



TexturePacks
{
	ui
	ui2
}

If your mod uses texture packs you can add their names to the whitelist without the .pack extension. Each entry must be on a new line and contain no extra characters like commas.
The white list won’t cause errors if pack files don’t exist, it simply checks if found pack files match the whitelist and if so loads them.

NOTE: A recent update now finds a mod’s texture packs automatically.

SingleTextureDimension

 



SingleTextureDimension
{
	64
}

This single value option controls the size of single image textures to be loaded from the textures folder.
Any image with both the width and height smaller or equal to this value will be attempted to load. You can set this value to -1 to ignore all single image textures.

Automatic backups

ItemZed will make automatic backups during some operations. This is baked in currently, a future update will have ability to change backup settings or disable it altogether.

Automatics backups will be made:

·         Before files are imported.

·         After each successful save.

·         When running a lua script in the lua tab before a script is ran.

The backup folder can be accessed easily via menu->backups folder. The files are archived with a year-month-day-time stamp and a tag of the operation that triggered the backup (IMPORT,SAVE,RUNLUA).

Currently there’s no limit on the backup saves, a future version will have a option to set how many backups to remember maximally (perhaps also a restore option).

 

 

 

Share this post


Link to post
Share on other sites

Well, it seems to be working, at any rate.

 

  • a distinct icon would be nice
  • being able to open multiple item/recipe definitions in tabs would be helpful (can currently run two instances of the program to do this)
  • does this keep a temp file so that if the program crashes, your work is preserved? What about an auto-save function?
  • Tooltips would be nice. I did not know what the red dot of death did.
  • I do not understand how to modify the base scripts -- I guess this means I'm in modder mode?
  • Input/output alternative formats, other than the game's script. In particular, CSV would be useful for balancing in Excel. perhaps it'd allow the easy writing of a wiki bot to process that data, as well
  • the Search tab is totally blank
  • could a key be added ("ingredient"), even if it is purely aesthetic? It should help people understand what's happening with recipes (add blank field -> put in item name is a bit obtuse)
  • In one instance, it wouldn't let me raise or lower a field for unknown reasons. Deleting the field and re-creating it solved this

Share this post


Link to post
Share on other sites
On 1/24/2017 at 5:35 PM, makkenhoff said:

One minor thing, on start up, it doesn't take into consideration where your start menu is located. (IE: If it is situated at the top, it will place the title bar "under" the start menu. Makes working within the window impossible. 

In the new version there is a file "config/window.txt" in the program root that allows you to change its start up position/window size. That should help with the issue, let me know it doesnt work for some reason :)

Share this post


Link to post
Share on other sites

Poking around on this and it's looking good so far. Start-up could be streamlined a bit (maybe prompt the users on what to do when the program is first launched within the program, just have those windows come up with what to do with them automatically?).

 

One thing that really stands out when I tried to work on recipes, though, is adding required ingredients. I finally figured out that you have to uncheck "UseKey" box. I think the easiest way would be to expand the "Add contents" box a little bit. Replace the "UseKey" box with just "Add Key" and below it have another blank that says "Add Ingredient" with its own Add button.

 

Otherwise, stuff is looking good so far and I'm enjoying playing with it.

Share this post


Link to post
Share on other sites

I also note that the Source Files are viewable. This is helpful, but it'd be even more helpful if it were searchable if that's possible. Would like to be able to find every instance of things, etc.

Share this post


Link to post
Share on other sites

Just a note, finally had some time to plug at it again, and your windows.txt works perfectly.  I'm having a bit of trouble locating specific functions, as Rathlord commented on; It'd also be nice if I could copy and paste sections from other items, thus far I'm not seeing a way to do that, though the tick box seems like a good way to do that.

 

Another nice feature would be when creating a specific module, that it would create (or allow you to create) the mod.info file and folder structure for the mod upon save, so it can be drag and dropped right into the mod folder, for quick testing. I'll probably add more later, but I ran out of time troubleshooting why my explosive alcoholic food item wouldn't let me eat it. :)

Share this post


Link to post
Share on other sites
51 minutes ago, makkenhoff said:

 but I ran out of time troubleshooting why my explosive alcoholic food item wouldn't let me eat it. :)

 

Does it have type=food key? And a hungerchange= value?

Share this post


Link to post
Share on other sites

I had type=food, but I was missing the hungerchange=value - but after that addition it still isn't showing as eat, but it is showing nutrition.  I'm probably missing something simple, so I just posted the code for it that I currently had.

 

*edit* Eventually, I figured out I was missing either foodtype=fruits or it required calories. 

Edited by makkenhoff
Updated.

Share this post


Link to post
Share on other sites

Updated the main post with a new ItemZed version 1.1b and a instructions manual (thanks to @Batsphinx and @Rathlord for making it a smoother read!)

Also thanks to those testing and posting suggestions! a good bunch have been put in the update.

 

@Rathlord
The distributions work for the new version 1.1b, the project zomboid's current IWBMS has the game side code updated as well to make the ItemZed distribution files work.

 

@makkenhoff sorry for getting back at your question a bit late i see you already gotten it working, a tip for future: it may be handy to copy an existing apple and then add stuff like the alcohol to it. For copying existing items you need to untick "show only modded objects" in the filter, then the copy section in the add item groupbox (bottom left) also shows existing game items in the dropdown box.
Currently that dropdown box and the objects list both apply the filter settings so it may not have been apparent right away.

 

As for your suggestion about the mod.info, the new version allows you to create a mod from scratch aswell as editing mod.info file of a loaded mod :)

I havent added another way of copy pasting sections of objects contents yet, but ill likely put that in a future update allong with @Butter Bot suggestion of being able to view multiple objects at once in-program, as those suggestions would be very handy indeed.

Share this post


Link to post
Share on other sites

Seems like a very handy tool, but i'm having some problems:

 

For some reason, i cannot edit any property in existing items. All fields and checkboxes are greyed out. The bottom right corner shows "mod only mode enabled" version, too. Any idea on how i can fix this? 

 

Also, if i create custom sprites, where should i place them? And where can i find the default ones if i want to edit them? Thanks!

Share this post


Link to post
Share on other sites

Eya @Crowborn,

 

Not being able to edit existing base game items when modding is correct behaviour for the program, you can however override an existing item in your mod.

To do this,  in add new object (bottom left) check 'copy' and select for example a apple from the list, give your copy item exactly the same name as the original apple and press 'add'.

This copy can be edited and should overwrite the basegame apple once you load the mod ingame.

 

As for adding sprites, you got 2 options:

Single file sprites which go into the "media/textures/" folder in your mod dir,

or texturepacks which go into "media/texturepacks/" more info on creating texturepacks can be found here.

 

The default icons are in a pack file, however you can use the Lua tab to export them.

To do so, go the Lua tab and paste the following script:

-- outputs to: ..\output\user\html\img\


function run()
	for v in DataManager.Objects do
		if v.IsMod==false and v.ObjectType.Name=="item" then		
			if v.HasKey("Icon") then
				local icon = v.GetFirstKey("Icon").Value;
				-- see if icon exists, else try prefixing Item_
				if not DataManager.HasImage(icon) then
					icon = "Item_"..icon;
				end
				if DataManager.HasImage(icon) then
					addIconToExportList(icon); --global function to add icons to export list.
				end
			end
		end
	end
	
	-- global function, this exports all icons added to the export list to html/img/ in the output dir:
	exportIcons();
end

Give the script a name and hit 'Save & Run', this should export all used icons for basegame items to 'output/user/html/img/'

One thing to keep in mind about exported icons tho, when it exports it cuts away unused whitespace so their original size was 32x32px but some outputted images will be a tad bit smaller then that due to this cutting of whitespace.

Share this post


Link to post
Share on other sites

Thank you so much. This was very helpful!

 

Also, can't seem to be able to edit item distribution properties, on vanilla or modded objects. The place where the guide's manual shows a collapse symbol has nothing on mine.

Edited by Crowborn
not really a problem anymore

Share this post


Link to post
Share on other sites

Sure, here it is.

 

Don't know what i'm doing wrong, and also, the mod seems to not work at all, with the custom items never showing up ):

 

As you can probably see on the screenshot, nothing is expandable, and i can't do nothing on this screen.

 

 

ewffewfew.png

Share this post


Link to post
Share on other sites

This program is terrific. Once I learned the software it opened up modding to me. My whole problem is syntax. I don't know what any of the functions are named or how to deploy them. This software totally eliminates that hurdle and lets the creativity come out instead. 10 points.

 

Question. 

 

I want to stop a stock item from appearing in the world because i've replaced it with items created through Itemzed. Is there a way to do that in my pure "itemzed" mod or do I have to expand my knowledge base further? 

 

FURTHER QUESTION:

 

Lets say I have 300 new items that I have to set up distributions for. Is it possible to categorize them all as a particular class, do the distributions based on that class (so each roll of that class would then pick one of the particular items that falls under the category) Basically, I'm creating a collectables mod, and I want to set up distributions for the collectables, but then extending the list of collectables means i have to add every one to all the distributions again.  I would like shelves to have the chance to spawn 1 of any collectable, not have X number of chances to spawn Y number of items, all of which might be collectables in the list. Do you see what i'm getting at? Its tricky. 

Edited by thiosk

Share this post


Link to post
Share on other sites
On 19/03/2017 at 8:04 AM, thiosk said:

This program is terrific. Once I learned the software it opened up modding to me. My whole problem is syntax. I don't know what any of the functions are named or how to deploy them. This software totally eliminates that hurdle and lets the creativity come out instead. 10 points.

 

Huzzah, so pleased to hear this. Hopefully this means other people will pick it up and give it a try too :)

 

I'll direct Turbo to your query.

Share this post


Link to post
Share on other sites

@thiosk great to hear! :D

As for the questions:

Stopping a base item from spawning cannot currently be done via ItemZed (yet), however the recent IWBMS should have lua functionallity already added for it. This would require a lua file to be added to your mod to get it working currently:

yourmoddir/media/lua/server/yourfilename.lua

when you have created the above file copy paste the following and edit/add accordingly.

local function preDistributionMerge()
	-- param1: a distribution root or subcontainer, Distributions[1] should always contain the entire basegame distribution set without mods.
	-- param2: Name of the item as it appears in the distributions list (fullname)
	-- param3: Optionally a chance number can be defined to remove only matching items with that chance, or set to nil to remove all matching items regardless of chance.
	-- param4: Do recursive or not, if true it will recursivly remove items from all subcontainers.
	RemoveItemFromDistribution(Distributions[1], "Base.Hammer", nil, true);
	RemoveItemFromDistribution(Distributions[1], "Base.Nails", nil, true);
	--etc
	
	-- instead of passing the entire Distributions table you can also pass a sub element:
	RemoveItemFromDistribution(Distributions[1].conveniencestore, "Base.Hammer", nil, true);
	-- in the above example the hammer will only be removed from containers in the conveniencestore location.
end

Events.OnPreDistributionMerge.Add(preDistributionMerge);

As for the category spawning, that would currently not be possible (unless you add some custom lua that does it to the mod). But i may look into it for a future update of ItemZed if something like that would be feasible to add to the program/gameside.

 

 

@Crowborn in case you might have missed it, ive dropped you a pm concerning the issue.

Share this post


Link to post
Share on other sites

@void the item distribution screen is a bit of a beast. I havn't fully tamed its wild ways. I think the way we're supposed to be doing large scale distribution changes is through some kind of lua script, because it does not appear to be straightforward to select a large range of items on the right hand side and add them. T

 

The way I've currently been using the screen is to first search for a blank field in the top center, This will open up the distributions panel and enable its editing. Lets say you want to add flamethrower parts and you want it to appear with military stuff. I would then input HamRadio1 into the search field and the distributions would then open up a range of items. You then in the right panel search "flamethrower" then drag it to the right fields. Ham radio 1 shows up in 15 different distribution spots or so, so you have to add flamethrower to all 15 of those. The search field isolates them all for you nicely. 

 

The problems are: 1) when yo udrag the items from the right panel into the appropriate field, the searched term loses focus and the tree collapses except current branch. So you cant simply drop the item you want into the 15 lines and set the abundance all at once, you have to drag, search drag search drag search drag search until you have matched all the locatations you wanted to distribute to. This is a real drag if you have created a table of 250 items because you can't process in bulk as near as I'm aware.

 

Hope my comments help

 

Edited by thiosk

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