Posts: 152
Threads: 5
Joined: Mar 2009
08-26-2009, 10:47 AM
ok i am here
i tried to make a state where tou charge mp without a beer and it has a limit too
here
is the code
ASM-Code:
;part of state8xxx proc
charging:
CMP EAX,6000
jl return
CMP EAX,7000
jge return
sub eax,6000
mov ebp,dword ptr ds:[esi+eax*4+194h]
mov ecx,dword ptr ds:[ebp+308]
add ecx,eax
cmp ecx,500
jge short no_charge
no_charge:
sub ecx,500
add ecx,500
|
please tell me whats wrong
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
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.
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ʟᴇᴇᴘ.
Thanks given by:
Posts: 152
Threads: 5
Joined: Mar 2009
ASM-Code:
State8xxx proc
CMP EAX,1F40h
jl state4xxx
CMP EAX,2328h
jge state4xxx
jmp Transform1
state4xxx:
;I didn't bother really understanding the code, just copied it
;there is only 1 line you should edit, I commented it :p
CMP EAX,0FA0h
jl timestop
CMP EAX,1388h
jge timestop
MOV ECX,DWORD PTR DS:[EBX+7D4h]
LEA EDX,DWORD PTR DS:[EAX-0FA0h]
XOR EAX,EAX
CMP DWORD PTR DS:[ECX+4D82380h],EAX
JLE a
d: MOV ESI,DWORD PTR DS:[ECX]
CMP DWORD PTR DS:[ESI+6F4h],EDX
JE b
MOV ESI,DWORD PTR DS:[EBX+7D4h]
ADD EAX,1
ADD ECX,4
CMP EAX,DWORD PTR DS:[ESI+4D82380h]
JL d
JMP a
b: MOV ECX,DWORD PTR DS:[EBX+7D4h]
MOV ECX,DWORD PTR DS:[ECX+EAX*4h]
MOV EAX,DWORD PTR DS:[EBX+EDI*4+194h]
MOV DWORD PTR DS:[EAX+368h],ECX
a: MOV EDX,DWORD PTR DS:[EBX+EDI*4+194h]
MOV DWORD PTR DS:[EDX+70h],0 ; this line sets your frame number to 0, remove it if you want
MOV EAX,DWORD PTR DS:[EBX+EDI*4+194h]
timestop:
CMP EAX,10000
jl charging
CMP EAX,20000
jge charging
sub eax,10000
push ecx
lea ecx, dword ptr ds:[memAlloc+edi*4+edi]
mov dword ptr ds:[ecx+1],eax
mov byte ptr ds:[ecx],1
pop ecx
charging:
CMP EAX,6000
jl return
CMP EAX,7000
jge return
sub eax,6000
mov ebp,dword ptr ds:[esi+eax*4+194h]
mov ecx,dword ptr ds:[ebp+308]
add ecx,eax
cmp ecx,500
jge short no_charge
no_charge:
sub ecx,500
add ecx,500
return: jmp Transform2
State8xxx endp
|
i used the state8xxx proc
im gonna change it a bit i guess and see
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
08-27-2009, 02:41 PM
(This post was last modified: 08-27-2009, 02:48 PM by Boop.)
Code: charging:
CMP EAX,6000
jl return
CMP EAX,7000
jge return
sub eax,6000
MOV EDX,DWORD PTR DS:[EBX+EDI*4+194h]
add dword ptr ds:[edx+308h],eax
cmp dword ptr ds:[edx+308h],500
jle return
mov dword ptr ds:[edx+308h],500
return: jmp Transform2
That should work.
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ʟᴇᴇᴘ.
Thanks given by:
|