Help editing damage

Jan 8, 2009 at 10:27 PM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
Does anyone know how to change the damage done by a sand crocs bite, or a bat spawned by the red bat generator in last cave? The information found here (http://spgardebiter.sp.funpic.de/CaveStory/FAQ/NPC.txt) although very awesome appears to be insufficient.

EDIT: problem solved croc damage is stored in the game exe, not npc.tbl. There locations are as follows...
sandzone croc: 2F571
outerwall croc: 515A0

Thank you Sshsigi well done
 
Jan 8, 2009 at 10:36 PM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
I don't know about the sandcroc, although the bats shouldn't be too difficult. While the data for the bat spawner in npc.tbl doesn't contain the bat's damage, the data for the bats themselves in npc.tbl does.
 
Jan 9, 2009 at 12:15 AM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
I changed the start point bats to 1 damage, and both grasstown bats, the spawned bats still hit for 2. Hmm... how many other bats are out there... miserys projectile, and transformed miserys projectile... i guess i'll change both of them too and see if it works.

~Edit: The orange bats transformed misery shoots at you claim to do 0 damage. And when changed continue to do 2 damage, as well as the last cave bats. I changed the damage from sprite 249 (possibly miserys bats in the throne room) to 5 damage, and the spawned bats remain the same. There must be a way to find where these guys get there damage.
 
Jan 9, 2009 at 12:23 AM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
No, the spawned bats are an entirely different entity. They might not be documented in whatever entity list you are using, so you might need to do some experimenting on your own to figure out what entity number the spawned bats are.

EDIT: the spawned bats are entity number 242
 
Jan 9, 2009 at 12:25 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
SeriousFace said:
I changed the start point bats to 1 damage, and both grasstown bats, the spawned bats still hit for 2. Hmm... how many other bats are out there... miserys projectile, and transformed miserys projectile... i guess i'll change both of them too and see if it works.

The entity that the bat generator spawns is entity 242, the red bat. That's the data you should be editing.

Also entity 47 is the Sand croc (Sandzone sand croc), but I'm not sure if you can edit his damage or not.

Oh, and I would recommend using cave editor to edit the values on the npc.tbl, but don't open up a doukutsu.exe that you plan to edit with sue's workshop later, because caveeditor edited .exe's are not compatible with SW once it has been edited. If you plan to use SW, just copy the game + folder, and edit the values, then copy the npc.tbl of the one you edited into the one you plan to edit with SW.
 
Jan 9, 2009 at 12:52 AM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
The bat generator damage claims 0, change it and the spawned bats continue to hit for 2. I thought i said that in the first post.

I use XVI32 for all my hex editing needs, but thanks for that tip.
 
Jan 9, 2009 at 12:56 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
SeriousFace said:
The bat generator damage claims 0, change it and the spawned bats continue to hit for 2. I thought i said that in the first post.

I use XVI32 for all my hex editing needs, but thanks for that tip.

The red bat generator is entity 243 (assuming entity 1 is the first entity, not starting at 0), and the entity right before it (242) is the red bat entity.

Edit: CaveEditor is really good at handling entity value changes i find.
 
Jan 9, 2009 at 1:38 AM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
Ty gir, i don't know how i missed that... Its listed right there in sues workshop under "last cave" litteraly the first place i looked. Then i looked on the actual map for bats that weren't spawned by the thing, and didn't find any. Thanks again. ( I feel like quite the douch, u said that in your first post but i overlooked it thinking u ment the generator. Sorry my mistake )

I don't think the sandcroc will be as obvious tho.
 
Jan 9, 2009 at 2:56 AM
Lvl 1
Forum Moderator
"Life begins and ends with Nu."
Join Date: May 28, 2008
Location: PMMM MMO
Posts: 3713
Age: 32
SeriousFace said:
Ty gir, i don't know how i missed that... Its listed right there in sues workshop under "last cave" litteraly the first place i looked. Then i looked on the actual map for bats that weren't spawned by the thing, and didn't find any. Thanks again. ( I feel like quite the douch, u said that in your first post but i overlooked it thinking u ment the generator. Sorry my mistake )

I don't think the sandcroc will be as obvious tho.


It should be, the only reason I'd think it would be is because in CaveEditor's Npctbl Editor, the Sandcroc's attack is listed as 0, so I have no clue whether it can be edited down, but it might be able to edit it up maybe....

Sandcroc is entity 47, CaveEditor lists which entities are which in the Npctbl editor, seriously pick it up if you haven't tried it out already.
 
Jan 9, 2009 at 12:32 PM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
Actually, I'm pretty sure that the sandcroc's damage is not stored in npc.tbl. The damage values in npc.tbl are the damage values for when you make contact with the entity, not when the entity does something weird that does damage.

If a sandcroc has already popped out of the ground, and you touch it, it doesn't do any damage. If you changed the damage value in npc.tbl for the sandcroc, that would make it do that much damage when you touch it after it has tried to bite you, but it wouldn't change the damage that is does when it bites you.

Another example of this is the gravekeeper. I would guess that the gravekeeper has a damage value of 0 in npc.tbl because touching the gravekeeper does no damage, but getting slashed at by it does.
 
Jan 10, 2009 at 5:22 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
On the other hand, you can't walk through the sandcrocs as you can with bats or critters...
 
Jan 13, 2009 at 1:58 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
Huh. You're right. :eek:

How'd I miss that? :eek:
 
Jan 13, 2009 at 9:39 PM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
So, i had a theory that the croc bite is an invisable projectile. So i went thru all the entities, and anything unidentified whose damage value equaled 10 i'd change, get hit by a croc, and hope to see new damage. Unfortunatly this theory proved wrong after testing all the hopefuls, and there was no unidentified entity with 15 damage for the outer wall crocs. Sigh... Anyone even have ideas how to find this?

Also, another thing i'd like to change the damage on. Tile option 42 and 62 (spikes from the map), 10 damage spikes that afaik arn't even entities.
 
Feb 2, 2009 at 6:27 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Jan 3, 2009
Location:
Posts: 36
The SandCroc's bite works by setting the damage value to 10 once his closing jaws animation reaches frame 3 during state 2 of the AI routine 42f3f0. It goes like this:

PHP:
case 2:
if (++o->animtimer > 3)
{
o->animtimer = 0;
o->frame++;
}

if (o->frame==3) o->damage = 10;

if (o->frame==4)
{
o->flags |= FLAG_SHOOTABLE;
o->state = 3;
o->timer = 0;
}
break;

The value you want to edit is the immediate value of the MOV instruction at 0042F56B; open your hex editor and go to 2f56b in the file and you will see C782 A4000000 0A000000.

The 0A is the "10", which causes the sandcroc to do 10 damage on touch. The damage will be reset to 0 as soon as the sandcroc enters state 4.

The -10 damage spikes are tiles. The big -127 spikes, however, are objects. Suggest setting memory breakpoint on your actual_health variable at 49e66c and getting hit by a -10 spike.

An interesting note on the spikes that deal -127 damage--did you ever wonder, "why -127"? You might assume that the damage value is a signed char and so -127 would be close to the maximum possible damage you could get (technically it would be -128). But no, when they call the damage routine the value is a int. And values lower than -127 work just fine. My theory is it's just for stylistic reasons. An interesting neat little touch in that light, don't you think?
 
Feb 2, 2009 at 8:18 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
sshsigi said:
An interesting note on the spikes that deal -127 damage--did you ever wonder, "why -127"? You might assume that the damage value is a signed char and so -127 would be close to the maximum possible damage you could get (technically it would be -128). But no, when they call the damage routine the value is a int. And values lower than -127 work just fine. My theory is it's just for stylistic reasons. An interesting neat little touch in that light, don't you think?
Maybe the health value is stored in a signed char? Then -127 would be enough to guarantee that the resulting health is <= 0.
 
Feb 2, 2009 at 9:17 PM
graters gonna grate
"Heavy swords for sale. Suitable for most RPG Protagonists. Apply now!"
Join Date: Jul 2, 2008
Location: &
Posts: 1886
Age: 31
No, I don't think the health value is a signed char. I seem to remember making a minimod in which the health went above 127 and it worked fine.
 
Feb 2, 2009 at 9:44 PM
Junior Member
"It's dangerous to go alone!"
Join Date: Jan 3, 2009
Location:
Posts: 36
Celtic Minstrel said:
Maybe the health value is stored in a signed char? Then -127 would be enough to guarantee that the resulting health is <= 0.

Hmm that is an interesting take on it. And explains why not -128--since the maximum positive range of a signed char is +127. +127 + -127 is 0 hp left. I didn't think of that.

But no, it is an integer. Try it: write 0x2000 to the remaining health variable at 49e6cc. Your bar will jump to 8192 health and you can just mosey down those steps at the entrance to Hell while standing right in the middle of all the spikes and none of them will kill you because they're still only doing you -127 damage.

On the other hand, set at breakpoint at 4193b1 and walk into some spikes. When it stops, modify ECX to 0x200 and continue, and you'll have -512 damage dealt to you.

The variable each entity has that stores how much damage it does to the player on contact (+A4 into each object struct) is also an int. So is the value in npc.tbl that holds the default damage amounts for each entity. As far back as I can trace it anyway, it's an int. Yet, -127.

If you think about it, what else would it be? -999? That wouldn't look as good, would it? Or, maybe one or more of those values USED to be a signed char, like in one of the beta versions, but it didn't work out well that way.
 
Feb 2, 2009 at 11:33 PM
In front of a computer
"Man, if only I had an apple..."
Join Date: Mar 1, 2008
Location: Grasstown
Posts: 1435
sshsigi said:
Or, maybe one or more of those values USED to be a signed char, like in one of the beta versions, but it didn't work out well that way.
This seems to be to be the most logical explanation.
 
Feb 3, 2009 at 1:05 AM
Been here way too long...
"..."
Join Date: Jan 21, 2006
Location:
Posts: 369
sshsigi said:
open your hex editor and go to 2f56b in the file and you will see C782 A4000000 0A000000.

The 0A is the "10", which causes the sandcroc to do 10 damage on touch.

Worked like a charm, thank you very very much.
I tried searching for the same string but 0F instead of 0A hoping this would take me to the outerwall sand croc, but "string not found" ... ;__;

sshsigi said:
The -10 damage spikes are tiles. The big -127 spikes, however, are objects. Suggest setting memory breakpoint on your actual_health variable at 49e66c and getting hit by a -10 spike.

I really wish i understood this.


About the spike damage I have no opinion why 127, but has anyone else messed with rediculously large values for damage? Make the damage on something FF FF 00 00 and get hit. You go into hit invincibility and a hurt bounce like normal, you see a huge red -X life, and your weapon levels down to minimum. But you heal 1hp, even above your max. Making your weapons to strong also messes things up. Above a certain points you heal entities (again above max hp is possible), and it'll even say +X. Keep making your weapons stronger and eventually they won't even hit entities.
 
Top