How to add a costume to Isaac without adding the item.
This has baffled me and the modding of isaac discord channel and I have now solved it.
Create a variable somewhere that will store the costume item.
local costumeItem = nil
In your playerInit function put the following lines of code
function myModName:PlayerInit(aConstPlayer)
local player = Isaac.GetPlayer(0)
-- This will add the effect onto isaac for a short time
player:GetEffects():AddCollectibleEffect(CollectibleType.COLLECTIBLE_CEREMONIAL_ROBES, true)
-- We can now extract the effect from isaac
local effect = player:GetEffects():GetCollectibleEffect(CollectibleType.COLLECTIBLE_CEREMONIAL_ROBES)
-- and get the effect item, here we store it in our variable created before
costumeItem = effect.Item
end
Now go to your PostRender function (it's important to do this there, if you do it in any of the update functions, the item rendering will glitch)
function myModName:PostRender()
-- Important since your item will not exist for the first few PostRender calls
if costumeItem ~= nil then
local player = Isaac.GetPlayer(0)
-- Enjoy your costume
player:AddCostume(costumeItem, false)
end
end
Yes you need to re apply the costume every single frame, because Isaac doesn't have the item the costume represents equipped then the game will remove the costume after every update.
Hope this helps someone and if you knew this already then we needed you on the discord for the past 48 hours :P Join us https://discord.gg/JMaktQd
Posted Jan 5, 2017, 11:46 PM UTC
20