You are not logged in.
I´m surprised that this hasn´t been asked yet, but how do you make TMs reusable? I know Rangi has made them reusable in his hack, so it seems to be possible.
I´m NOT using the disassembly, focussing instead on stuff like Hex and Wargrave´s [fantastic] tools.
Any help on that would be great!
Wargrave's tools are great for editing the static tables of data, but if you plan to add whole new features (reusable TMs, Running Shoes, physical/special split, Fairy type, that kind of thing) you should really use assembly. You won't have to jump in and out of routines to insert code in the middle of things, there are no pointer or bank issues, and it's easier to debug.
Thanks for the reply. The only issue is that my hack is pretty much done. Barring a bunch of sprites and some other tweaks, there´s nothing much else. So Assembly isn´t really an option, as it´s too late. That´s why I was after an alternative.
I´m also pretty sure that reusable TMs are the only thing tha I need to do where Assembly would be the best way to do it.
If a non assembly method isn´t possible, I may just have to make the main ones available in later Pokemarts or something as an alternative. Not ideal though!
For a mostly complete feature, you can just nop out the ConsumeTM call and the quantity display code, and edit the item attribute table to add CANT_TOSS. If you're good enough with hex-editing I'm sure you could adapt the Game Corner and Mart code to prevent selling duplicates; if not, either give the TMs another way (like a new NPC script with a one-time money-for-TM deal), or just trust the player not to waste their money on extras. (Oh yeah, and change the Return TM lady so she won't give duplicates too.)
Edit: it looks like the new Mart code would be relatively simple to port. I added a check at the very beginning of MartAskPurchaseQuantity which jumps to a whole new code block if the item sold is a TM; and MartAskPurchaseQuantity is only called in one place in engine/mart.asm. So replace the call to it with a call to this ShimRoutine:
ShimRoutine: ; this is the check I added at the beginning of MartAskPurchaseQuantity ld a, [CurItem] cp TM01 jp c, MartAskPurchaseQuantity ; go to the original routine ; now copy the .PurchaseQuantityOfTM code here push de ld hl, NumItems call CheckItem pop de ... ; et cetera
That's a single contiguous chunk of new code. You'd just need to find or make enough free space in the same bank as engine/mart.asm and put it in there. Then replace the "call MartAskPurchaseQuantity" with "call ShimRoutine". If you've been hex editing Z80 code, you've probably already had to do that sort of thing.
(Even if you're stuck developing your hack via hex editing, you can check out pokecrystal and use it to write new code, then compile it and copy the raw hex code into your ROM.)
That leaves the Game Corner code. Again, I added TM checks to the very beginning of certain code blocks (.doubleteam, .psychic, .hyperbeam, .Thunder, .Blizzard, .FireBlast), so replace any jumps or calls to those labels with calls to new shims that do the TM check, jump to the original label if false, and continue with the GoldenrodGameCornerPrizeVendor_AlreadyHaveTMScript/CeladonPrizeRoom_alreadyhavetm code if true.
Last edited by Rangi (2017-05-17 13:11:22)