[.pet] Hacking your pet's tricks
Jun 26, 2017 4:47:44 GMT
rafa, Andi @ Cirrutopia, and 4 more like this
Post by Reflet on Jun 26, 2017 4:47:44 GMT
Edit 5/19/22:
This is an extremely old post.
Please see my .pet file breakdown for an in-depth explanation!
Hello, all! For the past few hours I've decided to analyze the section for which tricks a pet knows -- and which treats said tricks are associated with. I think I've figured out the basic layout of the section and how to manipulate values to achieve desired results. Note that I haven't tested every single value, nor do I have a definitive list of which values correspond to what specific tricks (yet!), but here's what I know at this very moment. Also, in case this is relevant, the dog I was testing was a standard AC dalmatian.
The beginning of the trick section begins slightly after the FIRST instance of the string "p.f.magicpetzIII". It begins with a byte that has a value of 60-something (hexadecimal!) -- Not sure if this value changes. In my test pet, it was 64. Following this byte will be three 00 bytes, and then there will EITHER be some value followed by a 02, or FF FF FF FF. Are we in the same place? Good.
That 60-something value marks the beginning of the tricks. The structure is quite straightforward.
Align the bytes so that they're 0x13 (decimal 19) across. In Hex Workshop, you can do this under Options > Preferences > Display Options > General. Group the bytes by 1 and then you can click and drag the border between the bytes and the plaintext in the editor.
Now, I'm going to explain the layout in the context of my image above.
Edit 5/19/22:
This is an extremely old post.
Please see my .pet file breakdown for an in-depth explanation!
The first byte, 64 (or 65, 66, 67, etc), marks the beginning of a new trick. I'm not sure if it affects anything, honestly. Then, you have three 00 bytes. Not important.
The next value will either be some value followed by 02, or it will be FF. From my observation, the value affects which ANIMATION the pet does -- it's not limited to just tricks! The 02... Changing it seemed to change the animation as well, but in the context of tricks, it seems to always be 02. Putting a value of FF FF FF FF seems to either be some form of "default", or the game decides. Usually my pet just looked at me very confused, lol.
The next four bytes of FF FF FF FF seem to be a sort of argument to which animation that's being called. This has most prominent effects on tricks such as the sideways roll -- because it affects the direction at which the pet performs it! A value of 40 (decimal 64) caused my pet to jump to the left, and a value of 80 (decimal 128) caused my pet to jump to the right, regardless of which direction I actually called for!
The third group of FF FF FF FF is another argument to the animation, similar to the one above. Instead of direction, this affects the angle at which the pet performs the trick. A value of 00 00 00 00 caused my pet to roll towards the bottom of the screen, when he should have been rolling left, for example.
Note that the two arguments I just talked about seem to have odd effects on non-trick animations.
Finally, the last byte -- 0A (decimal 10) in my image. This is the value the game uses to determine how likely a pet is to do a certain trick. 0A (decimal 10) is the base value, and it never goes lower than that. 64 (decimal 100) is the maximum value. Every time you call for a trick, whether you give the pet a reward or not affects this value EVERY time! This change is triggered in the following scenarios:
You tell your pet to do a "down" trick. The pet does a trick. You drop the treat. As soon as you let the treat go, the game increases this value, even if you pick the treat back up and put it away! Petting also increases it.
You tell your pet to do a "down" trick. The pet does a trick. You put the treat away. By getting rid of the treat, the game decreases this value.
You tell your pet to do a "down" trick. The pet does a trick. You gesture again for a "down" trick. As soon as you gesture for another trick of the same type, the value goes down, even if you give your pet the treat afterwards!
With the second and third scenarios, decreasing the association value when it is 0A (decimal 10) will cause the game to MAYBE switch the trick in that slot to another, randomly generated trick.
Okay, so that's a rundown of an individual trick "slot". Now for which slots correspond to what type of trick and what treat!
There are 120 slots in total. For every treat, there are 15 slots. Each type of trick gets three slots. The order goes like this:
1, 2, 3 -- toy
4, 5, 6 -- up
7, 8, 9 -- down
10, 11, 12 -- left
13, 14, 15 -- right
NOTE: There are many slots that appear to be unused by any treat.
Slots 1-15 correspond to the chicken treat.
Slots 16-30 correspond to the beef AND bone treats. The game classifies them as the same treat!
Slots 31-45 correspond to the goldfish AND olive treats. Again, the game classifies them as the same.
Slots 46-75 appear to be unused.
Slots 76-100 correspond to the popcorn, cotton candy, AND Luvz treats!
Slots 101-105 appear to be unused.
Slots 106-120 correspond to the cheese treat.
I'll write up a definitive list of which values correspond to what animations at a later date. In the meantime, have fun making your pet do cool tricks... or weird stuff! Note that many combinations of values and arguments will simply cause your pet to look confused and whine. This seems to be the "default" case that the game reverts to if it's given invalid parameters for a trick. In the case of "toy" tricks (and possibly the other types, though I didn't test it), when given a non-trick animation, the pet will jump on the toy and fall over BEFORE doing whatever animation you assigned.
Happy hacking!
This is an extremely old post.
Please see my .pet file breakdown for an in-depth explanation!
The beginning of the trick section begins slightly after the FIRST instance of the string "p.f.magicpetzIII". It begins with a byte that has a value of 60-something (hexadecimal!) -- Not sure if this value changes. In my test pet, it was 64. Following this byte will be three 00 bytes, and then there will EITHER be some value followed by a 02, or FF FF FF FF. Are we in the same place? Good.
That 60-something value marks the beginning of the tricks. The structure is quite straightforward.
Align the bytes so that they're 0x13 (decimal 19) across. In Hex Workshop, you can do this under Options > Preferences > Display Options > General. Group the bytes by 1 and then you can click and drag the border between the bytes and the plaintext in the editor.
Now, I'm going to explain the layout in the context of my image above.
Edit 5/19/22:
This is an extremely old post.
Please see my .pet file breakdown for an in-depth explanation!
The next value will either be some value followed by 02, or it will be FF. From my observation, the value affects which ANIMATION the pet does -- it's not limited to just tricks! The 02... Changing it seemed to change the animation as well, but in the context of tricks, it seems to always be 02. Putting a value of FF FF FF FF seems to either be some form of "default", or the game decides. Usually my pet just looked at me very confused, lol.
The next four bytes of FF FF FF FF seem to be a sort of argument to which animation that's being called. This has most prominent effects on tricks such as the sideways roll -- because it affects the direction at which the pet performs it! A value of 40 (decimal 64) caused my pet to jump to the left, and a value of 80 (decimal 128) caused my pet to jump to the right, regardless of which direction I actually called for!
The third group of FF FF FF FF is another argument to the animation, similar to the one above. Instead of direction, this affects the angle at which the pet performs the trick. A value of 00 00 00 00 caused my pet to roll towards the bottom of the screen, when he should have been rolling left, for example.
Note that the two arguments I just talked about seem to have odd effects on non-trick animations.
Finally, the last byte -- 0A (decimal 10) in my image. This is the value the game uses to determine how likely a pet is to do a certain trick. 0A (decimal 10) is the base value, and it never goes lower than that. 64 (decimal 100) is the maximum value. Every time you call for a trick, whether you give the pet a reward or not affects this value EVERY time! This change is triggered in the following scenarios:
You tell your pet to do a "down" trick. The pet does a trick. You drop the treat. As soon as you let the treat go, the game increases this value, even if you pick the treat back up and put it away! Petting also increases it.
You tell your pet to do a "down" trick. The pet does a trick. You put the treat away. By getting rid of the treat, the game decreases this value.
You tell your pet to do a "down" trick. The pet does a trick. You gesture again for a "down" trick. As soon as you gesture for another trick of the same type, the value goes down, even if you give your pet the treat afterwards!
With the second and third scenarios, decreasing the association value when it is 0A (decimal 10) will cause the game to MAYBE switch the trick in that slot to another, randomly generated trick.
Okay, so that's a rundown of an individual trick "slot". Now for which slots correspond to what type of trick and what treat!
There are 120 slots in total. For every treat, there are 15 slots. Each type of trick gets three slots. The order goes like this:
1, 2, 3 -- toy
4, 5, 6 -- up
7, 8, 9 -- down
10, 11, 12 -- left
13, 14, 15 -- right
NOTE: There are many slots that appear to be unused by any treat.
Slots 1-15 correspond to the chicken treat.
Slots 16-30 correspond to the beef AND bone treats. The game classifies them as the same treat!
Slots 31-45 correspond to the goldfish AND olive treats. Again, the game classifies them as the same.
Slots 46-75 appear to be unused.
Slots 76-100 correspond to the popcorn, cotton candy, AND Luvz treats!
Slots 101-105 appear to be unused.
Slots 106-120 correspond to the cheese treat.
I'll write up a definitive list of which values correspond to what animations at a later date. In the meantime, have fun making your pet do cool tricks... or weird stuff! Note that many combinations of values and arguments will simply cause your pet to look confused and whine. This seems to be the "default" case that the game reverts to if it's given invalid parameters for a trick. In the case of "toy" tricks (and possibly the other types, though I didn't test it), when given a non-trick animation, the pet will jump on the toy and fall over BEFORE doing whatever animation you assigned.
Happy hacking!