View Single Post
  #13    
Old August 1st, 2011, 12:35 PM
DavidJCobb
RESIDENT RAAAAAAAAAAAAGEMASTER
 
Join Date: Jul 2010
Gender: Male
Nature: Lonely
Quote:
Originally Posted by EdensElite View Post
Does anyone know the script to make items act as HMs. I want to make a Item that cut trees and lets me surf etc.
I think that would depend on the scripts for trees.

There's only one real difference, I think, between how the press-A-at-tree script is initiated and how an item-based Cut script would work:

When using a Pokemon, you press A on the tree -- it's a Person event. Therefore, when the Cut HM script runs, the game already knows that you are next to and facing the tree. However, your item script can be used from anywhere, so you will have to manually check if the player is next to and facing a tree.

With that sole exception, things would proceed more-or-less as they do when using the normal Cut script. So you'd want to go into a clean FireRed ROM with AdvanceMap, find a Cut tree, and open its script in XSE to see what it does. You'd then copy (or rewrite from scratch, if desired) the relevant parts of the script.

I may provide more info on this (a kind of sub-tutorial) if I feel like it. :\

EDIT1: You'd need two scripts: one for if you press A on the object in the overworld, and one for if you use the item from the Bag. The first is the easiest -- you could take the default scripts from an unaltered FireRed ROM, and change them so that they check for an item instead of an attack.

The second is the hardest because, as I said above, you don't know if the player is next to a tree/rock/etc. OW, and there are no specific commands to find that out. Out of sheer boredom I am doing a search to see if I can, for example, loop through all OWs and check their positions manually.

EDIT2: I can't find a way to check the necessary OW data. Using a Cut item from the Bag requires that one loop through all OWs, checking their positions relative to the player and the sprites they are currently using. (You need to know if the player is next to an OW, and if that OW is a tree.) I can't find any info on this data in RAM.

Last edited by DavidJCobb; August 1st, 2011 at 01:44 PM.