08-26-2009, 03:55 PM
Post the entire proc, because your code is really messed up, so I doubt you got the rest of it right.
CMP EAX,6000
jl return
CMP EAX,7000
jge return
sub eax,6000
mov ebp,dword ptr ds:[esi+eax*4+194h]
I assume the EAX contains the state number, so you make sure it is between 6000 and 7000 then subtract 6000, at this point EAX contains how much mp you want to recover. Then you try loading the character pointer, and treat EAX as the character number, which is obviously isn't.
You shouldn't be using ebp - ebp and esp are special, you shouldn't be touching them unless you know what you are doing.
mov ecx,dword ptr ds:[ebp+308h]
You forgot the h after 308.
add ecx,eax
mov dword ptr ds:[ebp+308h],ecx (shouldn't be ebp)
You add eax to ecx, which means now ecx contains how much mp he should have. The problem is, you never set the characters mp to what you want.
cmp ecx,500
jge short no_charge
no_charge:
sub ecx,500
add ecx,500
You're taking 500 off, then add 500. That's pretty much like doing nothing, I don't get the point of that.
If you don't want the mp to go over 500, then replace those 2 lines with
mov dword ptr ds:[ebp+308h],500
You should post the rest of your code.
CMP EAX,6000
jl return
CMP EAX,7000
jge return
sub eax,6000
mov ebp,dword ptr ds:[esi+eax*4+194h]
I assume the EAX contains the state number, so you make sure it is between 6000 and 7000 then subtract 6000, at this point EAX contains how much mp you want to recover. Then you try loading the character pointer, and treat EAX as the character number, which is obviously isn't.
You shouldn't be using ebp - ebp and esp are special, you shouldn't be touching them unless you know what you are doing.
mov ecx,dword ptr ds:[ebp+308h]
You forgot the h after 308.
add ecx,eax
mov dword ptr ds:[ebp+308h],ecx (shouldn't be ebp)
You add eax to ecx, which means now ecx contains how much mp he should have. The problem is, you never set the characters mp to what you want.
cmp ecx,500
jge short no_charge
no_charge:
sub ecx,500
add ecx,500
You're taking 500 off, then add 500. That's pretty much like doing nothing, I don't get the point of that.
If you don't want the mp to go over 500, then replace those 2 lines with
mov dword ptr ds:[ebp+308h],500
You should post the rest of your code.
![[Image: doty7Xn.gif]](http://i.imgur.com/doty7Xn.gif)
10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.