Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AI Copying [Part 1]
#1
In this tutorial I'll teach you how to copy the AI of one ID to another ID which has no AI.

Requirements :
*LF2
*OllyDbg
*A half decent brain

Do not attempt this if you lack a half decent brain.

First thing is first, open up Olly and load LF2 up. After it finishes press CTRL+F and copy paste this command(make sure the "Entire block" checkbox is ticked):
Code:
CMP DWORD PTR DS:[ECX+6F4],X
Where X is the ID number you want to duplicate. For example if you want to copy ID 4 then you type in:
Code:
CMP DWORD PTR DS:[ECX+6F4],04

You will then get to a point where you see these three lines:
Code:
0040A0DD   . 83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],4
0040A0E4   . 0F85 44020000  JNZ lf2.>>>>>0040A32E<<<<<
>>>>0040A0EA<<<<   . 81B8 08030000 >CMP DWORD PTR DS:[EAX+308],168
( don't worry about the arrows pointing at the number, you'll see why I put them when you keep reading)

Now I'll try to explain what they mean. The first line is a compare(CMP) command, it checks if [ECX+6F4](the address where the character ID is stored) is equal to 4. The next line is "Jump if not equal"(or to be exact Jump if not Zero, but don't worry about that :p), so that means if the CMP in the line above isn't true it will jump and skip all the AI code. For example if the character ID is 6 the jump is executed and all the AI stuff is skipped, if its 4 it isn't skipped and AI code is executed.

So basically, if we want to "Copy" the AI functions to another ID we just have to make the jump NOT execute on 4 AND our new ID. There are a lot of ways of writing that code, but I'm going to teach the simplest, straight forward , no brainier way of doing it.

Lets replace:
Code:
CMP DWORD PTR DS:[ECX+6F4],4
With:
Code:
JMP 00442612
This is just a JMP to a random place near the end of the program that is empty, it doesn't really matter where you jump. Now just press CTRL+G and type in 00442612 (or where ever you choose to jump) so that we can start writing our code at the new location.

First lets start by writing the original compare line. After that we will write a JE command(Jump if Equal) to 0040A0EA(this is the line after the JNZ, look up at the first block of code I copy pasted if you still don't know where the number came from). So your code should like like this:

Code:
00442612     83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],4
00442619    ^0F84 CB7AFCFF  JE lf2.0040A0EA
In english the code pretty much says: " If the id is 4 then go to the part of the code that handles AI".

So lets say we want to copy ID 4 AI to ID 60(which is 3C in hex, remember everything is in hex), all we have to do is add another CMP and a JE. So now our code looks like this:
Code:
00442612     83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],4
00442619    ^0F84 CB7AFCFF  JE test.0040A0EA
0044261F     83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],3C
00442626    ^0F84 BE7AFCFF  JE test.0040A0EA

To copy it to more ID's you just need to add another CMP and another JE after that. You can do this as much as you want.

All thats left now is to add a JMP(Unconditional jump) at the end of all of that, this is to make sure that if its any other ID the code continues to work and the program doesn't crash. So we do JMP 0040A32E(this is where it would normally jump if the ID wasn't 4, look at the JNZ part in the first block of code if you don't understand where the number came from).

Code:
00442612     83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],4
00442619    ^0F84 CB7AFCFF  JE test.0040A0EA
0044261F     83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],3C
00442626    ^0F84 BE7AFCFF  JE test.0040A0EA
0044262C    ^E9 FD7CFCFF    JMP test.0040A32E

In pseudo code the code means this:
Code:
IF ID = 4 OR ID = 60 {
Goto: AI section 4 }
ElSE {
Skip AI section 4}

NOTE : Thanks to RUDOLF27 for finding out that ID's
Quote:John - 2 (or 02)
Jack - 33 (21)
Jan - 36 (24)
Bat - 38 (26)
don't work. If you want to copy them, then just follow the tutorial normally and everytime you see ECX+6F4 replace it with EDX+6F4 .

----------------------------------------------------------

Tutorial end, don't copy this next bit if you want to copy this tutorial anywhere :p.
I tried my best to explain everything as clearly as possible, if you still don't understand that means you aren't trying enough, or you lack one of the requirements (half decent brain). Don't PM me for help as that will just annoy me, post here if something isn't clear.
[Image: doty7Xn.gif]

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ʟᴇᴇᴘ.


Reply
Thanks given by: Electric2Shock
#2
Quote:
Code:
0040A0DD   . 83B9 F4060000 >CMP DWORD PTR DS:[ECX+6F4],4
0040A0E4   . 0F85 44020000  JNZ lf2.>>>>>0040A32E<<<<<
>>>>0040A0EA<<<<   . 81B8 08030000 >CMP DWORD PTR DS:[EAX+308],168
there are 3 lines which two do you mean?
[Image: 18085qo3.png]
siggy made by scorpion

This is o_O. Help o_O by Copying and pasting o_O
into your signature to help him gain world domination.
Reply
Thanks given by:
#3
Changed two to three... It didn't really make a difference since I said "first line" and then "next line" which obviously means the first 2 >.<.
[Image: doty7Xn.gif]

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ʟᴇᴇᴘ.


Reply
Thanks given by:
#4
Could you change the AI from Bandit into monk ones plz?
My bandit can shoot energy-blasts with D>A, but the bandit-AI don't use D>A...
________________________________________________________________________
I
V (not making a new post---)
Well, I tried to, but all this numbers and letters confused meh--- I'm not kinda exe-editer

Sry, I don't meant that you are our hex-editer-pico, I just wanna ask where to change this because I have ablolutely no clue about exe-editing!
I HAVE SOME PROBLEMS WITH MY COMPUTER!
Please don't wonder when I suddenly dissapear for a while!
<a href="http://www.techno4ever.net">
[Image: banner01.gif]
</a>
rest of my siggy! (Click to View)
Reply
Thanks given by:
#5
Omg... I wrote this tutorial for a reason!!!! Just copy ID 35 to ID 30.

I don't understand why people think I'm their personal b*tch and should help them when I wrote a very clear and descriptive tutorial on how to do it and they don't even try to follow it.
[Image: doty7Xn.gif]

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ʟᴇᴇᴘ.


Reply
Thanks given by:
#6
Although I'm half braindead (which, btw, fulfills the half decent brain thingy :D), I understood the tutorial :D
And that with a debugging knowledge of about 0. Good job for making it that clear, Silva :)
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by:
#7
Silva Wrote:NOTE : Thanks to RUDOLF27 for finding out that ID's
Quote:John - 2 (or 02)
Jack - 33 (21)
Jan - 36 (24)
Bat - 38 (26)

don't work. If you want to copy them, then just follow the tutorial normally and everytime you see ECX+6F4 replace it with EDX+6F4 .
Wow, thanks, you're really an expert with hex!!! :D
[Image: azazel.gif]
Reply
Thanks given by:
#8
i am very smart but i look for like an hour and cant find whats up there
Reply
Thanks given by:
#9
Right click > goto > 4093B5 . Double click CMP EAX, 2 and replace it with JMP 44280D. Goto 44280D and write the code I posted.

The same code appears at 004094B2, do the same thing basically (just don't jump to 44280D, jump somewhere else like 44290D or something). Good luck :), Rudolf27 figured it out so you should be able to as well :) (I'll clean up the tutorial later, I'm currently working on something).
[Image: doty7Xn.gif]

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ʟᴇᴇᴘ.


Reply
Thanks given by:
#10
i have a problem,when i get the part where you tell use what the code say's in english i cant go any further...what should i doo?
Reply
Thanks given by:




Users browsing this thread: 4 Guest(s)