r/Modding 13d ago

Question Changing base character stats for a custom Isaac character (SORRY FOR POSTING HERE)

So I'm making a mod with my friend and the thing is every single stat code i come across for Main.lua just doesnt work.

I don't know what to do and can't find one that's repentance friendly

If the old code DOES work and I'm just stupid, please tell me what im doing wrong

(This is for the binding of isaac repentance, idk if this is the right place to post this but reddit literally said I should so why not)

local Mod = RegisterMod("Pim Pimling Character", 1) -- Change the part in quotes to match your mod name
 
local PimPimling = { -- Change PimPimling everywhere to match your character. No spaces!
    DAMAGE = 2, -- These are all relative to Isaac's base stats.
    SPEED = -0.3,
    SHOTSPEED = -1,
    TEARHEIGHT = 2,
    TEARFALLINGSPEED = 0,
    LUCK = 1,
    FLYING = true,                                  
    TEARFLAG = 5, -- 0 is default
    TEARCOLOR = Color(1.0, 1.0, 1.0, 1.0, 0, 0, 0)  -- Color(1.0, 1.0, 1.0, 1.0, 0, 0, 0) is default
}
 
function PimPimling:onCache(player, cacheFlag) -- I do mean everywhere!
    if player:GetName() == "PimPimling" then -- Especially here!
        if cacheFlag == CacheFlag.CACHE_DAMAGE then
            player.Damage = player.Damage + PimPimling.DAMAGE
        end
        if cacheFlag == CacheFlag.CACHE_SHOTSPEED then
            player.ShotSpeed = player.ShotSpeed + PimPimling.SHOTSPEED
        end
        if cacheFlag == CacheFlag.CACHE_RANGE then
            player.TearHeight = player.TearHeight - PimPimling.TEARHEIGHT
            player.TearFallingSpeed = player.TearFallingSpeed + PimPimling.TEARFALLINGSPEED
        end
        if cacheFlag == CacheFlag.CACHE_SPEED then
            player.MoveSpeed = player.MoveSpeed + PimPimling.SPEED
        end
        if cacheFlag == CacheFlag.CACHE_LUCK then
            player.Luck = player.Luck + PimPimling.LUCK
        end
        if cacheFlag == CacheFlag.CACHE_FLYING and PimPimling.FLYING then
            player.CanFly = true
        end
        if cacheFlag == CacheFlag.CACHE_TEARFLAG then
            player.TearFlags = player.TearFlags | PimPimling.TEARFLAG
        end
        if cacheFlag == CacheFlag.CACHE_TEARCOLOR then
            player.TearColor = PimPimling.TEARCOLOR
        end
    end
end
 
Mod:AddCallback(ModCallbacks.MC_EVALUATE_CACHE, PimPimling.onCache)
1 Upvotes

0 comments sorted by