Enemy Skill Oversight Fixed.

  • Thread starter Thread starter DLPB_
  • Start date Start date
Status
Not open for further replies.
D

DLPB_

Guest
I'm not really sure if I need to preserve edi,ebx,esi here.  Didn't check.

Still this nifty replacement I've made for the Enemy Skill mask ensures that, from now on, the enemy skills MISSING from the total are what count, not the ones that are PRESENT.  See, originally, if one of your characters had a full enemy skill set, it would then stop all other enemy skills from learning all abilities. And if one of the materias had, say, Frog Song, then none of the others without it would gain it either.

Code: [Select]
Code:
Procedure CreateEnemySkillMask5CFB93; stdcall;Beginasmpush ebxpush esipush edixor edi,edimov esi,$00FFFFFFmov ecx,[esp+$10] //Starting address of character materia@START:xor ebx,ebx@LABEL1:cmp ebx,8je @Label5test edi,edijne @Label3  mov eax,[ecx+ebx*4+$40] // Retrieve Materia ID and AP in Weapon slot.  jmp @Label4@Label3:  mov eax,[ecx+ebx*4+$60] // Retrieve Materia ID and AP in Armour slot.@Label4:cmp al,$FF //If no materia in slot, then jump to next slot.je @Label2xor edx,edxmov dl,alimul edx,edx,$14mov dl,[edx+$DBDF6D] //retrieve formula ID for materiaand dl,$Fcmp dl,7  //materia is Enemy Skilljne @Label2shr eax,8and esi,eaxor esi,$80000000@LABEL2:inc ebxjmp @Label1  @LABEL5:  test edi,edi  jne @End    inc edi    jmp @START@END:mov eax,esipop edipop esipop ebxend;End;

Not rigorously tested yet, but seems to work.
 
What's the purpose of the Code: [Select]
Code:
or esi, $80000000
? Other than that it looks fine.
 
For some reason, the enemy skills learned address (9A8DDC for Member 0) requires that byte to be $80.  If it isn't, the address isn't changed.  Perhaps there is a check for it somewhere.  If it's 00, then I assume the game ignores writing to 9A8DDC.  [Edit.  005DB061 is where the check is made.  The originally game sets the byte to 0x80, but any non zero should work. If 00 then Enemy Skill is not equipped, you see.  There is a further check after that, which I am unsure of.]

It also seems to me that the mask check (xor) can be ignored?  All it will do then is ALWAYS update on battle victory when E Skill is in a slot, rather than what it does now- check if any change from e skill at battle start.

I've also disabled the victory E Skill update and put the update in battle exit (so that the E skill change will always be reflected).
 
Last edited:
I've also added the "if escape, still add kills"  to battle exit.
Code: [Select]
Code:
Procedure AddKillsOnEscape; stdcall;Beginasmpush ebxmov dx,[$9AB0C2]and edx,$C // if escape (04 or 08)test edx,edxje @Endxor edx,edxxor ebx,ebx@START:mov eax,ebxinc ebxcmp eax,2ja @Endxor edx,edxmov dl,[eax+$DC0230] // retrieve ID in slot 0-2cmp dl,$FFje @Startimul eax,eax,$34mov al,[eax+$9A8DBF]and eax,$000000FFimul edx,edx,$84add edx,$DBFD8C + $24  //Character kills.xor ecx,ecxmov cx,word ptr [edx]add ecx,eax  cmp ecx,$FFFF  jna @Label1    mov ecx,$FFFF  @Label1:mov word ptr [edx],cxjmp @Start@END:pop ebxend;
Ordinary escape is given value of 04.  Seems Smoke Bomb (and possibly other materia/item escapes) are given 08.  I am going to check what value is given when the "no reward screen" field opcode is operating.

Edit.  It uses 0x20...  so normal victory flag when the "no reward" is in use.  I'm going to need to disable the normal victory kill update as well and always force it on exit.
 
Last edited:
This is most interesting. So does that mean it is now possible to keep any learned enemy skills even after running from a battle? This is something I've been wishing for for a long time, thanks a ton! I'll definitely give this a try soon.
 
Yeah, it will fix the issue of them not saving.   8-)
 
Last edited:
Quick question though: Since I'm not a programmer and can't really make much sense of the code you posted, could you tell me what I need to change with a hex editor (I'm assuming this is in the exe?) and where exactly?
 
youll have to wait for reunion r06. it can't be added easily without my dll. it's a mandatory fux there along with many others.
 
Status
Not open for further replies.
Back
Top