Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can someone check this for me?
#1
I want to bring the enemy into a frame(#XXX) when his red hp is lower than #YYY %
(I had changed to code after Lord Silva gave me some suggestion)
This is my code
Code:
frame_event:
    sub eax,2000000   ; take off the '2' in front
    mov ebx,1000
    mov edx,0
    idiv ebx
    xor ebx,ebx
    mov ebx,eax
    xor eax,eax
    mov eax,edx
    xor edx,edx  ; separate number #2XXXYYY into #XXX, #YYY. #XXX is stored in ebx, #YYY is stored in eax, EDX is cleared.
    mov ecx,dword ptr ds:[esi+edi*4+194h]
    mov edx,dword ptr ds:[ecx+368h]
    cmp dword ptr ds:[edx+6F8h],0                          ; check the target is type 0 or not
    jnz r2
    mov ecx,dword ptr ds:[esi+edi*4+194h]
    mov edx,dword ptr ds:[ecx+368h]
    push eax                                               ; push the eax into temporary memory
    xor eax,eax
    mov eax,dword ptr ds:[edx+304h]                        ; MaxHP is stored in eax
    xor ecx,ecx
    xor edx,edx
    mov ecx,100
    mov edx,0
    idiv ecx                                               ; Divied the MaxHP into 100(change into % state)
    xor edx,edx  
    xor ecx,ecx  
    mov eax,ecx                                            ; Move MaxHP into ecx
    xor eax,eax                                  
    mov eax,dword ptr ds:[edx+2fch]                        ; Get the red HP(eax) into eax
    mov edx,0
    idiv ecx                                               ; Divied the red HP by MaxHP(get the percentage)
    xor edx,edx
    xor ecx,ecx  
    pop ecx                                                ; Get the percentage into ecx                                              
    cmp ecx,eax
    jl r2                                                 ; check if red hp is lower than #YYYYY
    xor eax,eax
    mov eax,ebx
    mov ecx,dword ptr ds:[esi+edi*4+194h]
    mov dword ptr ds:[ecx+70h],eax             ; if red hp is lower, move character to frame at indicated number #XXX.
    jmp r2
When I attack an enemy, the LF2 is close automatically and I don't know what wrong in this code.
Please help me :'(

(
Sorry for my poor english.
I will improve it.:D
Please try to understand my english and correct me if I use it wrong.
Thankyou
Reply
Thanks given by:


Messages In This Thread
Can someone check this for me? - by Thomas - 11-06-2009, 01:38 AM
RE: Can someone check this for me? - by Boop - 11-06-2009, 06:29 AM
RE: Can someone check this for me? - by Thomas - 11-07-2009, 12:11 AM
RE: Can someone check this for me? - by Boop - 11-07-2009, 07:32 AM



Users browsing this thread: 1 Guest(s)