Npc Hacking!

Apr 21, 2006 at 10:40 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Apr 21, 2006 at 11:17 PM
Senior Member
"Master using it, and you can have this!"
Join Date: Feb 4, 2006
Location:
Posts: 73
ShInInG PhAnToM said:
Figured a way out for NPC hacking!!
Here : http://www.filespace.org/ShInInG_PhAnToM/NPC.TXT

Nice, but it's just for Behemoth so far ;).

If you could, when (or if) you finish listing all the NPCs, to have an Editor like Sue's Workshop? Something that we open up and we can use to simple-edit these, that would be awesome!
 
Apr 22, 2006 at 6:48 AM
Junior Member
"Wow! The more I drink of this magical beverage, the more games I can play! Wheee!"
Join Date: Nov 30, 2005
Location:
Posts: 25
This is awesome. I'm glad npc.tbl hacking is finally making some progress.

There's probably some logical order to the locations of all the values, so once we find enough values we might be able to figure out where everything else is. All I've found so far is Balrog 1's health, which is at 35A.
 
Apr 22, 2006 at 8:51 AM
Senior Member
"This is the greatest handgun ever made! You have to ask yourself, do I feel lucky?"
Join Date: Apr 14, 2006
Location:
Posts: 112
May as well chuck this value in here: Monster Sue health value is at 50A
 
Apr 23, 2006 at 12:33 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Well it's just in logical order:

Sprite 2 is the Behemoth right?
and Sprite 1 is the Weapon energy Shard...

So it's a logical order, if the Behemoth live take 2 places (2DA and 2DB) The Weapon energy Shard is 2D8 and 2D9, it's easy...
And u also can change the Damage of the Projektils!!
 
Apr 23, 2006 at 1:57 PM
Senior Member
"Master using it, and you can have this!"
Join Date: Feb 4, 2006
Location:
Posts: 73
Wait, how? I'm looking for the Blade and Bubbler in particular...

Also, is there a way to change the Weapon Sound Effects?
 
Apr 24, 2006 at 6:15 AM
Junior Member
"Wow! The more I drink of this magical beverage, the more games I can play! Wheee!"
Join Date: Apr 1, 2005
Location:
Posts: 28
How did you find these out? Is there a way to trace when and where the program accesses external files? I was looking at windows debuggers but nothing seems to work the way I'm used to.
 
Apr 24, 2006 at 10:07 AM
Junior Member
"Wow! The more I drink of this magical beverage, the more games I can play! Wheee!"
Join Date: Apr 1, 2005
Location:
Posts: 28
Okay, I've figured out a lot just by looking through it in a hex editor. NPC.TXT was a major help, thank you for putting that together.


NPC.TBL has data for 361 entities (0000-0360). That's 169 in hex.

The data is stored in sets, one for each entity parameter, with values 1, 2, or 4 bytes in length. Each set has 361 entries, one for each entity, then the next set begins back at entity 0000. So, each set is a multiple of 169h bytes, and so the starting address of each set will be a multiple of 169h.


There are 11 sets:
0x0000 - 2 bytes (16 bit flags)
0x02D2 - 2 bytes (1 word)
0x05A4 - 1 byte
0x070D - 1 byte
0x0876 - 1 byte
0x09DF - 1 byte
0x0B48 - 2 bytes (1 word)
0x0E1A - 2 bytes (1 word)
0x10EC - 4 bytes (1 dword)
0x1690 - 4 bytes (seperate values)
0x1C34 - 4 bytes (seperate values)

All multi-byte values are little endian (low byte first).


As you already figured out, 0x02D2 is HP, 0x070D is PBM (graphics file), and 0x10EC is attack power. The last two sets both involve height and width (one might be hitbox?). However, the first set, the values you were listing, are actually flags. So you don't need to worry about figuring out what all those 256 bytes do.

Since the values are little endian, the bits are arranged as such:
76543210 FEDCBA98

So, for example, those 80h bytes, or 10000000b, just mean that flag F is on. Behemoth is 21 80 in hex, or 10110001 10000000 in binary. Matching that up:
Code:
76543210 FEDCBA98
10110001 10000000
you get flags 0, 4, 5, 7, and F.


So what are the flags? Most of these were figured out from the list in NPC.TXT:
F - Show HP when damaged
E - <unused> [disables entity - no real use]
D - <unused> [Attack power 0, not shootable - redundant]
C - <unused>
B - <unused>
A - <unused>
9 - [??? - priest Ballos only - no damage animation, can't be destroyed]
8 - <unused> [Attack power 0 - redundant]
7 - Rear attack power 0
6 - Solid
5 - Shootable
4 - Bounce top (behemoth)
3 - Ignores tile solidity
2 - Invulnerable (makes *tink* sound when shot)
1 - [??? - critter in Eggs only]
0 - Bounce, solid top (some enemies)

I know people were wondering how Santa walks over the little "bridge", it's because he has flag 3 set. Basically, he's flying along the ground, not actually walking on it.
 
Apr 26, 2006 at 5:18 AM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Well, i just change it and... start the game over 500 times???

EDIT:

Well, thank kapow, iam working on it and update this little one!

Well, and u actually have a special thanks in my mod!(well it's not updated yet...)
 
May 13, 2006 at 6:02 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
Hey yeah, update look at my download page!
 
Jun 29, 2006 at 5:28 AM
The Bartender
"All your forum are belong to us!"
Join Date: Jun 18, 2006
Location: Montreal, Canada
Posts: 581
Age: 39
A few precisions.

0x0000 [2 bytes] Flags.
0x02D2 [2 bytes] Health
0x05A4 [1 byte] Tileset
0x070D [1 byte] Sound to play on death
0x0876 [1 byte] Sound to play on damage
0x09DF [1 byte] Animation to play when dead (0x00 - 0x03)
0x0B48 [4 bytes] Experience dropped by enemy. May also affect items.
0x10EC [4 bytes] Damage
0x1690 [4 bytes] Collsion Bounding Box
0x1C34 [4 bytes] Display Bounding Box

The bounding boxes are 4 byte objects.

0x00 Left
0x01 Top
0x02 Right
0x03 Bottom

A sprite is always drawn using the top and left or right (depending on its direction) corner of the bounding box. This is offset from the center of the sprite, by the way: a 16x16 sprite with a bounding box of 8,8,8,8 is perfectly centered. 0,0,8,8 will offset it 8 pixels to the left/up.
 
Jun 29, 2006 at 8:24 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
thanks, it will help me much!!
You became a credit in new npc hacking faq (Iam not thinking i go to make a new version my father maybe will make a editor where yuo become a credit...)
 
Jun 29, 2006 at 9:23 PM
The Bartender
"All your forum are belong to us!"
Join Date: Jun 18, 2006
Location: Montreal, Canada
Posts: 581
Age: 39
I just figured I'd share my knowhow after stumbling on the code which handles it. :)

Basically, there's an NPC structure and an Object structure. Objects use NPC IDs to identify themselves; NPCs are loaded at startup and serve as reference material. NPC.tbl could've easily been included in the exe, but it wasn't. :p

Objects run a script of some kind that's almost 100% certainly written as machine code. From what I gather, Objects have a built-in timer which runs up until a certain point. It then resets and changes the Object's internal state. The elevators (NPC 25 I think?) switch between 9 or so states (stopped, moving up, moving down, for all three levels) for instance. Unfortunately i haven't found out where these scripts are coded yet. I saw some cool stuff around 3:30 am yesterday, but I had work the next morning and didn't get to look at that code yet.

It is my understanding that bullets fired from one's weapon PROBABLY aren't Objects. A few tests turned up nothing. I'm not discarding the possibility yet however - I'll have a closer look at the code run by weapons and see what I can find there.
 
Jun 29, 2006 at 9:41 PM
Hoxtilicious
"Life begins and ends with Nu."
Join Date: Dec 30, 2005
Location: Germany
Posts: 3218
Age: 32
You will post it as public? I hope so, because it will be for my editor!
 
Jun 30, 2006 at 12:04 AM
The Bartender
"All your forum are belong to us!"
Join Date: Jun 18, 2006
Location: Montreal, Canada
Posts: 581
Age: 39
Like I said, I don't give out answers on a silver platter unless plenty of work has already been done regarding it (such as NPCs, for instance - I felt I'd just fill in the blanks.) >"< At best I'll give out the important adresses and let ROM hackers find out info to the best of their abilities.

I don't believe in editors, unless they're for tedious work (graphics/maps/etc mainly; you'd have to be nuts to edit an image in hex.) I believe a hack should be only as good as the amount of effort put into it. And I sure as hell haven't been staying up until 3 AM on weeknights just so others can blindly change offset xyz's value to "4" knowing nothing more than "it makes you flash blue instead of green." :)

So no, sorry, I won't hand out answers on a silver platter. I'll post offsets, but the actual work should be part of a hacker's job. And if it proves beyond a particular hacker's skills, then that should be incentive to learn. :p

And seeing as, in this case, it's code and not data, it can't be edited with an editor anyhow. So it's a moot point. ^^;
 
Jul 7, 2006 at 3:24 AM
The Bartender
"All your forum are belong to us!"
Join Date: Jun 18, 2006
Location: Montreal, Canada
Posts: 581
Age: 39
Found something new. If bit 8 is set (ie, the 1 in 81 20 for instance, for you non-binary people) in the flags, an enemy can drop hearts along with exp. I was wondering why none of my enemies were dropping health pickups - now I know. :o
 
Feb 11, 2007 at 10:26 PM
Senior Member
"Master using it, and you can have this!"
Join Date: Feb 19, 2006
Location:
Posts: 73
Thanks for posting all of this up. Much appreciated.
 
Top