The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

Detailed Respawn [REP]
SupremeElf  [developer] 23 Jan, 2022 @ 2:16pm
API for modders
If you are a modder and you want your modded respawn item to support Detailed Respawn you are in the right place :D

If you are a modder that added support for detailed respawn when it was working in AB+ and now wants to port it over to repentance, it is mostly the same except for a few name changes and some values going from PascelCase to camelCase. Read ahead!

Steam doesn't support code highlighing afaik so this might be a little annoying to read... You can try copying this to your code editor maybe?

First of all, all of the code related to adding Detailed Respawn support should go into an if block:
if DetailedRespawnGlobalAPI then -- releated code here end

Adding your item is as simple as calling:
if DetailedRespawnGlobalAPI then DetailedRespawnGlobalAPI.AddCustomRespawn(respawnObject, respawnPosition) end

respawnPosition can be one of three things:
1-
DetailedRespawnGlobalAPI.RespawnPosition.First -- Your respawn item is activated before any other respawn items (soul of lazarus is the first respawn item [well card] to activate, that means your respawn item activates even before soul of lazarus)

2-
DetailedRespawnGlobalAPI.RespawnPosition.Last -- Your respawn item activates after all other respawn items, trinkets, cards and what not (Missing Poster is the last respawn the activate meaning your respawn item activates after Missing Poster)

3-
DetailedRespawnGlobalAPI.RespawnPosition:After("respawn name") -- Your respawn item activates after "respawn name", "respawn name" being the name of the item your respawn item activates after (case sensitive). eg: DetailedRespawnGlobalAPI.RespawnPosition:After("Judas' Shadow") means your item activates after Judas' Shadow

All possible respawn names in the order of them is:
  • Soul Of Lazarus
  • 1up!
  • Second Lazarus
  • Dead Cat
  • Inner Child
  • Lazarus' Rags
  • Guppy's Collar
  • Ankh
  • Broken Ankh
  • Juads' Shadow
  • Missing Poster

As for respawnObject we have a couple of values:
name = "NameOfRespawn", -- This is not optional, it is used to identify respawns, you can choose whatever name you want, probably makes sense to make it your item name.

itemId = CollectibleId, -- If your respawn is from an item (eg dead cat, judas' shadow, 1up) set this to your item collectible id. If your respawn is not an item (eg missing poster, broken ankh, being the first lazarus) there is no need to set this but you will have to set other values that DetailedRespawn can't get by default (like the png path of your respawn and a condition to display it)

gfx = "png path for your file" -- If you set the ItemId to something there is no need to define this property, it will default to the item's sprite. If you didn't (like for the missing poster) you have to supply a png path (relative to the resources folder).

positionModifier = Vector(x, y) -- Optional! A position modifier for your icon, this is used for visual fixes, if the icon doesn't blend well with the other respawn items. Usually x and y values are very small ranging from 0-2.

condition = function(self, player) return true end, -- A function that will be called to determine if your respawn item should be showen, function recieves the player so use that if you need it. If you did set itemId this is not needed and will default to checking if the player has that item (this assumes your item is removed after it's used to respawn, like other respawn items.)

additionalText = "", -- Optional! Additional text to show under the item icon, this can be a string (like "22%" or "50%" for guppy's collar and broken ankh) and this can also be a function that takes the player as the first argument and returns a string

hasAltSprite = true -- Optinal! Set this to true if your respawn item has an alt sprite. Go further down to learn how to use alt sprites

Examples:
This are examples of respawn object for the default items that are in the game.
{ name = "Lazarus' Rags", hasAltSprite = true, itemId = CollectibleType.COLLECTIBLE_LAZARUS_RAGS }

{ name = "Guppy's Collar", itemId = CollectibleType.COLLECTIBLE_GUPPYS_COLLAR, additionalText = "50%", positionModifier = Vector(1.5, 0) -- Move a little to the right since it's small },

{ name = "Missing Poster", gfx = Isaac.GetItemConfig():GetTrinket(TrinketType.TRINKET_MISSING_POSTER).GfxFileName, hasAltSprite = true, positionModifier = Vector(-2, 1), -- Move a down and a little to the left condition = function(self, player) return player:HasTrinket(TrinketType.TRINKET_MISSING_POSTER) end }

Alt icons are an option the player can toggle in the settings to use alt icons.
Alt icons are using the character icon instead of the item icon.
For example use Dark Judas instead of Judas' Shadow.
If you have an item that respawn you as lilith (as an example), you might want to have an alt icon.
First set `hasAltSprite = true` in your respawnObject.
Then you need to put a 32x32 png icon named after the `name` property you defined in your `respawnObject` (this is your alt icon so it would be an icon of lilith for our example) in your mod's `resources/gfx/detailedrespawn/` folder. So, lets assume you set the `name` property to be "Lonely Incubus" you would have `yourmodname/resources/gfx/detailedrespawn/Lonely Incubus.png` which is a 32x32.

To finish our Lonely Incubus item example lets look at how the code would look like!
if DetailedRespawnGlobalAPI then DetailedRespawnGlobalAPI.AddCustomRespawn({ name = "Lonely Incubus", itemId = LilithMod.COLLECTIBLE_LONELY_INCUBUS, hasAltSprite = true }, DetailedRespawnGlobalAPI.RespawnPosition.Last) end

Tell me if you decide to support your respawn items :D
If you need help just ask
< >
Showing 1-2 of 2 comments
Preyn 7 Mar, 2022 @ 2:32pm 
Originally posted by SupremeElf:
Tell me if you decide to support your respawn items :D
If you need help just ask

Just added support for The Golden Collection :heart:

The revive item in question revives the player into a random character so i used a question mark as the alt sprite. If you have another alt icon in mind let me know and i'll change it :resmile:
SupremeElf  [developer] 13 Mar, 2022 @ 4:21pm 
Originally posted by Preyn:
Originally posted by SupremeElf:
Tell me if you decide to support your respawn items :D
If you need help just ask

Just added support for The Golden Collection :heart:

The revive item in question revives the player into a random character so i used a question mark as the alt sprite. If you have another alt icon in mind let me know and i'll change it :resmile:

Wow that's awesome! Thank you so much for deciding to support detailed respawn in your mod :)

As for the alt sprite a question mark is cool. Could also be a dice or something luck/chance related to suggest randomness. You can also completely omit the alt sprite if you wish. It is an optional thing for respawns and not every respawn needs it.
< >
Showing 1-2 of 2 comments
Per page: 1530 50