Posts: 10
Threads: 6
Joined: Nov 2013
01-06-2014, 09:48 PM
(This post was last modified: 01-06-2014, 11:34 PM by Suzuya.)
Hi,
here's another code of mine (I know, I'm updating them frequently, but I thought it may be useful for some of you ;p). This time I was trying to make levels like in some kind of rpg and guess what. It's working! I've made new effect, which checks how much total damage you've dealt and your basic injury value is increased by some percent. Code:
-ofc state 311, or something that stores your object number in mp bar (it's needed by second code, which is written specially for balls and other skills, not by characters)
Code: lvl_up:
MOV EAX,DWORD PTR SS:[ESP+0Ch]
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h] ;target
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h] ;attacker
MOV EDX,DWORD PTR DS:[EDX+348h] ;total attack
cmp edx,200
jl lv1
cmp edx,500
jl lv2
cmp edx,1000
jl lv3
cmp edx,1700
jl lv4
jmp lv5
lv2:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,1
mul ebx
mov ebx,2
xor edx,edx
div ebx
mov ebx,eax
jmp lv
lv3:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,3
mul ebx
mov ebx,4
xor edx,edx
div ebx
mov ebx,eax
jmp lv
lv4:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,1
mul ebx
mov ebx,1
xor edx,edx
div ebx
mov ebx,eax
jmp lv
lv5:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,5
mul ebx
mov ebx,4
xor edx,edx
div ebx
mov ebx,eax
lv:
MOV EAX,DWORD PTR SS:[ESP+0Ch]
MOV EDX,DWORD PTR DS:[EAX+44h]
mov eax,edx
add eax,ebx
mov edx,eax
MOV EAX,DWORD PTR SS:[ESP+0Ch]
pop ebx
sub DWORD PTR DS:[ECX+2FCh],edx
mov ecx,edx
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
add DWORD PTR DS:[EDX+348h],ecx
mov edx,ecx
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
add DWORD PTR DS:[ECX+34Ch],edx
lv1:
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
cmp DWORD PTR DS:[ECX+2FCh],0
jle b11
b11:
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
mov eax,dword ptr ds:[esi+edi*4+194h]
jmp dword ptr [ef_r1]
Code: lvl_up_ball:
MOV EAX,DWORD PTR SS:[ESP+0Ch]
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
push edi
MOV edi,DWORD PTR DS:[EDX+308h]
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
cmp byte ptr ds:[esi+edi+4],0
je xb12
cmp edi,500
je xb12
;cmp DWORD PTR DS:[ECX+2FCh],0
;jle xb12
mov eax,DWORD PTR DS:[ECX+348h]
MOV DWORD PTR DS:[EDX+300h],eax
pop edi
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
MOV EAX,DWORD PTR SS:[ESP+0Ch]
MOV EDX,DWORD PTR DS:[EDX+300h] ;total attack
cmp edx,200
jl xlv1
cmp edx,500
jl xlv2
cmp edx,1000
jl xlv3
cmp edx,1700
jl xlv4
jmp xlv5
xlv2:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,1
mul ebx
mov ebx,2
xor edx,edx
div ebx
mov ebx,eax
jmp xlv
xlv3:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,3
mul ebx
mov ebx,4
xor edx,edx
div ebx
mov ebx,eax
jmp xlv
xlv4:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,1
mul ebx
mov ebx,1
xor edx,edx
div ebx
mov ebx,eax
jmp xlv
xlv5:
MOV EDX,DWORD PTR DS:[EAX+44h] ;injury
push ebx
mov eax,edx
mov ebx,5
mul ebx
mov ebx,4
xor edx,edx
div ebx
mov ebx,eax
xlv:
MOV EAX,DWORD PTR SS:[ESP+0Ch]
MOV EDX,DWORD PTR DS:[EAX+44h]
mov eax,edx
add eax,ebx
mov edx,eax
MOV EAX,DWORD PTR SS:[ESP+0Ch]
pop ebx
sub DWORD PTR DS:[ECX+2FCh],edx
mov ecx,edx
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
add DWORD PTR DS:[EDX+348h],ecx
mov edx,ecx
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
add DWORD PTR DS:[ECX+34Ch],edx
xlv1:
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
cmp DWORD PTR DS:[ECX+2FCh],0
jle xb11
xb11:
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
mov eax,dword ptr ds:[esi+edi*4+194h]
jmp dword ptr [ef_r1]
xb12:
pop edi
mov DWORD PTR DS:[EDX+70h],40
jmp xb11
And now some DC (deep_ball):
DC-Code:
<frame> 0 flying
pic: 999 state: 311 wait: 1 next: 50 dvx: 0 dvy: 0 centerx: 40 centery: 41 hit_a: 0 hit_d: 40 hit_j: 0
<frame_end>
<frame> 50 flying
pic: 0 state: 3000 wait: 1 next: 1 dvx: 15 dvy: 0 centerx: 40 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
<frame> 1 flying
pic: 1 state: 3000 wait: 1 next: 2 dvx: 15 dvy: 0 centerx: 35 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
<frame> 2 flying
pic: 2 state: 3000 wait: 1 next: 3 dvx: 15 dvy: 0 centerx: 36 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
<frame> 3 flying
pic: 3 state: 3000 wait: 1 next: 4 dvx: 15 dvy: 0 centerx: 37 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
<frame> 4 flying
pic: 2 state: 3000 wait: 1 next: 5 dvx: 15 dvy: 0 centerx: 40 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
<frame> 5 flying
pic: 1 state: 3000 wait: 1 next: 50 dvx: 15 dvy: 0 centerx: 40 centery: 41 hit_a: 50 hit_d: 40 hit_j: 0
itr:
kind: 0 x: 22 y: 27 w: 55 h: 27 dvx: 7 fall: 70 vrest: 10 bdefend: 16 injury: 55 effect: 77
itr_end:
bdy:
kind: 0 x: 22 y: 27 w: 55 h: 27
bdy_end:
<frame_end>
|
Edit:
It would be nice to change visual effect when the ball hits something, because Deep's ball had effect: 1 and now this bloody effect is gone. ;c
Edit:
Improved the code, because it was unintentionally changing target's hp to 500, when it's value was higher.
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
You should tell people where the assembly code goes (as in which proc). I literally have no idea where I would copy paste that code by just looking at it, and I would say I'm one of the more familiar people with the codebase.
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: 10
Threads: 6
Joined: Nov 2013
Oh, yea, maybe you're right, my bad then. ^^'
It goes ofc to itreff.inc, to itr_effect_fall as it is one of the effects. Thought it's not that hard to find out, because there's 'jmp dword ptr [ef_r1]' at the end of the code, but I'll try to make everything more clear next time.
I've asked if there's any possible way to store object number and some other stuff, like buffs or something in some unused addresses (I need like 3 addresses) in one of my posts, but I don't know if anyone seen that, because it was an edit of a post, not actually new post. So I ask again, because storing these in mp or hp bar isn't the best choice.
Thanks given by:
Posts: 1,018
Threads: 60
Joined: Mar 2008
01-29-2014, 07:46 PM
(This post was last modified: 01-29-2014, 07:47 PM by Boop.)
Whoa, its been a week :P. To store extra numbers you need to allocate more memory. Look at the timestop code in 1477's code and the the main.asm file which actually allocates the memory (my code has a bug somewhere).
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ʟᴇᴇᴘ.
|