Stat Booster only usable with certain character (Item Effect Revamp)

Hello everyone.

I recently updated skillsystems on febuilder to the most recent version and am seeing what ideas I can come up with due to the new features.

I had an idea to make certain powerful statboosters only usable by a certain character. The Item Effect Revamp table has a place to insert ASM for statboosters (I believe for a usability check). Is there an easy way to use this feature to check a character ID and allow use only for a certain character ID?

Thank you for any help.

1 Like

It should be pretty easy to check for a specific character ID, will still require some asm
Write a function that calls the normal statbooster usability function (to check that you haven’t capped the stat, etc.) and if that check succeeds you just need to get the character ID. Unit pointer is passed to your function in r4, so you can load character data pointer → character ID from that and compare it to some constant value of the character ID you want to be allowed to use it, return true if they’re the same, and return false otherwise.
Item usability functions are laid out a bit differently from standard functions due to how they’re called, so I’d recommend looking at existing ones for the layout if you’re unfamiliar with it

Something like this would hardcode it to Seth

.thumb
.equ CurrentUnit, 0x3004E50
ldr r3, =CurrentUnit
ldr r3, [r3] 
ldr r0, [r3] @ character editor 
ldrb r1, [r0, #4] @ unit id 
cmp r1, #2 @ Seth 
bne RetFalse 

RetTrue: 
mov r0, #1
b Exit 
RetFalse: 
mov r0, #3 

Exit: 
bx lr 
.ltorg 

I didn’t blh to the regular check like Sme suggests. You should do that too

If you use the unit ptr in r4 instead of the active unit ptr it should also work as prep screen usability, active unit won’t be unit using item at the prep screen

1 Like

Really? Weird

Generally speaking I always prefer grabbing unit struct that’s passed as a parameter over using whatever’s in CurrentUnit ram as this is safer, so it’s good practice either way

Thanks for the help everyone. I know very little about ASM but will try to see if I can figure it out by messing around.

Join the discord for help

You can insert asm via febuilder and then use the address it was installed to as your usability function