Posts: 10
Threads: 6
Joined: Nov 2013
01-02-2014, 05:27 PM
(This post was last modified: 01-04-2014, 07:02 PM by Suzuya.)
Hi,
I just managed to write some code, which could be used as object-oriented sticky ball.
Basically my code works properly only when applied to ball, cause it transfers object number to ball's mana, and then in next frames this ball can affect only character which was initially hit.
Code: CMP EDX,907
JE getobjectnumber
CMP EDX,908
JE object_hit
Code: p2: JMP ik8_pos2
getobjectnumber:
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 DWORD PTR DS:[EdX+308h],edi ;attacker's mp
mov eax,dword ptr ds:[esi+edi*4+194h]
jmp dword ptr [ef_r2]
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;object_hit (hits specified object)
object_hit:
mov eax,dword ptr ds:[esi+edi*4+194h]
mov edx,dword ptr ds:[eax+368h]
cmp dword ptr ds:[edx+6F8h],0 ;type
jne p2
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]
MOV eax,DWORD PTR DS:[EDX+308h]
mov edi,eax
MOV ECX,DWORD PTR DS:[EDI*4+ESI+194h]
cmp byte ptr ds:[esi+edi+4],0
je x1
cmp edi,500
je x1
sub DWORD PTR DS:[ECX+2FCh],1 ;
cmp DWORD PTR DS:[ECX+2FCh],0 ;target's hp
jle x1
FLD QWORD PTR DS:[ECX+58h] ;x position
MOV EDX,DWORD PTR DS:[EBX*4+ESI+194h]
FSTP QWORD PTR DS:[EDX+58h] ;x position
MOV EAX,DWORD PTR DS:[EDI*4+ESI+194h]
FLD QWORD PTR DS:[EAX+68h] ;z position
MOV ECX,DWORD PTR DS:[EBX*4+ESI+194h]
FADD QWORD PTR DS:[ik8_pos4]
FSTP QWORD PTR DS:[ECX+68h] ;z position
x2: mov eax,dword ptr ds:[esi+edi*4+194h]
JMP ik8_pos3
x1: mov DWORD PTR DS:[EDX+70h],55 ;frame, where ball gets destroyed
jmp x2
I also changed John's healball, and made it to work like poison, but of course it is possible to change it, to make it doing something else by hex. Here's the code:
DC-Code:
<frame> 50 healball
pic: 24 state: 3002 wait: 90 next: 51 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 0 hit_d: 55 hit_j: 0
itr:
kind: 907 x: 25 y: 13 w: 32 h: 34
itr_end:
<frame_end>
<frame> 51 healball
pic: 25 state: 3002 wait: 0 next: 52 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 3 hit_d: 55 hit_j: 0
opoint:
kind: 1 x: 40 y: 39 action: 42 dvx: 0 dvy: 0 oid: 200 facing: 0
opoint_end:
itr:
kind: 908 x: -1000 y: -113 w: 2000 h: 134 arest: 10 zwidth: 1000
itr_end:
<frame_end>
<frame> 52 healball
pic: 26 state: 3002 wait: 0 next: 53 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 3 hit_d: 55 hit_j: 0
opoint:
kind: 1 x: 40 y: 39 action: 44 dvx: 0 dvy: 0 oid: 200 facing: 0
opoint_end:
itr:
kind: 908 x: -1000 y: -113 w: 2000 h: 134 arest: 10 zwidth: 1000
itr_end:
<frame_end>
<frame> 53 healball
pic: 28 state: 3002 wait: 0 next: 54 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 3 hit_d: 55 hit_j: 0
itr:
kind: 908 x: -1000 y: -113 w: 2000 h: 134 arest: 10 zwidth: 1000
itr_end:
<frame_end>
<frame> 54 healball
pic: 27 state: 3002 wait: 0 next: 51 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 3 hit_d: 55 hit_j: 0
opoint:
kind: 1 x: 40 y: 39 action: 42 dvx: 0 dvy: 0 oid: 200 facing: 0
opoint_end:
itr:
kind: 908 x: -1000 y: -113 w: 2000 h: 134 arest: 10 zwidth: 1000
itr_end:
<frame_end>
<frame> 55 healball
pic: 29 state: 3002 wait: 2 next: 56 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 0 hit_d: 0 hit_j: 0
<frame_end>
<frame> 56 healball
pic: 30 state: 3002 wait: 1 next: 57 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 0 hit_d: 0 hit_j: 0
<frame_end>
<frame> 57 healball
pic: 31 state: 3002 wait: 1 next: 1000 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 0 hit_d: 0 hit_j: 0
<frame_end>
|
In first 3 seconds, it changes it's mp value to last character that was touching it, after that it sticks to that character and makes him lose life.
When F7 is pressed, it doesn't stick anymore and just disappears. It does similar thing, when character is dead, or the timer runs up.
Edit:
Found a small bug. Just remove from 'object_hit:' these two lines:
Code: cmp dword ptr ds:[edx+6F8h],0 ;type
jne p2
It was causing bugs with sticky object, when weapon or other ball was nearer.
Edit:
Found out next awesome thing!
Now first frame of healball looks like this:
DC-Code:
<frame> 50 healball
pic: 24 state: 311 wait: 1 next: 51 dvx: 0 dvy: 0 centerx: 40 centery: 26 hit_a: 0 hit_d: 55 hit_j: 0
<frame_end>
|
There's no itr in this frame, only state, which switch dark red hp with mp. Here's the code:
Code: cmp dword ptr ds:[edx+ecx+7ACh],311 ;switch dhp to mp
je s311
Code: s311: ;switch dhp to mp
push eax
mov eax,dword ptr ds:[esi+300h]
mov dword ptr ds:[esi+308h],eax
pop eax
mov dword ptr ds:[esi+2FCh],500
jmp dword ptr [st_r2]
This is, because I made the opointed ball store creator's object number, so it will always stick to only him. Code:
Code: Max_HP proc
cmp ecx,200 ; Check if ID
je short s
cmp ecx,5
je short HP_10 ; go to the 10 HP part
jmp dword ptr [Max_HP2]
HP_10:
mov ecx,10
jmp dword ptr [Max_HP1]
s:
mov ecx,edi
jmp dword ptr [Max_HP1]
Max_HP endp]
I also want to ask someone to make Max_MP function, because that wouldn't require any state in first frame of the opointed ball, and I', not able to do that, cause I'm like total newb. :d
Posts: 1,018
Threads: 60
Joined: Mar 2008
01-05-2014, 01:47 AM
(This post was last modified: 01-05-2014, 01:51 AM by Boop.)
I'm not entirely sure how much you know, but there is some information here: http://www.lf-empire.de/forum/showthread...ght=max+hp
About doing max MP.
You code would look something like this:
Code: Max_MP proc
MOV DWORD PTR DS:[ESI+300],ECX ;original lines
MOV DWORD PTR DS:[ESI+308],ECX ; ^^
push eax
mov eax, dword ptr ds:[esi+368h]
mov eax, dword ptr ds:[eax+6f4h]
cmp eax,10 ; ID you are checking
jnz skip
MOV DWORD PTR DS:[ESI+300],600 ; mp
MOV DWORD PTR DS:[ESI+308],600 ; maximum mp
skip:
pop eax
push 004063E7h ;return address
retn
and have :
Quote:invoke JmpPatch, 004063DBh, addr Max_MP
in your main file.
I've not tested it, but it should work :P
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
01-05-2014, 10:13 AM
(This post was last modified: 01-16-2014, 07:28 PM by Suzuya.)
Thanks, maybe it should work, but not in my rarara.dll (from this thread http://www.lf-empire.de/forum/showthread.php?tid=2246). I think you're using newer version, which I don't wanna use, because there is broken mp function. :/
Unless someone fix that, I refuse to get this dll.
Edit:
Finally managed to write code by myself. This is my version of Max_HP function, since I'm not using the same version of the exe and dll.
Code: Max_HP proc
cmp ecx,5 ;Check if ID
je o
jmp dword ptr [Max_HP2]
o:
;mov ecx,500
mov dword ptr ds:[eax+2FCh],500 ;red hp
mov dword ptr ds:[eax+304h],500 ;max hp (I don't know exactly how this works ;d)
mov dword ptr ds:[eax+300h],500 ;dark red hp
mov dword ptr ds:[eax+308h],edi ;mp
mov eax,dword ptr ds:[ebx+esi*4+194]
jmp dword ptr [Max_HP2]
Max_HP endp
And a question for advanced hexers. Since we can store object number in hp or mp bar, why wouldn't we do it somewhere else. There are a few addresses which I find useless (like 31C or 35C), because there won't be any weapons in my mod I'm gonna work at, so I think I can use them, but my question is:
Are there MORE addresses in which it's possible to store some values?
Thanks given by:
|