Get unit's item max uses via event?

Is there a way to get the MAX uses value of an item in a unit’s inventory via events?
The current GeUnitStatus patch only allows you to get the CURRENT uses. I need to get the MAX uses value.

2 Likes

Essentially, I’m trying to make an item repair kit item event

2 Likes

Use or reference the repair item(s) asmcs Zane and I both wrote.

3 Likes

I’ve seen your Repair ASm, and it’s great. However, what I want to achieve is to repair individual items, and only by a few uses. Rather than repairing all items to full

2 Likes

This part:
https://github.com/Veslyquix/Pokemblem/blob/master/Patches/ASMCs/RepairItemsUnused/RepairItems.s#L80

ldrb r0, [r7, #0x06] @ Item id 
blh  0x08016540           @MakeItemShort RET=ITEMPACK 
strh r0, [r4, r5] 

MakeItemShort does exactly what you want in asm, so I think you should use asm.

Given an item id, it returns that same item with max durability in r0. One only needs to store it in unit struct.

2 Likes

Here, test this for me:

https://github.com/Veslyquix/ASM/tree/main/GetCharClassItemData

Given item id in memory slot 1 and offset of the item table in slot 3, it puts the value for that field in the item table into memory slot C.

All I did was turn the decomp headers into an asmc for units, classes, and items to read their tables.

So for iron sword you’d put 1 in mem slot 1 and for durability you’d put 0x14 in memory slot 3 and then call the ASMC.

1 Like

Could you give a more simple explination of how to use this? I have no idea how this works. I’ve been trying to figure it out for over a month.

I’m decent with events, but not good with ASM. Explain to me as if I’m 5.

This may be a bit lengthy, but if you really don’t want to use asm, you could just check for the item. If it returns that it’s an iron sword, you know it has 46 max uses (or however many you gave it). It may take some time, but if you said you’ve been stuck on it for a month, it may be worth it.

Example:

Get item 1
If result != 1 jump to cond id 0
Set item pieces 1 to 46
Label cond id 0

Repeat for each item.

1 Like

Yes, I’ve been thinking of doing this. But I wanna learn to use the ASM if possible

SVAL s1 1 // iron sword in slot 1 
SVAL s3 0x14 // always 0x14 for item uses
ASMC GetItemTableData
// 46 is now the value in mem slot C 

ask someone like Shuusuke to make you pictures as I’m not going to