Skip to content

Adding Items

AgentCucco edited this page Jan 22, 2021 · 15 revisions

Function syntax.

Encyclopedia.AddItem(class, id, wikidesc, pools, name, desc)
  • class: 'string'. The class for your item, usually referenced as your mod's name. (optional)
    • Note: On smaller mods, it's recommended to leave this argument as nil, so the item gets added to "general mods" instead of occupying a new cateogory in the menu.
  • id: 'number'. Your item's id.
  • wikidesc: 'table'. Your wiki table for the item. (optional)
  • pools: 'table': A table of pools. (optional)
  • name: 'string'. The name of your item, used in case the name in the xml causes an [ERROR] tag to display in-game. (optional)
  • desc: 'string'. The description of your item, used in case the description in the xml causes an [ERROR] tag to display in-game. (optional)

How to add an item to the encyclopedia.

You can choose to register your item differently depending on how much effort you wanna put into the encyclopedia compatibility.

Just the item with no wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyItem = Isaac.GetItemIdByName("Funky Item")

if Encyclopedia then

Encyclopedia.AddItem(
  nil,
  FunkyItem,
  nil,
  {
    Encyclopedia.ItemPools.POOL_TREASURE,
    Encyclopedia.ItemPools.POOL_GREED_TREASURE,
  }
)

end

The item with no wiki or pools, but with a name tweak.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyItem = Isaac.GetItemIdByName("<Funky Item>")

if Encyclopedia then

Encyclopedia.AddItem(
  nil,
  FunkyItem,
  nil,
  nil,
  "Funky Item"
)

end

The item with a manual wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyItem = Isaac.GetItemIdByName("Funky Item")

if Encyclopedia then

local Wiki = {
  Funky = {
    { -- Effect
      {str = "Effect", fsize = 2, clr = 3, halign = 0},
      {str = "Gives you some massive funk boost."},
      {str = "If you get enough funk boost (20), summon Funky Kong."},
      {str = "+1 Funk point when you are funky."},
    },
    { -- Trivia
      {str = "Trivia", fsize = 2, clr = 3, halign = 0},
      {str = "I made this item because I honestly really like funky kong."},
    },
  }
}

Encyclopedia.AddItem(
  nil,
  FunkyItem,
  Wiki.Funky,
  {
    Encyclopedia.ItemPools.POOL_TREASURE,
    Encyclopedia.ItemPools.POOL_GREED_TREASURE,
  }
)

end

The item with an EID wiki.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyItem = Isaac.GetItemIdByName("Funky Item")

local FunkyDescription = "{{ArrowUp}} Gives you a lot of funk. #If you get enough funk, you will summon Funky Kong."

if EID then

EID:addCollectible(FunkyItem, FunkyDescription)

end

if Encyclopedia then

Encyclopedia.AddItem(
  nil,
  FunkyItem,
  Encyclopedia.EIDtoWiki(FunkyDescrption),
  {
    Encyclopedia.ItemPools.POOL_TREASURE,
    Encyclopedia.ItemPools.POOL_GREED_TREASURE,
  }
)

end

If you have a big mod.

local MyMod = RegisterMod("Super Mod", 1)
local FunkyItem = Isaac.GetItemIdByName("Funky Item")

local FunkyDescription = "{{ArrowUp}} Gives you a lot of funk. #If you get enough funk, you will summon Funky Kong."

if Encyclopedia then

Encyclopedia.AddItem(
  "Funky Kong Pack (25+ Items)",
  FunkyItem,
  Encyclopedia.EIDtoWiki(FunkyDescrption),
  {
    Encyclopedia.ItemPools.POOL_TREASURE,
    Encyclopedia.ItemPools.POOL_GREED_TREASURE,
  }
)

end

Clone this wiki locally