Yeah, there are exactly two spots at the end of the InventoryData which have some data like name and meseta cost, but they were given no functionality. I labelled them Item_Unknown1 and Item_Unknown2 and they have ID's 0x7E and 0x7F respectively. Define the properties you want for the items you want here. Then go to the ps2.constants.asm file and the ID constants for these two items: they are ItemID_Unknown1 and ItemID_Unknown2. Simply replace them with the names you put in the InventoryData (for convenience of course, you're not forced to =) ). This is a way to have descriptive names instead of numbers so they are much easier to remember and use.
Now you need to add functionality to them. Go to the label ItemAction_UseEntry. This is the whole logic for the moment you select the USE command on the menu. Search for these lines of code a little down from that label:
- Code: Select all
cmpi.w #ItemID_NeiSword, d0
beq.w NeiSword_ItemSelected
cmpi.w #ItemID_Teim, d0
beq.w Teim_ItemSelected
cmpi.w #ItemID_Visiphone, d0
beq.w Visiphone_ItemSelected
Add a compare instruction that tests if the items you created were used. So it could be something like
- Code: Select all
cmpi.w #$7E, d0
beq.w MyItem_ItemSelected
cmpi.w #$7F, d0
beq.w MyItem2_ItemSelected
Replace the $7E and $7F with the ID you put for those two items. Give a name you want instead of MyItem_ItemSelected... It was an example of course. Since you said you wanted TP restoring items, you can have code branch to the ItemAction_Monomate routine and then add a check to see which item was used.
You need to add functionality for items used in battle as well. Go to the routine CommandUsed_Item which is the logic for the items used in battle. Whenever an item is chosen, the ID of that item will be put in a register as a variable for the technique process. Basically item use is the same as technique use, only the logic will slightly change according to which command was used. For your TP items, do the same as you did for the item use on the level (or map) screen. Have it branch to monomate and let it process the Res technique, but make sure you check which item was used in this case as well. I think I put comments explaining how HP value for your characters is affected. Do the same thing but with TP obviosuly.
Now you need to make these items accessible in some way. Here are the options available for where to include them:
- Initial equipment. This is the section dealing with this logic: CharInitialSetup. I added a small tutorial on how to change initial items.
- Stores. The start label for this part is StoreEquipItemArray
- Stealing. There's a table of possible items Shir can steal. Here's the starting label: StealItemArray
- Treasure Chests. Here's the table for the treasure chests: TreasureChestContentArray. The process for this is more involved if you want to add new treasure chests because you need edit the object table when loading a level.
I could've missed something. Let me know if it's not clear or you are having trouble.