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