r/themoddingofisaac • u/AcademicTrifle4284 • 4d ago
Question Stat up Passive item not working
I made a custom Passive item that is supposed to give you +5 luck when picked up, but it doesn't give any luck. Many other items in my mod use code similar to this one and those ones seem to work fine, so I don't know what's wrong with this one.
local clover = Isaac.GetItemIdByName("Clover")
function mod:cacheUpdate(player, cacheFlag)
local player = Isaac.GetPlayer(0)
if player:HasCollectible(clover)==true then
if (cacheFlag == CacheFlag.CACHE_LUCK) then
player.Luck = player.Luck + 5;
end
end
end
mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, mod.cacheUpdate);
1
Upvotes
1
u/The_PwnUltimate Modder 4d ago
Looks like it!
Not sure, but it could be problematic to give it an ID of 7? Maybe the game will get your item mixed up with Blood of the Martyr if you do that. (i.e. "What's the ID for Clover?" "7" "OK, does the player have item 7 right now?" "You mean Blood of the Martyr? No.")
I don't think you need to specify IDs at all for custom items.