Guide:Scanning for entity coordinates

From SlyMods
Jump to navigation Jump to search
Guide:Scanning for entity coordinates
Modding Guide
Game(s)Sly Cooper and the Thievius Raccoonus
Sly 2: Band of Thieves
Sly 3: Honor Among Thieves
DifficultyBeginner
Time to complete5 minutes

You can use this method to find the coordinate addresses of any object that moves in a predictable way. It’s especially easy if you are able to control its position, like the playable characters or the vehicles in Sly Cooper and the Thievius Raccoonus. This method can also be used for other games, as it’s not exclusive to the Sly series.

What you’ll need

  • Cheat Engine
  • PCSX2

Before you begin

You don’t need to use the method below if you already have a pointer to the entity whose position you want. You can just add the correct offset to the pointer value to find the position, no scans necessary.

In Sly 1, the entity position is always at offset 0x150 from the entity base address. This will give you the X, Y, and Z position. In Sly 2 and Sly 3, you will need to first offset to get the Transform Component pointer, then offset that by the position offset from the Transform Component base.

If you don’t have a pointer to the entity but you can find the base address of the entity some other way (such as using the PCSX2 debugger), this method is much faster than scanning. If you aren’t able to find the entity base address, continue on to the scanning method below.

Scanning for coordinate addresses

For playable characters

  1. In Cheat Engine, set the Value Type to Float and the Scan Type to “Unknown Initial Value”. Click First Scan to begin the scan.
  2. Jump and pause the game in mid-air (this means the character’s Z position increased). In Cheat Engine, set the scan type to “Increased Value”, and click Next Scan.
  3. Leave the game paused (so the character’s position is unchanged). Set the scan type to “Unchanged Value” and click Next Scan.
  4. Unpause the game and let the character fall down (this means the character’s Z position decreased). Set the scan type to “Decreased Value” and click Next Scan.
  5. Repeat steps 2, 3, and 4 until you’ve narrowed it down a few hundred results. Ideally you should have as few results as possible before continuing.
  6. Add all the results to your cheat table.
  7. Freeze half of the results and try to jump. If the character is stuck, the address you are looking for is one of the ones your froze, so delete the other half. If they do jump, you know it’s one of the other half, so delete the ones that you froze.
  8. Repeat that step, freezing half of the result each time, until you narrow it down to just one result.

Now that you have one result, the Z coordinate, you can find the X and Y coordinates easily. Due to the way values are aligned in memory, the coordinate values are always right next to each other. all you need to do is change the last digit of the Y address to find the others.

  • The X coordinate address will always end in 0
  • The Y coordinate address will always end in 4
  • The Z coordinate address will always end in 8

Simply change the last digit from 8 to 0 or 4 to get the X and Y coordinates, respectively.

For other entities

To find the coordinate addresses of other entities, the process is very similar to the above, except you obviously don’t have full control over their movement. The method works best with entities that have predictable movement patterns, like guards.

Use the same steps as above, but instead of using the Y coordinate, use whatever coordinate makes the most sense based on the entity’s movement. For instance, if you have a guard that walks back and forth in a straight line along the X axis, use the X coordinate. Scan for an Increased Value when the guard walks in the positive X direction, and a decreased value when the guard walks in the negative X direction.