Adding Descriptions - wofsauge/External-Item-Descriptions GitHub Wiki

Descriptions are the core feature of EID. They describe the effect of the item in a short, precise and easy to understand way.

Descriptions and Formatting

See an article about it here: >>> Descriptions <<<

Loading order

Item descriptions can be defined in multiple ways. EID always tries to load the descriptions in a specific order to ensure the maximum "accuracy" of a description given the installed mods.

The mod always tries to load the current Language first. If it cant find anything, it tries to find something in the English translation.

The order is as follows:

1. Info added using Entity:GetData()["EID_Description"] > 2. Info added using functions > 3. Infos added using Legacy method > 4. Infos from EID language pack files > 5. Infos taken from the Game's XML files

Custom Callbacks for mods that load before EID

For mods that load before EID, all EID calls need to happen after EID finished loading. For that purpose, the custom callback EID_POST_LOAD can be used (Repentance exclusive):

ACoolMod:AddCallback("EID_POST_LOAD", function()
    -- This gets called after EID loads!
end)

Alternatively, build in callbacks like MC_POST_GAME_STARTED can be used as well.

Pre requirement

It is important to check if EID is loaded before calling any function. To do this, encase any EID function calls in an if-statement:

if EID then
    -- EID function calls here ...
end

Adding descriptions

EID-Descriptions can be added to any item or entity of the game. To do this, the EID API provides the following functions:

-- For Collectibles.     Optional parameters: itemName, language
EID:addCollectible(id, description, itemName, language)

-- For Trinkets.         Optional parameters: itemName, language
EID:addTrinket(id, description, itemName, language)

-- For cards/runes.      Optional parameters: itemName, language
EID:addCard(id, description, itemName, language)

-- For pilleffect ids.   Optional parameters: itemName, language
EID:addPill(id, description, itemName, language)
  • id is refering to the specific subType of the entity.
  • description is a string containing the itemdescription. See more on that >>> further down <<<
  • itemName (Optional) Can be used to define a custom name. If not set, the mod takes the name from the ingame ItemConfig (XML-files)
  • language (Optional) Can be used to add the description into a specific language-pack. Default is en_us(english)

Examples

  • EID:addCollectible(1, "Some text") -- Overrides the description for "Sad Onion" collectibles_001_thesadonion
  • EID:addCollectible(1, "Some text", "New name") -- Overrides the description for "Sad Onion" and renames it into "New name" collectibles_001_thesadonion
  • Seting a russian translation for a custom item:
local myItemId = Isaac.GetItemIdByName("My Item Name");
EID:addCollectible(myItemId, "водка лучше пива", "Блядь", "ru")

Adding Transformations

See here: >>> How to add Transformations <<<

Adding descriptions to any entity

In addition to adding descriptions to items, it is also possible to add descriptions to any entity of the game. this can be achieved with the following function:

-- For any entity.       Optional parameters: language
EID:addEntity(id, variant, subtype, entityName, description, language)
  • id, variant and subtype define the specific entity. When subtype is -1 or empty, it will affect all subtypes of that entity.
  • entityName will be the text that is displayed in the "name" field of the description
  • description is the description of the entity
  • language (Optional) Can be used to add the description into a specific language-pack

Adding descriptions to a specific entity

You can also add descriptions using the "GetData()" function of any Entity.

-- If adding a string, it will interpret it as a Description
someEntityObj:GetData()["EID_Description"] = "An entity specific description#And its init seed: ".. someEntityObj.InitSeed

-- Adding a table does allow for defining more Informations to display, like Name, Descriptions and Transformations
-- All of the possible table entries are optional
local descTable = {
    ["Name"] = "Some Obj with seed ".. v.InitSeed , -- Display name of Entity
    ["Description"] = "An entity specific description#And its init seed: ".. someEntityObj.InitSeed -- Description
    ["Transformation"] = "1,2" -- Transformations
} 
someEntityObj:GetData()["EID_Description"] = descTable