ASM request

I would like to make a request to the powerful wizards of FEU. Would anyone be so kind as to conjure an ASM hack that allows me to make a weapon unbreakable via an event? Thanks for hearing me out.

1 Like

Are you averse to joining FEUcord? Unless someone finds this an interesting endeavor they probably won’t do it anytime soon. If it’s not an involved hack you can probably get someone in a dev channel to walk you through making the ASM hack. It depends on how weapon durability/indestructibility is stored.

I know there’s a flag in the actual item data, but I don’t know if there’s a way to set it being indestructible dynamically. You might be better off using workarounds like just replacing the item with a version that is indestructible and giving it back in the normal form after, though you’d have to save its durability somewhere.

1 Like

Does setting durability to 255 make items unbreakable? If so, that could work.

1 Like

so the issue here for me is that this event wouldn’t generically make all of a single weapon type unbreakable, but make a single specific item in the supply or someone’s inventory unbreakable (I presume). This means the inputs for the event opcode would need to include a character (either 0 or FF would be supply), and then indicate one of their inventory slots, but the eventer has no way of knowing which inventory slot the unit has the item in.

It seems you’d need to run a “check for item in player’s inventory” event which stores the location of the item, and then run an event that sets said item to unbreakable. So that’s what this asm would need to do.

I think there might’ve been someone who wrote some asm to check for items in player’s inventory and even edit their values, but I don’t remember who. (StanH? Venno? Snakey?) If you find that, there might already be something close to what you’re looking for.

–
If on the otherhand you’re asking for asm to change all instances of a single weapon type to unbreakable then I don’t think you’re gonna find that.
Lastly, if you want to change a weapon type so that all future weapons of that type are unbreakable then it should be doable (theoretically), but it’d be annoy as heck.

I would solve your issue myself, but all of these are just slightly outside the reach of my capabilities. The first approach is your best bet though.

I tell you what, dm me if you find that “item checker” asm and I’ll see if I can tweak it to fit your needs.

1 Like

Not at all, I’m already a member of the discord server.

It doesn’t, the durability still decreases with each use.

Actually, I’ve been using that item checker asm. More specifically, this is the event I have:


Basically, the player visits a blacksmith with the weapon they want to make unbreakable and an ore. The player is prompted to select the weapon from a menu made with the “Split Menu” asm. The game then checks the visiting unit’s inventory for both the weapon and the ore with the “Item checker” asm. If positive, the 2 items are erased and a unbreakable version of the weapon is given to the visiting unit.

This method works fine, but it has the downside of requiring two versions of the weapon, the regular one and an unbreakable one. Since I’m doing this for all the regalia, that’s 9 less item slots that I would really like to use for something else. Believe it or not, I’ve exhausted all the available item slots in my hack and that’s why I’m requesting an ASM for that.

So it looks like I’d need to create a command to toggle the destructibility of the currently selected weapon. That seems to be an easy task, but I’ve never created a custom event command (I’ve only done a little bit of engine hacking). Give me some time and I’ll see what I can do.

In the meantime, setting the item’s durability to 255 should work for playtesting.

EDIT: Did some asking in the discord. I’m gonna see If I can make a couple small edits so that items with over 127 durability are unbreakable.

1 Like

Thank you for helping, and may the Triforce of Wisdom guide you.

2 Likes

Mind that in vanilla at least, for items in the convoy, only the first five bits of item durability are saved.

Default EMS seems to use the vanilla functions used to load convoy data from and write convoy data to save and suspend:

1 Like

Your work around is probably the best way to handle it, is it really worth it to sink hours into asm when what you have works fine?

I find it hard to believe you are out of item slots. Do you really still need things like say poison weapons?

As Huichelaar mentioned, items above 63 durability / 0x3F will be bitpacked in the convoy on suspend and lose their “unbreakable” bitflag of 0x80, so you’ll need to copy the convoy part of my EMS setup in pokemblem.

This only took 15 mins so I figured why not. It sounds like a cool hack idea.

#ifndef callHackNew 
	#define callHackNew(offset) 		"BYTE $01 $4B $9E $46 $00 $F8 $01 $E0; POIN (offset|0x1)"
#endif 

PUSH 
ORG $16AF8 
callHackNew(InfiniteDurabilityHack)
POP 

ALIGN 4 
InfiniteDurabilityHack: 
#incbin "InfiniteDurabilityHack.dmp" 
.thumb 
.macro blh to, reg=r3
  ldr \reg, =\to
  mov lr, \reg
  .short 0xf800
.endm

	.equ CheckEventId,0x8083da8

@ r0 = item 
push {r4-r5, lr} 
lsl r0, #2 
ldr r1, =0x8016B18 
ldr r1, [r1] @ item table 
add r0, r1 
ldr r4, [r0, #8] 

mov r5, r2 @ item 
mov r1, #0x80 
lsl r1, #8
tst r5, r1 
bne Unbreakable 
mov r0, #0xE9 
blh CheckEventId 
cmp r0, #0 
beq Breakable 

Unbreakable: 
mov r1, #8 
orr r4, r1 
Breakable: 
mov r0, #8 @ unbreakable bitflag 
and r0, r4 
mov r2, r5 
pop {r4-r5} 
pop {r1} 
bx r1 
.ltorg 

I made it so if the weapon has 0x80 bitflag set in its durability that it’ll not deplete. Additionally, if global flag 0xE9 is set, all weapons won’t lose durability.

This is not tested, so please try it and let me know if it worked.

Same thing but for used items instead of weapons:

PUSH
ORG $1756C
jumpToHack(InfiniteItemDurabilityHack)
POP 

ALIGN 4 
InfiniteItemDurabilityHack: 
#incbin "InfiniteItemDurabilityHack.dmp" 
.thumb 
.macro blh to, reg=r3
  ldr \reg, =\to
  mov lr, \reg
  .short 0xf800
.endm

	.equ CheckEventId,0x8083da8

@ r0 = item 
push {r4, lr} 
mov r2, r0 @ item 
mov r1, #0xFF 
and r0, r1 
lsl r1, r0, #3 
add r1, r0 
lsl r1, #2 
ldr r0, =0x8017580 
ldr r0, [r0] 
add r1, r0 
ldr r4, [r1, #8] 

mov r1, #0x80 
lsl r1, #8
tst r2, r1 
bne Unbreakable 
mov r0, #0xE9 
blh CheckEventId 
cmp r0, #0 
beq Breakable 

Unbreakable: 
mov r1, #8 
orr r4, r1 
Breakable: 
mov r0, r4 
pop {r4} 
pop {r1} 
bx r1 
.ltorg 

If you don’t want to mess with EMS, I recommend you use 8 or so global flags to save which types of weapons have infinite durability. Eg. The blacksmith makes all your iron / steel / silver weapons never break in tiers. Then you just need to compare item IDs in the asm and if they match while the flag is on, then they never break. I’ll walk you through that sometime if you prefer that.

3 Likes

How fortunate that people far more capable than I have stepped in. :sweat_smile:

Sorry to steal your thunder, I’m sure you would’ve gotten there :sweat_smile:

I just already had this hack working but without the condition of a flag set / durability bitflag, so it was an easy addition. Except I just caught and fixed a mistake I made. It’s dangerous to share code you haven’t tested lol.

No no please, what took you 15 minutes would’ve taken me 15 hours. I’m barely aquainted with fe8’s engine anyway since I’ve been working with Final Fantasy Tactics Advance the last few years.

I mostly just glance at these forums for fun :sweat_smile:

2 Likes

Honestly I think the most elegant and universally applicable solution would be writing code for any item with durability of 63 (255 with EMS) to never decrease in use (and if possible display — uses the way DurabilityItemList displays one use for Skill Scrolls), not relying on setting bitflags on specific items and saving additional data. This would allow for any specific weapon to be “Helarned,” blessed by Yune (heck, I think it’d be plausible to code for durability of 63/255 to grant effectiveness against a specific list of classes) or otherwise made unbreakable by simply setting durability to 63/255, and not affect every Silver Sword or whatever in existence.

1 Like

You can edit the above source to compare durability to 63. It’s just a few lines

1 Like