The Binding of Isaac: Rebirth

The Binding of Isaac: Rebirth

StatAPI 2.0
62 Comments
zohnannor Oct 4, 2023 @ 3:09pm 
fixed?
Zekava Feb 10, 2022 @ 9:10am 
sadge
『Sora』  [author] May 28, 2021 @ 8:08pm 
Yeah it breaks everything rn, just don't use it DX
Clover May 28, 2021 @ 11:36am 
Breaks kidney stone. Tears are locked to 5.0 until the effect ends.
『Sora』  [author] May 25, 2021 @ 5:39pm 
This entire thing needs completely rewritten to work with repentance and from some details I've learned, might not even work at all now! Kilburn knows about it though, and might implement something officially in the modding tools in the future.
KeinNiemand May 25, 2021 @ 11:53am 
repentance update when?
『Sora』  [author] May 16, 2021 @ 4:16pm 
Uhhhh. Well, we currently still can't inject our stats anywhere else in the modding process so it's still sorta necessary to make items balanced the same way they are in the base game. Yknow how some items can reduce below the tear cap and others cant? We have no way to be able to make modded items that work like that correctly otherwise.
Weedybird<3 May 15, 2021 @ 9:53pm 
i dont know anything about modding but is this mod still necessary/useful?
『Sora』  [author] Mar 26, 2019 @ 4:00pm 
doubt ill do it very soon lol sorry
JSJosh Mar 24, 2019 @ 2:03pm 
Are you planning on updating any time soon? I'd love this to work better with the current version of Isaac :)
『Sora』  [author] Mar 24, 2019 @ 12:33pm 
There's been a bunch of bugs in it still, and I haven't updated it for any newer versions of Isaac so there may be a conflict there. Sorry for that!
Sartre's right eye Mar 24, 2019 @ 11:42am 
So it seems my game crashes every time i try to start a run with Lilith. JSYK
『Sora』  [author] Mar 8, 2019 @ 3:55pm 
Use the new callback function to replace the EVALUATE_CACHE base callback, and then check that the CacheFlag is Firedelay and the Stage is StatStage.BASE, then apply your stat changes.

Be warned about base tears though - whatever change you apply needs to be multiplied by 1000. So if you want to change base tears by +0.7 (like sad onion) then you need to do player.MaxFireDelay += 700

If you need more help let me know and I can provide an example.
popofufu Mar 7, 2019 @ 7:47pm 
How do I raise base tears
『Sora』  [author] Mar 7, 2019 @ 5:55pm 
Unfortunately, at the end of each cache callback speed is set to 2, so it cannot handle another mod that modifies the speed lower than the cap after the fact. Theoretically though, all mods using stat api will be able to affect eachother independantly of the cap, so one mod item that reduces speed by 0.5 flat can be increased by another stat api item which buffs it, but not by base speed changes. I looked into fixing that a while ago, but because of the cap it just wasn't feasible.
popofufu Mar 7, 2019 @ 8:29am 
Does this handle Pony setting speed to 1.5 if it is lower?
『Sora』  [author] Jan 26, 2019 @ 8:40am 
I'll have to look into it. Thanks for the heads up!
Enderskape Jan 25, 2019 @ 2:57pm 
I seem to have found a bug. Whenever I attempt to pcall reference the api, even with an otherwise blank Lua document (with the exception of my registermod line), my base tears stat becomes 10,000 and my damage becomes .05 ingame.

The log.txt outputs infinite repetitions of:

"[INFO] - [Stats API 2.0] Error in "PostEvaluateItems" call: ...f Isaac Afterbirth+ Mods/statapi 2.0_1431542487/main.lua:119: attempt to call a nil value (field 'Func')"

...and I can't for the life of me figure out why.
Jorres Jan 1, 2019 @ 11:21pm 
Sorry, statistics are not visible
『Sora』  [author] Aug 11, 2018 @ 4:56pm 
Nice! There is a bug with dead eye I made a patch for - gave it to my alpha build of apocrypha and it seems to be running fine so i will probably update this with that.

The old version I just copied code from 1.0 which because of a change in structure was causing deadeye to either just not work or to crash the game. This patch should fix that :P
Piber Aug 11, 2018 @ 3:42am 
Just want to say this has been working pretty well, I've been making use of it in some of my in-development mods and I have yet to experience any further issues.
『Sora』  [author] Jul 20, 2018 @ 4:53pm 
Updated - make sure you change all requires for statAPI to pcall(require,"statAPI") instead to avoid errors and mod crashing.
『Sora』  [author] Jul 20, 2018 @ 4:46pm 
Yeah - I had it setup like that initially for a minute before it crashed the whole script and i was confused and reverted the change. Now that I know how it works ill add an addendum to the description and re-patch that version.
Piber Jul 20, 2018 @ 4:22pm 
I request you set it up in a way so that it errors at the end of the script so the game doesn't think require was able to load it. This would make me a lot less nervous about potentially getting people stuck at an older version should I not be able to update my mod.
『Sora』  [author] Jul 18, 2018 @ 4:37pm 
Glad to help lol
... Jul 18, 2018 @ 4:17pm 
Thanks you! (i was way off lol)
『Sora』  [author] Jul 18, 2018 @ 4:08pm 
Steam comments don't like spacing but you probably can get the idea. Base tears upgrades are slightly odder than others because i multiplied the stat by 1000 to fit it inside of an integer MaxFireDelay.
『Sora』  [author] Jul 18, 2018 @ 4:06pm 
function mod:TearsUp(player)
player.MaxFireDelay = player.MaxFireDelay + 0.7*1000
end

stats:AddCache(mod.TearsUp, CacheFlag.CACHE_FIREDELAY, StatStage.BASE)

That's the simplest way to do it. If you want to have more than one stat upgrade in the same function though, you gotta make a small change.

function mod:StatsUp(player, cacheFlag, stage)
if cacheFlag == CacheFlag.CACHE_FIREDELAY then
if stage == StatStage.BASE then
player.MaxFireDelay = player.MaxFireDelay + 0.7*1000
end
elseif cacheFlag == CacheFlag.CACHE_DAMAGE then
if stage == StatStage.MULTI then
player.Damage = player.Damage*2
end
end
end

stats:AddCache(mod.StatsUp)
... Jul 18, 2018 @ 3:57pm 
This might be dumb but could you post an example of how to code a basic tears up (like Wire Coat Hanger)?
『Sora』  [author] Jul 17, 2018 @ 3:43pm 
Basically tho, stats.GenerateSave() at the beginning of your save data string, and use data
= stats.LoadSave(data) at the beginning of your load file.
『Sora』  [author] Jul 17, 2018 @ 3:42pm 
Yeah - i made functions for that!
Check the description above.
Sartre's right eye Jul 17, 2018 @ 3:41pm 
So I reentered from the savefile, and everything was back to normal. But upon further inspection it seemed like something was wrong with my own mod as well. When I inspected further, I discovered we both save our gamedata in the same file (save1.dat). So what I think is going on is that we just override each others data....
...So I might need to put your 'savedata' in my table with datavalues before saving and before loading. Idk
『Sora』  [author] Jul 17, 2018 @ 3:29pm 
My tearrate is displaying as 6 with the same items you have, instead of the value you got. Lemme know if theres any errors or anything else I should know about!
『Sora』  [author] Jul 17, 2018 @ 3:27pm 
Nah i prefer to get bug reports - is there any errors in the log? That looks like the stats value before its converted from base to breakmulti, so i figure something has gone wrong lol
Sartre's right eye Jul 17, 2018 @ 2:18pm 
Srry to keep bothering you, but it seems like I've found another bug:
https://imgur.com/a/Iw6Efku
I took a tears up pill, torn photo and tech x. And after I tried to pick the halo, I find myself unable to shoot...
Sartre's right eye Jul 15, 2018 @ 2:56am 
The madman...He did it
Awesome! :D
『Sora』  [author] Jul 14, 2018 @ 5:15pm 
Patched!
『Sora』  [author] Jul 14, 2018 @ 11:29am 
If you set it up as base it should be checking - might be a bug! There are a few bugs im working to patch up right now honestly (Polyphemus/mutant spider/inner eye multiplier isnt applying correctly, ect) so I will look into it!
Sartre's right eye Jul 14, 2018 @ 7:21am 
So about the tears stat: I noticed that there's no implementation to check whether the tears stat may go under the tears cap of 5 or not. I brought in my own implementation and it works on it's own, but if I pick up another 'tears up' item that should have a cap on 5, it goes under that...
Srry to be so picky, but could you make something like a 'banlist' for collectibles or what not that checks whether the whole list stays above the cap of 5?

Good mod though, it solves what was missing before (a decent way to make accurate stat changing items) :happymeat:
『Sora』  [author] Jul 12, 2018 @ 5:02pm 
Yeah no problem! Glad to help, and glad that other people are finding this as useful as I am :P
Honestly its easier to add stat items with stat api 2.0 imo, cuz you can specify stuff like cacheflag or whatever right in the addcache so its a win/win for me
Sartre's right eye Jul 12, 2018 @ 12:44pm 
Ah yea, I didn't put the 'statsAPI.lua' file in my mod, nor did I require it
That should probably fix my problems, thx for the quick response!
『Sora』  [author] Jul 12, 2018 @ 11:33am 
Don't worry too much about the version either honestly - if you require the file in your lua and then add that stats api is necessary for the mod, any fixes i do to stat api will be auto fixed for the local copy :P
alternatively, any other mods that use a more updated version will override your old version if played with them so
『Sora』  [author] Jul 12, 2018 @ 11:28am 
What kind of setup do you have with it? Did you just download the mod and are using it that way or are you requiring the file in your mod aswell or what?

Likely what im guessing is either you didnt add the file to your own mod files and require it, or you did but you didnt require it at the top of your lua. You CAN run the mod without requiring the actual file in your mod - but then you have to check for stats before you can use it, and if your mod loads before stats, then you have to add the cache callbacks to it from like PostGameStarted instead - so its a little hassle. That is why I designed it to allow you to just copy statsAPI.lua from the mod folders to your mod and just have you require it :P
Sartre's right eye Jul 12, 2018 @ 10:25am 
(A pic with the mentioned error in it: https://imgur.com/a/weRl3mw)
Sartre's right eye Jul 12, 2018 @ 10:16am 
So I was messing around since this seems like a really nice thing that people should use, but it seems that my mod only works after I reload it at least once...
https://imgur.com/a/FNl6p1U
(my mod is supposed to keep upping the damage every time you use book of belial, for bossrush and what not)
Maybe I did something wrong here, but it seems from looking at the errors the console spews back at me that the 'stats' keyword isn't available before I reload my mod?
『Sora』  [author] Jul 11, 2018 @ 11:13pm 
ab+ only - its built to fix issues with the modding api for ab+ after all
montain Jul 11, 2018 @ 7:09pm 
does the mod work for afterbirth only?
Yaoi friend Jul 10, 2018 @ 10:37am 
is ok
『Sora』  [author] Jul 8, 2018 @ 11:37am 
Thanks!
NotRealFrog Jul 7, 2018 @ 11:41am 
There is also a page with large letters AB+ need it about that mod
btw nice mod